Hello everyone, I’m trying to get the intersecting curves between a brep and a plane.
The command I’m using is this:
Intersection.BrepPlane(PSBrep, p, CurrentDocument.ModelAbsoluteTolerance, out topCurves, out topPoints);
Where:
PSBrep and p are the brep object and a plane with origin on (0,0,-750) and dir (0,0,1)
CurrentDocument is a stored reference to my active doc
topCurves and topPoints are two arrays of curves and point3d
Launching the command results in 2 curves instead of 1. If I manually create the plane and launch the Intersect command I get the expected single curve.
The only parameter that I think could make a difference would be the tolerance, but I checked and ModelAbsoluteTolerance is 0.001, the same number I get in the UI when I launch the Intersect command.
While preparing the model and the sample code I noticed that I couldn’t replicate the error anymore.
Unfortunately the whole geometry is under NDA so I can’t share it. I tried to extract only the relevant surfaces, re-join them into a polysurface but, in this case, the intersection code works as expected.
Imagine a long cylinder made up of several surfaces. This was the error.
For some reasons, the offending surface (the one without the curve), gets fixed when I extract only these sections. If I Join everything back the BrepPlane intersection command doesn’t work but it still works if I launch it via interface.
Upon further inspection I tried to explode everything, rebuild the offending surface, join everything together again and now it works even in code.
So I’m pretty sure it was only a geometric error and not something related to Rhino but still I’m not sure why it worked fine if I did it manually.