I am doing this work in a C# script node;
I tried to CreateBooleanUnion on a list of Breps. It failed.
I tracked down the problem to just one Brep. (deck1)
I unioned the rest into a Brep called: union. This gives me a valid, solid, closed Brep with no bad edges (open , not manifold).
Things go horribly wrong when this line is executed:
Brep saucer = Brep.CreateBooleanUnion(new Brep[]{union, deck1}, 0.01)[0];
- error: Object reference not set to an instance of an object. (line: 176)
0.01 is RhinoDocument.ModelAbsoluteTolerance;
The strange thing is…
if I do this: A = new Brep[]{union, deck1};
and I bake A…
and do this…
where the two baked breps are put into the Brep node (Set Multiple Breps)
and the code in the script node is: A = Brep.CreateBooleanUnion(x, 0.01)[0];
then it works and A contains a valid, closed Brep.
Things break again if I connect A directly to x.
So it looks like the process of baking does something to make the two Breps more better than they were when un-baked.
What on earth is baking doing? If I knew then maybe I could do that too.
I have tried:
foreach(Brep b in x)
{
b.Compact();
if (BrepSolidOrientation.Inward == b.SolidOrientation)
{
b.Flip();
}
}
A = Brep.CreateBooleanUnion(x, 0.01)[0];
but to no avail.
It just seems that baking a Brep makes it better somehow.