Brep.CapPlanarHoles screws up the Brep

Hi, while trying to create previews for a custom beam component, I could not figure out how to correctly cap Brep planar holes.
The problem:

The open brep is seemingly nice and dandy. The section curves really are planar, and closed.

What am I not seeing?

Code creating the brep:

                SweepOneRail sweep = new SweepOneRail();
                sweep.ClosedSweep = true;
                sweep.AngleToleranceRadians = ConSteel.Constants.Values.EPS;
                sweep.SweepTolerance = ConSteel.Constants.Values.EPS;
                
                Brep[] retVal = sweep.PerformSweep(referenceCurve, outlineCurves);
                //Brep[] retVal = Brep.CreateFromSweep(referenceCurve, outlineCurves, true, ConSteel.Constants.Values.EPS);
                for (int i = 0; i < retVal.Length; i++)
                {
                    retVal[i] = retVal[i].CapPlanarHoles(0.001);
                }
                return retVal;

Hi @harmatb,

Can you post your input curves?

Thanks,

– Dale

Hi @dale,

see attached .gh file, with a simple script reproducing the problem, while the GH cap component keeps the brep from the same inputs intact.
BrepCapProblemExample.gh (5.0 KB)

Thanks for your attention,
Balint

Hi @harmatb,

Have a look at this and let me know if you have any questions.

BrepCapProblemExample-FIXED.gh (3.8 KB)

– Dale

Hi @dale,

Thank you for the help, the geometry is now correct.

Now while testing out, there is another weirdness, in the shading: (same example, just with a 1000 unit long rail)

I figured out if I just draw out the list of faces making up the brep not the actual brep, the preview is nice and as expected, but this seems like a cop out.
Is there some parameter of the brep where I can signal it to stop trying to smooth together the wrong faces?

Balint

Hi @harmatb,

Is this a different Grasshopper solution? Can you post the .gh file?

– Dale

Hi, @dale

you can get it by just replacing the rail line with a line from 0,0,0 to 1000,0,0. Here is a GH file which shows this at my side:
BrepCapProblemExample-FIXED.gh (8.3 KB)

Balint

Hi @harmatb,

I believe your seeing a display artifact. Improving the render mesh settings seems to fix.

BrepCapProblemExample-FIXED.gh (8.5 KB)

– Dale

1 Like

Hi @dale,

I see, thank you for the help.

-Balint.