feat(cad): build the drive_shaft_bar_adapter part in 3d instead of 2d sides with PolarLocations

This commit is contained in:
2026-06-29 20:59:06 -05:00
parent 2bc95a9dd5
commit 1761e56e1a
+33 -14
View File
@@ -86,27 +86,46 @@ def build_drive_shaft_mount():
return drive_shaft_mount
def build_drive_shaft_bar_adapter():
extrusion_size = 20
ext_size = 20
height = 60
thickness = 10
with BuildPart() as drive_shaft_bar_adapter_slice:
with BuildSketch(Plane.XZ.offset(extrusion_size / -2)):
Rectangle(extrusion_size + (thickness * 2), height, align=(Align.CENTER, Align.MIN))
ext_screw_hole_diam = 6
ext_screw_hole_offset = 10
with Locations((0, height - 10)):
Circle(5, mode=Mode.SUBTRACT)
extrude(amount=-thickness)
Box(extrusion_size / 2, extrusion_size / 2, thickness, align=(Align.MIN, Align.MIN, Align.MIN))
with Locations((8, 8, 0)):
Hole(4)
shaft_hub_bore_diam = 8
shaft_hub_center_diam = 14
shaft_hub_center_depth = 2
# if you where to draw a square around the center of the shaft hub this var is the length of the sides and each corner is the center of a screw hole
shaft_hub_screw_spacing = 16
shaft_hub_screw_diam = 4
# the depth of the screw holes into the shaft hub
shaft_hub_screw_depth = 8
shaft_hub_screw_head_depth = 4
shaft_hub_screw_head_diam = 7
with BuildPart() as drive_shaft_bar_adapter:
with PolarLocations(0, 4):
add(drive_shaft_bar_adapter_slice)
Box(ext_size + (thickness * 2), ext_size + (thickness * 2), height, align=(Align.CENTER, Align.CENTER, Align.MIN))
# hollow the box
with Locations((0, 0, thickness)):
Box(ext_size, ext_size, height - thickness, align=(Align.CENTER, Align.CENTER, Align.MIN), mode=Mode.SUBTRACT)
# extrusion screw holes
with Locations((0, 0, height - ext_screw_hole_offset)):
with PolarLocations(4, 4):
with Locations(Rotation(0, 90, 0)):
Hole(ext_screw_hole_diam / 2)
# shaft interface
with Locations(drive_shaft_bar_adapter.faces().filter_by(Plane.XY).sort_by(Axis.Z)[1].offset(shaft_hub_screw_head_depth)):
l = shaft_hub_screw_spacing / 2
with Locations((-l, -l), (-l, l), (l, -l), (l, l)):
CounterBoreHole(shaft_hub_screw_diam / 2, shaft_hub_screw_head_diam / 2, shaft_hub_screw_head_depth, thickness + shaft_hub_screw_depth)
with Locations(drive_shaft_bar_adapter.faces().sort_by(Axis.Z)[0].center()):
Hole(shaft_hub_bore_diam / 2)
Hole(shaft_hub_center_diam / 2, shaft_hub_center_depth)
return drive_shaft_bar_adapter