Trim surface with brep


I’m trying to trim a surface defined by a curve from Rhino. My initial idea was to create a box from a rectangle, that can be used as a cutting object. This needs to be a box, because i need to trim surfaces in multiple planes with the same cutting shape.

This setup does seem to work great with my first attempt. However, my second input curve doesn’t return a trimmed surface. Does this have something to do with how Grasshopper defines my curve geometry? Curve 1 is a ‘Closed Planar Curve’ while Curve 2 is a ‘Referenced Periodic Planar Curve’?

I hope some of you can help, or tell me how to improve my file. (Some of the components may seem unecessary, but it’s taken out of a bigger context.)

The file

What I try to attempt. Successful trimmed surface from Curve 1

Failed trimmed surface (with cutting shape) from Curve 2 (14.4 KB)


Your Curve 2 param is not internalized?

Ah, sorry. My mistake. It’s updated now.

Also, they are not located in {0, 0, 0} as the location makes sense in the original file. :slight_smile:

I’ve seen this behaviour before. It seems to happen when the seam of the curve is inside the area you are trying to trim with.

To get around this, you can adjust the seam of the curve so it is outside of this area, use Surface Split instead, etc, etc.

1 Like

I used Split Brep instead of Trim: (15.9 KB)


Moving the seam did the trick! Thank you, I would never have figured this one out.

I also thought of using Split Brep as you and Joseph_Oster both suggested, but it creates issues in other cases, where surface don’t split.

If you’re splitting surfaces instead of breps, you could also do it this way using SrfSplit: (13.2 KB)

P.S. A funny thing happened on the way to the forum…
I was about to move a single Boundary after Entwine to serve both curves and accidentally discovered that GH default behavior turns planar curves into boundary surfaces automagically! (11.4 KB)

1 Like

I tried your suggestion with Surface Split as well. It also worked for this single issue, but like Split Brep, it failed in other cases.

Your suggestion with Entwine and project seems interesting! I must admit, I haven’t really worked with Entwire before, so I might look into the file you have attached to learn a bit.

Thank you for your help!

I’m curious to see examples where SrfSplit fails? To really understand GH, you need to know why it fails.

Nothing special about Entwine. Project, on the other hand, can just as easily handle many “floors” widely separated in Z: (19.8 KB)

By the way, Srf SL is a cluster I wrote to return smallest and largest surfaces based on edge length, which is much faster than Area when there are many of them.

To be fair, I’m quite certain that SrfSplit works perfectly, and it’s me who mess up the structure in the file. @Joseph_Oster Maybe you can help me understand where I go wrong? I try to project 5 rectangles to each of the 8 surfaces, but I think this is where the problem is.

Intended trimmed surface

File structure (57.6 KB)

That definitely appears to be the case. :slight_smile:

  1. These “ribs” appear to be identical so you could have created just one and used polar array?
  2. The list of extruded and capped “solid” cutters (now in a purple group) is in a logical, sorted sequence. The list of ‘Surfaces to trim’ is in a different, jumbled sequence that doesn’t match! You got away with it in the sold trim because of the way you grafted but I fixed it using Sort Along Curve in the yellow group.
  3. I added Join after Edges so there is just one curve per notch.
  4. I added PShift and graft in places as appropriate to match the data trees.
  5. I replaced the last List Item with my Srf SL cluster to pick the largest surface. (81.3 KB)

It’s critical to understand and keep track of what’s happening at every single step. The code would be much smaller and simpler without the sorting and conversion from 3D to 2D cutters.

1 Like

Thank you for your response, @Joseph_Oster ! There are two sets of ribs, shifting. But you’re right, I could probably have used polar array as well.

I still have some trouble understanding branches and data trees. I understand the logic but lose track of the structure quite easily. I will definitely investigate your file and learn some methods and components! :slight_smile: I’m sure this won’t be the last time I run into trouble with branches and structure.

Hah, that’s an understatement. They are constantly the most important issue. I left a copy of my ‘Tree/List Viewer’ tool in the code. The other tool I use extensively is connecting text panels to component outputs so I can see the data tree structures at every step. Enjoy.

Oh, and as mentioned above, the code would be much smaller and simpler without the surface sorting and conversion from 3D to 2D cutters.

This version hides the surface sorting off screen, on the assumption that you can fix that elsewhere so sorting isn’t needed? I suspect the purple group that makes the cutters (rectangular curves) could be simpler too if the planes were created with proper orientation for 2D cutters instead of the original 3D. Notice that projecting the rectangles to planes isn’t needed at all, since they work fine just as they were created. Simpler code is better code. :sunglasses: (110.0 KB)