Trim PlaneSurface with a closed Curve as Outerloop


I am trying to trim a PlaneSurface with a closed Curve.

I tried following method :

Rhino.Geometry.Brep.Loops.AddPlanarFaceLoop(faceindex, Rhino.Geometry.BrepLoopType.Outer, Curve [1] closedboundary )

I am getting a Invalid brep every time i try this - what can be the cause for this ?
The boundary i supply is planar and consisting of a closed polyline with 5 points.

Also, it would be great if someone could highlight usage and difference between following methods as they both seem to serve similar purpose, unfortunately explanation in the sdk documentation is a bit thin :

Rhino.Geometry.Brep.Loops.AddOuterLoop() -> just needs a faceindex as input -> where do you supply a curve for this ?


Many thanks,

Hi Philipp,

Internally, ON_Brep::NewPlanarFaceLoop, which is what Rhino.Geometry.Brep.Loops.AddPlanarFaceLoop ends up calling, is somewhat of an expert tool. And while it works adding inner loops, it doesn’t work to add an outer loop to a face that already has an outer loop - you end up with 2 and, thus, an invalid Brep.

Ideally, you should be able to create a Brep by providing a plane and one our more outer loops. Then you can call AddPlanarFaceLoop to add what you want.

Since there isn’t anything available in RhinoCommon that does this in V5, I’ve added an item to get one added to V6.

– Dale

Hi Dale,

thank you for the explanation - so I guess there is also no other workaround to delete the current outer loop before adding a new one ?


Currently in RhinoCommon, no. In C++, yes.

Ok, thx Dale !