diff --git a/cad/build.py b/cad/build.py index bc12617..6629724 100644 --- a/cad/build.py +++ b/cad/build.py @@ -4,22 +4,63 @@ from build123d import * hole_offset = 20 hole_diameter = 22 -width = 40 +core_width = 40 thickness = 20 +screw_blocks_width = thickness +screw_blocks_height = hole_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 (hole_offset - hole_diameter / 2) > 0 -assert (width - hole_diameter) > 0 +assert (core_width - hole_diameter) > 0 +assert (screw_blocks_width - (screw_blocks_radius * 2)) >= 0 +assert (hole_offset - screw_blocks_height) >= 0 with BuildPart() as builder: with BuildSketch() as sketch: with BuildLine() as profile: - l1 = Polyline( + l1 = Line( (0,0), - (width / 2, 0), - (width / 2, hole_offset) + ((core_width / 2) + screw_blocks_width, 0) ) - l2 = CenterArc((0, hole_offset), width / 2, 90, -90) + + polyline_path = ( + l1 @ 1, + ((l1 @ 1).X, screw_blocks_height), + (core_width / 2, screw_blocks_height), + ) + match (float)(hole_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, hole_offset) + ) + case len if len >= screw_blocks_radius: + FilletPolyline( + *polyline_path, + (core_width / 2, hole_offset), + radius=screw_blocks_radius + ) + case _: assert False + + CenterArc((0, hole_offset), core_width / 2, 90, -90) mirror(profile.line, Plane.YZ) make_face() @@ -29,5 +70,10 @@ with BuildPart() as builder: extrude(amount=thickness / 2) mirror(about=Plane.XY) + Box(core_width + (screw_blocks_width * 2), track_width, track_height, (90, 0, 0), (Align.CENTER, Align.CENTER, Align.MIN)) + + with Locations(builder.faces().filter_by(Plane.XZ).sort_by(Axis.Y)[-2:]): + CounterBoreHole(screw_body_diameter / 2, screw_head_diameter / 2, screw_head_depth) + assert builder.part is not None export_step(builder.part, "drive shaft mount.step")