91 lines
3.2 KiB
Python
91 lines
3.2 KiB
Python
# pyright: reportUnusedCallResult=false, reportWildcardImportFromLibrary=false
|
|
from build123d import *
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|
|
with BuildPart() as drive_shaft_mount:
|
|
with BuildSketch():
|
|
with BuildLine() as profile:
|
|
l1 = Line(
|
|
(0,0),
|
|
((core_width / 2) + screw_blocks_width, 0)
|
|
)
|
|
|
|
polyline_path = (
|
|
l1 @ 1,
|
|
((l1 @ 1).X, screw_blocks_height),
|
|
(core_width / 2, screw_blocks_height),
|
|
)
|
|
match (float)(bearing_offset - screw_blocks_height):
|
|
case 0:
|
|
FilletPolyline(
|
|
*polyline_path,
|
|
radius=screw_blocks_radius
|
|
)
|
|
case len if len > 0 and len < screw_blocks_radius:
|
|
sbl = FilletPolyline(
|
|
*polyline_path,
|
|
radius=screw_blocks_radius
|
|
)
|
|
Line(
|
|
sbl @ 1,
|
|
((sbl @ 1).X, bearing_offset)
|
|
)
|
|
case len if len >= screw_blocks_radius:
|
|
FilletPolyline(
|
|
*polyline_path,
|
|
(core_width / 2, bearing_offset),
|
|
radius=screw_blocks_radius
|
|
)
|
|
case _: assert False
|
|
|
|
CenterArc((0, bearing_offset), core_width / 2, 90, -90)
|
|
mirror(profile.line, Plane.YZ)
|
|
make_face()
|
|
|
|
with Locations((0, bearing_offset)):
|
|
Circle(bearing_through_hole_diameter / 2, mode=Mode.SUBTRACT)
|
|
|
|
extrude(amount=thickness / 2)
|
|
mirror(about=Plane.XY)
|
|
|
|
with Locations((0, bearing_offset, drive_shaft_mount.faces().sort_by(Axis.Z)[-1].center().Z)):
|
|
Hole(bearing_diameter / 2, (thickness / 2) + (bearing_height / 2))
|
|
Hole(shaft_clearance_diameter / 2, (thickness / 2) - (bearing_height / 2))
|
|
|
|
Box(core_width + (screw_blocks_width * 2), track_width, track_height, (90, 0, 0), (Align.CENTER, Align.CENTER, Align.MIN))
|
|
|
|
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")
|