def body(self):
"""
Generates the body
Joints:
`top`: Represents the center at the top of the box
"""
top_location = (0, 0, self.EXT_HEIGHT / 2)
bottom_location = (0, 0, -self.EXT_HEIGHT / 2)
# Base
solid = Cylinder(self.EXT_RADIUS, self.EXT_HEIGHT)
# Inner volume
solid -= (
Location(bottom_location)
* Cylinder(self.EXT_RADIUS - self.THICKNESS, self.TOWER_HEIGHT + self.THICKNESS, align=self.ALIGN_Z_MIN)
) # fmt:off
# Bottom stop
bottom_stop = (
Cylinder(self.EXT_RADIUS + self.THICKNESS, self.THICKNESS, align=self.ALIGN_Z_MAX)
- Cylinder(self.TOWER_RADIUS - self.THICKNESS, self.THICKNESS, align=self.ALIGN_Z_MAX)
) # fmt:off
solid += Location(bottom_location) * bottom_stop
# Inner cylinder
tower = Cylinder(self.TOWER_RADIUS, self.TOWER_HEIGHT, align=self.ALIGN_Z_MIN)
tower = chamfer(tower.edges().filter_by(GeomType.CIRCLE).sort_by(Axis.Z)[-1], self.TOWER_RADIUS - 0.1)
inner_tower = Cylinder(self.TOWER_RADIUS - self.THICKNESS, self.TOWER_HEIGHT - self.THICKNESS, align=self.ALIGN_Z_MIN)
inner_tower = chamfer(
inner_tower.edges().filter_by(GeomType.CIRCLE).sort_by(Axis.Z)[-1],
self.TOWER_RADIUS - self.THICKNESS - 0.1
) # fmt: off
tower -= inner_tower
inner_cylinder_air_hole = Rotation(X=90) * Cylinder(self.HOLES_RADIUS, self.TOWER_RADIUS * 3)
inner_cylinder_air_holes_base = Solid()
amount = 8
for i in range(amount):
inner_cylinder_air_holes_base += Rotation((0, 0, 180 / amount * i)) * inner_cylinder_air_hole
distribution_height = self.TOWER_HEIGHT - self.TOWER_RADIUS - self.THICKNESS
amount = math.floor(distribution_height / (self.HOLES_RADIUS * 2 + self.THICKNESS))
step = distribution_height / amount
tower_holes = Solid()
for i in range(amount):
tower_holes += Location((0, 0, self.THICKNESS + self.HOLES_RADIUS + i * step)) * inner_cylinder_air_holes_base
tower -= tower_holes
solid += Location(bottom_location) * tower
# Lock
lock_hole = Location(top_location, (0, 180, 0)) * SlidingHole(
cap_lid_hole_radius=self.EXT_RADIUS - self.THICKNESS * 2,
cap_height=self.LID_THICKNESS,
cap_outer_thickness=self.THICKNESS,
lid_shoulder=self.LID_SHOULDER,
lid_sliders=3,
)
solid -= lock_hole
# Bottom holes
bottom_holes = self._holes(
radius=self.EXT_RADIUS,
inner_radius=self.TOWER_RADIUS,
location=(0, 0, -((self.EXT_HEIGHT - self.THICKNESS) / 2))
) # fmt: off
solid -= bottom_holes
solid = chamfer(solid.edges().filter_by(GeomType.CIRCLE).sort_by(SortBy.LENGTH)[-1], self.THICKNESS / 2)
# --------------------------------------------------------------
# Joints
# --------------------------------------------------------------
top_center = Location(solid.faces().filter_by(Plane.XY).sort_by(Axis.Z)[-1].center())
RigidJoint(label="top", to_part=solid, joint_location=top_center)
return solid