This is mostly a copy from our Discord discussion with Roger Maitland. Many thanks to him!
Here is what is happening - starting with this:
radius_guide_holes = 1
thickness = 2
rail_holes_loc = Pos(0, 3, 0) * GridLocations(4, 4, 2, 1)
plate = Box(10, 10, 3, align=(Align.CENTER, Align.CENTER, Align.MAX))
bolt_holes = [
loc * Cylinder(radius=radius_guide_holes, height=thickness)
for loc in Locations(rail_holes_loc)
]
If we print bolt_holes we get:
[Cylinder at 0x7fd85da57940, label(), #children(0), Cylinder at 0x7fd875fd2850, label(), #children(0)]
as one would expect, a list of Cylinder which is a specialized 3D only subclass of the Compound class.
At this point, If we add:
print(mirror(bolt_holes, about=Plane.XZ))
we'll see that mirror has created Part at 0x7fd875fd2730, label(), #children(0). Part is another specialized version of the Compound class for 3D objects. So when we do:
However, when we do this: bolt_holes += mirror(bolt_holes, about=Plane.XZ) we are adding a Part to a list so the code extracts the objects from the Part and adds them to the list. Unfortunately, the objects extracted are of type Compound which could be any dimension. Thus bolt_holes becomes:
[Cylinder at 0x7fd85da57940, label(), #children(0), Cylinder at 0x7fd875fd2850, label(), #children(0), Compound at 0x7fd85da57d00, label(), #children(0), Compound at 0x7fd875fd2820, label(), #children(0)]
a mix of Cylinder (3D) and Compound (?D).
Finally, when doing ex2 = plate - bolt_holes the first two subtractions work fine but when the code gets to the Compound objects its check to see if the dimensions are okay fails as there is no defined dimension for a Compound.
That was a lot of words to say this doesn't work. Please raise an Issue for it and maybe we can figure out a fix.
This is mostly a copy from our Discord discussion with Roger Maitland. Many thanks to him!
Here is what is happening - starting with this:
If we print
bolt_holes
we get:as one would expect, a list of
Cylinder
which is a specialized 3D only subclass of theCompound
class. At this point, If we add:we'll see that
mirror
has createdPart at 0x7fd875fd2730, label(), #children(0)
.Part
is another specialized version of theCompound
class for 3D objects. So when we do:which from a typing point of view we get:
However, when we do this:
bolt_holes += mirror(bolt_holes, about=Plane.XZ)
we are adding aPart
to a list so the code extracts the objects from thePart
and adds them to the list. Unfortunately, the objects extracted are of typeCompound
which could be any dimension. Thusbolt_holes
becomes:a mix of
Cylinder
(3D) andCompound
(?D).Finally, when doing
ex2 = plate - bolt_holes
the first two subtractions work fine but when the code gets to theCompound
objects its check to see if the dimensions are okay fails as there is no defined dimension for aCompound
.That was a lot of words to say this doesn't work. Please raise an Issue for it and maybe we can figure out a fix.