Boolean union on all objects using Python

Hello all,

I am creating numerous cylinders using rhino python. I am reading in x, y data points from a file to define the cylinder locations. Each time a cylinder is created, I want to Boolean union it with every other object. The goal is to make a wooden model on a ShopBot (so… CAM).

Here is the relevant section of my code: (obvious newbie…). All the code works - I am just interested in the Boolean Union part.
.
.
.
""" create the cylinders “”“
for line in data:
parsed = line.split(” ")
xOrig = float(parsed[0]) / xMax
yOrig = float(parsed[1]) / yMax
x = xOrig * (actualSize - 2. * radius) + radius + xOffset
y = yOrig * (actualSize - 2. * radius) + radius + yOffset

angMax = numPeaks * 2 * 3.1416
angX = xOrig * angMax
angY = yOrig * angMax
trig = abs(math.cos(angX) + math.sin(angY))/2.
thisHeight = (maxHeight - height0)*trig + height0

base = Rhino.Geometry.Point3d(x, y, 0.5)
height = Rhino.Geometry.Point3d(x, y, thisHeight)
newCylinder = AddCylinder(base, height, radius)

“”" need help here “”"
it = Rhino.DocObjects.ObjectEnumeratorSettings()
e = scriptcontext.doc.Objects.GetObjectList(it)
all = []
all.append(e)
all.append(newCylinder)
br = BooleanUnion(all)

1 Like