@@ -42,8 +42,8 @@ class Spec:
4242 cell_count_x : int = 4
4343 dot_hole_id : float = 1.7
4444
45- pcb_length_x : float = 95
46- pcb_length_y : float = 99
45+ pcb_length_x : float = 95.1
46+ pcb_length_y : float = 99.1
4747
4848 # Settings controlling the Z travel of the PCB inside in the enclosure.
4949 pcb_thickness : float = 0.8
@@ -283,18 +283,13 @@ def make_enclosure_top(spec: Spec) -> bd.Part | bd.Compound:
283283 # + spec.pcb_travel_z
284284 # )
285285 for x_corner , y_corner in product ((1 , - 1 ), (1 , - 1 )):
286- for x_small_multiplier , y_small_multiplier in ((1 , 0 ), (0 , 1 )):
286+ for x_cut_in , y_cut_in in (
287+ (spec .spring_post_margin_from_pcb_edge , spec .spring_post_od ),
288+ # (spec.spring_post_od, spec.spring_post_margin_from_pcb_edge),
289+ ):
287290 p += bd .Pos (
288- x_corner
289- * (
290- spec .pcb_length_x / 2
291- - spec .spring_post_margin_from_pcb_edge * x_small_multiplier
292- ),
293- y_corner
294- * (
295- spec .pcb_length_y / 2
296- - spec .spring_post_margin_from_pcb_edge * y_small_multiplier
297- ),
291+ x_corner * (spec .pcb_length_x / 2 - x_cut_in ),
292+ y_corner * (spec .pcb_length_y / 2 - y_cut_in ),
298293 spring_post_y_max ,
299294 ) * bd .Cylinder (
300295 radius = spec .spring_post_od / 2 ,
@@ -346,7 +341,7 @@ def make_enclosure_bottom(spec: Spec) -> bd.Part | bd.Compound:
346341 # Add the stand offs from the bottom wall.
347342 # Used to be at the `spec.get_pcb_raiser_screw_coordinates()` locations, but place
348343 # at the corners now.
349- for x_sign , y_sign in product ((1 , - 1 ), (1 , - 1 )):
344+ for x_sign , y_sign in product ((1 , - 1 , 0 ), (1 , - 1 )):
350345 p += bd .Pos (
351346 x_sign * spec .pcb_length_x / 2 ,
352347 y_sign * spec .pcb_length_y / 2 ,
@@ -401,12 +396,39 @@ def preview_both_enclosure_parts(spec: Spec) -> bd.Part | bd.Compound:
401396 """Preview both the top and bottom enclosure parts."""
402397 p = bd .Part (None )
403398
404- enclosure_top = make_enclosure_top (spec ).translate ((0 , 0 , 3 ))
405- enclosure_bottom = make_enclosure_bottom (spec ).translate ((0 , 0 , - 13 ))
399+ enclosure_top = make_enclosure_top (spec ).translate ((0 , 0 , 0 ))
400+ enclosure_bottom = make_enclosure_bottom (spec ).translate ((0 , 0 , 0 ))
401+
402+ pcb_in_lower_pos = bd .Pos (
403+ Z = (
404+ spec .enclosure_bottom_wall_standoff_height
405+ + spec .enclosure_wall_thickness_bottom
406+ )
407+ ) * bd .Box (
408+ spec .pcb_length_x - 0.2 ,
409+ spec .pcb_length_y - 0.2 ,
410+ spec .pcb_thickness ,
411+ align = bde .align .ANCHOR_BOTTOM ,
412+ )
413+
414+ pcb_in_raised_pos = bd .Pos (
415+ Z = (
416+ spec .enclosure_bottom_wall_standoff_height
417+ + spec .enclosure_wall_thickness_bottom
418+ + spec .pcb_travel_z
419+ )
420+ ) * bd .Box (
421+ spec .pcb_length_x - 0.2 ,
422+ spec .pcb_length_y - 0.2 ,
423+ spec .pcb_thickness ,
424+ align = bde .align .ANCHOR_BOTTOM ,
425+ )
406426
407427 # Debugging: Add a breakpoint on the next line.
408428 p += enclosure_top
409429 p += enclosure_bottom
430+ p += pcb_in_lower_pos
431+ p += pcb_in_raised_pos
410432
411433 return p
412434
0 commit comments