refactor(cad): wrap the drive_shaft_mount code in a function for organization

This commit is contained in:
2026-06-29 19:45:02 -05:00
parent bb7d3eaeae
commit 32db86d3cf
+25 -21
View File
@@ -1,34 +1,35 @@
# pyright: reportUnusedCallResult=false, reportWildcardImportFromLibrary=false
from build123d import *
bearing_offset = 20
bearing_diameter = 22
bearing_through_hole_diameter = 15
bearing_height = 7
shaft_clearance_diameter = 25
def build_drive_shaft_mount():
bearing_offset = 20
bearing_diameter = 22
bearing_through_hole_diameter = 15
bearing_height = 7
shaft_clearance_diameter = 25
core_width = 40
thickness = 20
core_width = 40
thickness = 20
screw_blocks_width = thickness
screw_blocks_height = bearing_offset
screw_blocks_radius = 3
screw_blocks_width = thickness
screw_blocks_height = bearing_offset
screw_blocks_radius = 3
screw_head_diameter = 8.5
screw_head_depth = 5
screw_body_diameter = 5
screw_head_diameter = 8.5
screw_head_depth = 5
screw_body_diameter = 5
track_width = 6.2
track_height = 1.8
track_width = 6.2
track_height = 1.8
assert (bearing_offset - bearing_diameter / 2) > 0
assert (core_width - bearing_diameter) > 0
assert (screw_blocks_width - (screw_blocks_radius * 2)) >= 0
assert (bearing_offset - screw_blocks_height) >= 0
assert (bearing_offset - bearing_diameter / 2) > 0
assert (core_width - bearing_diameter) > 0
assert (screw_blocks_width - (screw_blocks_radius * 2)) >= 0
assert (bearing_offset - screw_blocks_height) >= 0
with BuildPart() as drive_shaft_mount:
with BuildSketch() as sketch:
with BuildPart() as drive_shaft_mount:
with BuildSketch():
with BuildLine() as profile:
l1 = Line(
(0,0),
@@ -82,5 +83,8 @@ with BuildPart() as drive_shaft_mount:
with Locations(drive_shaft_mount.faces().filter_by(Plane.XZ).sort_by(Axis.Y)[-2:]):
CounterBoreHole(screw_body_diameter / 2, screw_head_diameter / 2, screw_head_depth)
return drive_shaft_mount
drive_shaft_mount = build_drive_shaft_mount()
assert drive_shaft_mount.part is not None
export_step(drive_shaft_mount.part, "drive shaft mount.step")