12th April 2024

Have you tried filtering curves by their properties in Grasshopper?

My work has recently got me working with a lot of geometry in Grasshopper which is a welcome change for me. But in doing so, I found a pattern in categorising geometry in Grasshopper that I thought would be useful to share with you.

The idea is pretty straightforward. All geometry has properties and it's up to us as users to make the most out of them. To put this more concretely, let's look at an example.

Let's say I have this helical brep that I am working with. And I would like to extract the top and bottom edges of the geometry.

By looking at the edges of the brep, I can't simply just take the edges and call it a day. You see that many internal lines make up this brep.

The good thing is that these internal curves all have a "vertical" property which I can use to my advantage. By filtering out the " vertical " edges, I can get the ones I am after.

"vertical" here refers to the direction of the curve which I can get by using the evaluate curve component for a certain point on each edge.

I can then perform a dot product between the edge direction and the z-axis which tells me the angle between the edges and the z-axis. I can then use this angle to filter out any edges that are close to 1. (if dot products are confusing, this link explains it quite well)

Because of all the geometry work, I have been doing lately, this is a pretty handy trick that I have been using a lot. Especially when I have to deal with dirty geometry like this brep.

This method isn't limited to just the direction of the edges, you can realistically use any property of any geometry that you have. It's just a matter of having enough experience to know all the different ways that you can filter and sort your data.

I hope that helps.

Thanks for reading.

Braden Koh

    -->