Hi,
Thanks in advance
Problem statement:
Brep.Split() returns a list of breps(in this case surfaces) where each brep/surface has randomly ordered edge list when compared to other breps/surfaces.
Workflow:
I am attempting to split a curve with other curves so that I can extract some regions in between.
I am trying to get closed curves of region 0, 1 and 2 as show in image.
Next step is to perform contour and split on these extracted regions.
I would prefer to align this second step from one side for all regions. Say from left going to right
When I looked at the edges of these split surfaces, I realised that the first edge is not always ordered in a specific way. Green ones in the image below are the first edge of each surface after splitting.
Conclusion:
I wanted to understand how brep.split() works and if there is something obvious I am missing where it can return the split surfaces where all first edges align.
private void RunScript(Curve boundary, List<Curve> curveList, ref object A)
{
double tol = Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance;
//creating planar surface from boundary
Brep[] surfaceArray = Brep.CreatePlanarBreps(boundary, tol);
Brep planarBrep = new Brep();
if(surfaceArray != null && surfaceArray.Length == 1)
{
planarBrep = surfaceArray[0];
}
//splitting surface and creating a new curve list of surface edges
Brep[] splitSurfaces = planarBrep.Split(curveList, tol);
List<Curve> splitSurfaceBoundaries = new List<Curve>();
foreach(Brep brep in splitSurfaces)
{
Curve[] surfaceEdges = brep.DuplicateEdgeCurves();
splitSurfaceBoundaries.AddRange(Curve.JoinCurves(surfaceEdges, tol, true).ToList());
}
A = splitSurfaceBoundaries;
}