RhinoCommon Brep split by plane


Is there a similar function to this one but instead of using breps I am looking for planes:


(Dale Fugier) #2

Hi @Petras_Vestartas,

1.) Define your Plane.
2.) Using your plane, create a PlaneSurface.
3.) Using the surface, create a Brep using Surface.ToBrep.

– Dale


Dear Dale,

Thank you.

All steps you described works for me.

I have an issue with rhinocommon checking IsPointInside.

Why the point that is visibly inside one brep, returns true for both breps?
Screenshot and file attached

SplitBrepWithPlanes.gh (11.5 KB)


I had to do explode stuff:
Duplicate all brep faces and join them to new brep.

Still would like to know why this ispointinside did not work

  Brep[] splitBrep = SolidCopy.Split(cutters[i], Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance);

  for(int j = 0; j < splitBrep.Length;j++){
    splitBrep[j] = splitBrep[j].CapPlanarHoles(Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance);

    Brep[] explodedBrep = new  Brep[splitBrep[j].Faces.Count];
    for(int k = 0; k < splitBrep[j].Faces.Count;k++){
      explodedBrep[k] = splitBrep[j].Faces[k].DuplicateFace(false);
    splitBrep[j] = Brep.JoinBreps(explodedBrep, Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance)[0];

(Nathan 'jesterKing' Letwory) #5

I don’t know how relevant this is for your work, but you may want to look at the clipping volume work I did: https://github.com/mcneel/RhinoCycles/blob/rhino-6.x/conversion/clipping_volume.gh

It should contain a C# script component that also splits breps with a plane.

Used for Problem with determining point based on surface UV

(Dale Fugier) #6

Hi @Petras_Vestartas,

Modify your code to look something like this:

for(int j = 0; j < splitBrep.Length;j++)
  splitBrep[j] = splitBrep[j].CapPlanarHoles(Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance);
  splitBrep[j].Faces.SplitKinkyFaces(RhinoMath.DefaultAngleTolerance, true);
  if (BrepSolidOrientation.Inward == splitBrep[j].SolidOrientation)

– Dale