Trim Surface with Closed Surface/Solid


Through the Rhino GUI, we can trim a surface with a sphere and retain the part of the surface that lies outside of it. I need to do the same thing in a script (and with other types of closed solids as well).

Rhino.Geometry.Brep.Trim(Brep, Double) will only return the part of the surface that lies inside a closed Brep.

Is there another method I should look at?


Use Brep.Split. You’ll have to write some code to determine the parts you want to keep, and the parts you want to throw away.

In addition to what @nathanletwory mentionned above, you can get the individual bounding boxes of the surfaces fragments that result from the splitting, and use their centers to evaluate whether the fragment in question lies outside or inside the closed brep. Now there are a couple of cases, where you need to check more points, but this should generally yield accurate results.

Perfect. Thank you both.