@@ -24,29 +24,36 @@ class MainSpec:
2424
2525 motor_od : float = 6
2626
27- # Motor length must be "motor+gearbox+shaft_lip"
27+ # Motor length variable here is "motor+gearbox+shaft_lip".
2828 motor_length_plus_gearbox_plus_shaft_lip : float = 19.8
2929 motor_x_limit_thickness : float = 1.3
3030 motor_shaft_lip_length : float = 1.1
3131
32- hole_spacing_x : float = 5.3
33- hole_count_x : int = 3
34-
35- hole_spacing_y : float = 9 .0
32+ # Peg settings (in corners).
33+ peg_sep_y : float = 9.0
34+ peg_od : float = 3.0
35+ peg_height : float = 1 .0
3636
37- corner_screw_d : float = 2.8
38- center_screw_d : float = 3.25
39-
40- bolt_head_od : float = 5.6
41- bolt_head_height : float = 0.001 # Disabled, basically.
37+ # Screw hole settings (in center).
38+ # TODO(KilowattSynthesis): Make these holes M2 on the PCB.
39+ screw_hole_sep_y : float = 10.0 # Shift the M2 screws toward the outsides.
40+ screw_d : float = 1.9 # M2 thread-forming.
4241
42+ # Other core layout settings.
43+ hole_spacing_x : float = 5.3
4344 top_wall_t : float = 1.5
45+ total_y : float = 16.0
4446
4547 def __post_init__ (self ) -> None :
4648 """Post initialization checks."""
4749 data = {
4850 "total_x" : self .total_x ,
4951 "total_z" : self .total_z ,
52+ "wall_thickness_past_screw_hole" : (
53+ # Wall thickness past the screw holes.
54+ # Validate: >=1.5 or >=2.0 roughly.
55+ (self .total_y / 2 ) - (self .screw_hole_sep_y / 2 + self .screw_d / 2 )
56+ ),
5057 }
5158 logger .info (json .dumps (data , indent = 2 ))
5259
@@ -77,15 +84,21 @@ def make_dc_motor_clamp(spec: MainSpec) -> bd.Part | bd.Compound:
7784 p = bd .Part (None )
7885
7986 # Draw the main body.
80- p += bd .Pos (
87+ main_body = bd . Part ( None ) + bd .Pos (
8188 X = - spec .motor_length_plus_gearbox_plus_shaft_lip / 2
8289 - spec .motor_x_limit_thickness
8390 ) * bd .Box (
8491 spec .total_x ,
85- spec .hole_spacing_y + 8 ,
92+ spec .total_y ,
8693 spec .total_z ,
8794 align = (bd .Align .MIN , bd .Align .CENTER , bd .Align .MIN ),
8895 )
96+ p += main_body .fillet (
97+ radius = 1.6 ,
98+ # Round all edges except the bottom edges.
99+ edge_list = main_body .edges () - main_body .faces ().sort_by (bd .Axis .Z )[0 ].edges (),
100+ )
101+ del main_body
89102
90103 # Remove bottom half of motor.
91104 # Make it easy to slide the motor in.
@@ -96,15 +109,6 @@ def make_dc_motor_clamp(spec: MainSpec) -> bd.Part | bd.Compound:
96109 align = bde .align .ANCHOR_BOTTOM ,
97110 )
98111
99- # Remove thin walls around the holes.
100- for x_val in bde .evenly_space_with_center (spacing = spec .hole_spacing_x , count = 3 ):
101- p -= bd .Pos (X = x_val ) * bd .Box (
102- max (spec .corner_screw_d , spec .corner_screw_d ) + 0.1 ,
103- spec .hole_spacing_y ,
104- spec .motor_od * 0.75 ,
105- align = bde .align .ANCHOR_BOTTOM ,
106- )
107-
108112 # Remove space for wires out the back.
109113 p -= bd .Pos (
110114 X = - spec .motor_length_plus_gearbox_plus_shaft_lip / 2
@@ -125,37 +129,21 @@ def make_dc_motor_clamp(spec: MainSpec) -> bd.Part | bd.Compound:
125129 ).rotate (axis = bd .Axis .Y , angle = 90 )
126130
127131 # Remove the screw holes.
128- for x_value , y_value in product (
129- [0 ],
130- bde .evenly_space_with_center (spacing = spec .hole_spacing_y , count = 2 ),
131- ):
132- p -= bd .Pos (X = x_value , Y = y_value ) * bd .Cylinder (
133- radius = spec .center_screw_d / 2 ,
134- height = 40 ,
135- align = bde .align .ANCHOR_BOTTOM ,
136- )
137-
138- # Remove the bolt head for the outermost screw holes.
139- for x_value , y_value in product (
140- bde .evenly_space_with_center (spacing = spec .hole_spacing_x * 2 , count = 2 ),
141- bde .evenly_space_with_center (spacing = spec .hole_spacing_y , count = 2 ),
142- ):
143- # Remove the screw holes.
144- p -= bd .Pos (X = x_value , Y = y_value ) * bd .Cylinder (
145- radius = spec .corner_screw_d / 2 ,
132+ for y_sign in (1 , - 1 ):
133+ p -= bd .Pos (X = 0 , Y = y_sign * spec .screw_hole_sep_y / 2 ) * bd .Cylinder (
134+ radius = spec .screw_d / 2 ,
146135 height = 40 ,
147136 align = bde .align .ANCHOR_BOTTOM ,
148137 )
149138
150- # Remove the bolt head.
151- p -= bd .Pos (
152- X = x_value ,
153- Y = y_value ,
154- Z = spec .total_z - spec .bolt_head_height ,
139+ # Add the pegs (in corners).
140+ for x_sign , y_sign in product ((- 1 , 1 ), (- 1 , 1 )):
141+ p += bd .Pos (
142+ X = x_sign * spec .hole_spacing_x , Y = y_sign * spec .peg_sep_y / 2
155143 ) * bd .Cylinder (
156- radius = spec .bolt_head_od / 2 ,
157- height = spec .bolt_head_height ,
158- align = bde .align .ANCHOR_BOTTOM ,
144+ radius = spec .peg_od / 2 ,
145+ height = spec .peg_height ,
146+ align = bde .align .ANCHOR_TOP ,
159147 )
160148
161149 return p
0 commit comments