@@ -92,6 +92,7 @@ class Spec:
9292 enclosure_wall_thickness_top : float = 2
9393 enclosure_bottom_wall_standoff_height : float = 4.0 # Avoid THT solder points, nuts.
9494 enclosure_bottom_wall_standoff_od : float = 9.0
95+ pcb_retention_wall_thickness : float = 2
9596
9697 # Bolts for joining the top/bottom halves of the enclosure securely.
9798 joiner_bolt_d : float = 3 # M3.
@@ -267,13 +268,6 @@ def make_enclosure_top(spec: Spec) -> bd.Part | bd.Compound:
267268 align = bde .align .ANCHOR_BOTTOM ,
268269 )
269270
270- # Remove the RP2040 cutout.
271- p -= box_from_ranges (
272- range_x = spec .rp2040_cutout_x_range ,
273- range_y = spec .rp2040_cutout_y_range ,
274- range_z = (- 50 , 50 ),
275- )
276-
277271 # Add spring posts.
278272 spring_post_y_max = inside_of_box_z_val
279273 # spring_post_y_min = ( # Old complex logic before simplification by substitution.
@@ -297,17 +291,56 @@ def make_enclosure_top(spec: Spec) -> bd.Part | bd.Compound:
297291 align = bde .align .ANCHOR_TOP ,
298292 )
299293
300- # Add a larger post/stopper right in the corner.
294+ # Add a larger post/stopper right in the corners (similar to springs).
295+ for x_corner , y_corner in product ((1 , - 1 , 0 ), (1 , - 1 )):
296+ # In the corners, these don't make a huge difference because the spring posts
297+ # are there anyway. Useful on the edge!
298+ corner_outset_distance = 1.0 if x_corner != 0 else 0.0
301299 p += bd .Pos (
302- x_corner * ( spec .pcb_length_x / 2 + 2.0 ),
303- y_corner * ( spec .pcb_length_y / 2 + 2.0 ),
300+ x_corner * spec .pcb_length_x / 2 + ( x_corner * corner_outset_distance ),
301+ y_corner * spec .pcb_length_y / 2 + ( y_corner * corner_outset_distance ),
304302 spring_post_y_max ,
305303 ) * bd .Cylinder (
306304 radius = 7.0 / 2 ,
307305 height = spec .spring_post_length ,
308306 align = bde .align .ANCHOR_TOP ,
309307 )
310308
309+ # Add an X-Y retention box around the edges.
310+ p += (
311+ bd .Box (
312+ spec .pcb_length_x + 2 * spec .pcb_retention_wall_thickness ,
313+ spec .pcb_length_y + 2 * spec .pcb_retention_wall_thickness ,
314+ spec .spring_post_length + spec .pcb_travel_z + spec .pcb_thickness ,
315+ align = bde .align .ANCHOR_TOP ,
316+ )
317+ - bd .Box (
318+ spec .pcb_length_x ,
319+ spec .pcb_length_y ,
320+ 100 , # Arbitrary. Cut hole.
321+ )
322+ ).translate ((0 , 0 , inside_of_box_z_val ))
323+
324+ # Remove viewing holes inline with the DC cam motors (axles in X axis).
325+ for x_sign , y_sign in product ((1 , - 1 ), (1 , - 1 )):
326+ p -= bd .Pos (
327+ x_sign * (spec .enclosure_total_x / 2 ),
328+ y_sign * (spec .pcb_length_y / 2 - 10.0 ),
329+ spec .enclosure_total_z / 2 ,
330+ ) * bd .Box (
331+ # spec.enclosure_wall_thickness_xy * 2.1, # Little more than the WT.
332+ (spec .enclosure_total_x - spec .pcb_length_x ) / 2 + 5 ,
333+ 15.0 , # Gap size.
334+ spec .enclosure_total_z - 5.0 , # Gap size.
335+ )
336+
337+ # Remove the RP2040 cutout.
338+ p -= box_from_ranges (
339+ range_x = spec .rp2040_cutout_x_range ,
340+ range_y = spec .rp2040_cutout_y_range ,
341+ range_z = (- 50 , 50 ),
342+ )
343+
311344 return p
312345
313346
0 commit comments