Hi,
I’m trying to give surfaces a thickness and join them together and run into an issue. It seems like after using Brep.CreateBooleanUnion the result is more like what I would expect from Boolean Intersection?
For some reason I cannot recreate it with Python though.
This is what I’m using as input:
221201 Boolean Union.3dm (153.1 KB)
This is what I get after using Brep.CreateBooleanUnion using C#:
This is the code I’ve been using. I’ve been testing with RhinoCode in WIP but it’s actually code I copied and adjusted from a plug-in for Rhino 7 I work on in Visual studio:
using System.Collections.Generic;
using Rhino;
using Rhino.Commands;
using Rhino.Geometry;
using Rhino.Input;
using Rhino.Input.Custom;
using Rhino.DocObjects;
using System.Linq;
var doc = RhinoDoc.ActiveDoc;
var tolerance = 0.01;
var go = new GetObject();
go.GeometryFilter = ObjectType.Brep;
go.SetCommandPrompt("Select Surfaces to Thicken");
var compInd = new List<ComponentIndex>();
while (true)
{
GetResult res = go.GetMultiple(1,0);
if (go.CommandResult() != Result.Success)
return;
if (res == GetResult.Option)
continue;
//Setup variable from command output
break;
}
double thickness = 4;
var objrefs = go.Objects();
Brep[] brepsToThicken = objrefs.Select(x=>x.Brep()).ToArray();
var solids = new List<Brep>();
foreach (var brep in brepsToThicken)
{
var OffsetSolids = Brep.CreateOffsetBrep(brep, thickness, true, true, tolerance, out Brep[] outblends, out Brep[] Outwalls);
foreach (var s in OffsetSolids)
{
solids.Add(s);
doc.Objects.AddBrep(s);
}
}
var BUBreps = Brep.CreateBooleanUnion(solids, tolerance);
if (BUBreps.Count() != solids.Count)
{
foreach (var s in BUBreps)
doc.Objects.AddBrep(s);
}
What am I doing wrong?