Hello everybody,
In a C# component for GH, I want to split a closed Brep into several closed Breps.
First I use the Brep.Split operation with the cutter I want. This works fine. It results in open Brep, that Ii want to close in a next step.
To do so, I used Brep.CapPlanarHoles but it does nothing.
What’s really annoying is that:
- If I bake the open brep and use the Rhino command CapHoles it works perfectly
- If I add the GH internal component Cap Holes, it also works.
The problem is that I want to do it all in C# for a bigger component.
Thanks a lot,
Nathanaël
PS: Here is the code
//Creation of the Brep
-
Point3d O = new Point3d(0, 0, 0);*
-
Point3d P = new Point3d(200, 40, 20);*
-
BoundingBox Bl_temp = new BoundingBox(O, P);*
-
Brep brep = Brep.CreateFromBox(Bl_temp);*
-
// Creation of the cutter for the lintel (initialisation)*
-
Vector3d x_vector = new Vector3d(200, 0, 0);*
-
Point3d L_1 = new Point3d(0, 0, -5);//Cutter extends a bit out of the layer (z-direction) to avoid problems when splitting*
-
Point3d L_2 = new Point3d(0, 0, 25);//Cutter extends a bit out of the layer (z-direction) to avoid problems when splitting*
-
List Points = new List();*
-
Points.Add(L_1);*
-
Points.Add(L_2);*
-
Curve line = Curve.CreateControlPointCurve(Points, 1);*
-
Surface Cutter = Surface.CreateExtrusion(line, x_vector);*
-
//Creation of the list of cutters*
-
List Cutters = new List (); //List of cutters*
-
for (int i = 0;i < 3;i++){*
-
L_1.Y = L_1.Y + 10;*
-
L_2.Y = L_1.Y;*
-
List <Point3d> Points_temp = new List<Point3d>();*
-
Points_temp.Add(L_1);*
-
Points_temp.Add(L_2);*
-
Curve line_temp = Curve.CreateControlPointCurve(Points_temp, 1);*
-
Surface Cutter_temp = Surface.CreateExtrusion(line_temp, x_vector);*
-
Cutters.Add(Cutter_temp.ToBrep());*
-
}*
-
A = Cutters;*
-
B = brep;*
-
//Cutting process*
-
Brep Brep_temp = brep.Split(Cutters, 1E-6);*
-
Brep bl_temp = Brep_temp[2];*
-
bl_temp.CapPlanarHoles(1E-6);*
-
C = bl_temp;*