Hello everyone,
i got issues using the boolean operations of the Brep class.
Even though I know that two breps do intersect the CreateBooleanSplit method returns an empty array. If I understand correctly this means that the split was successfull, but why do I get no results then?
This is the code i wrote: (all Breps are solid and manifold in this example)
//Extrude shape along line.
Plane linePlane = new Plane(line.From, Vector3d.CrossProduct(line.Direction, plane.ZAxis), plane.ZAxis);
Curve orientedShape = shape.DuplicateCurve();
orientedShape.Transform(Transform.PlaneToPlane(Plane.WorldXY, linePlane));
Brep brep = Brep.CreateFromSweep(line.ToNurbsCurve(), orientedShape, true, tolerance)[0];
brep.Faces.SplitKinkyFaces(); //fix 4-sided surface for boolean.
brep = brep.CapPlanarHoles(tolerance); //sweep doesn't do it!
//Move brep for boolean opperations.
brep.Transform(Transform.Translation(intersectionVector));
brep = brep.DuplicateBrep(); //fix brep transform for boolean.
for (int i = 0; i < placedBreps.Count; i++)
{
Curve[] intersectionCurves;
Point3d[] intersectionPoints;
if(Intersection.BrepBrep(brep, placedBreps[i], tolerance, out intersectionCurves, out intersectionPoints))
{
Brep[] splitResults = Brep.CreateBooleanSplit(brep, placedBreps[i], tolerance);
brep = splitResults[0];
placedBreps[i] = splitResults[1];
}
}
Hopefully someone knows how to use these methods!
Best regards,
Frezap