From fab386064bb6ed86e60bdc601e250dcd14d5a87b Mon Sep 17 00:00:00 2001 From: wes Date: Thu, 12 Dec 2024 16:23:28 -0500 Subject: [PATCH] adding lip plus gland holes --- fan_control_box.py | 75 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 18 deletions(-) diff --git a/fan_control_box.py b/fan_control_box.py index 94d4cad..7f544bc 100644 --- a/fan_control_box.py +++ b/fan_control_box.py @@ -24,8 +24,10 @@ top_screw = ButtonHeadScrew( simple=screw_simple, ) -gland_diameter = 15 +gland_diameter = 15.5 +gland_radius = gland_diameter / 2.0 barrel_diameter = 11 +barrel_radius = barrel_diameter / 2.0 # digikey perfboard # It's the distance to the *middle* of the hole @@ -56,10 +58,6 @@ pwm_height = 34 wall_thickness = 3 -# for a box, not octogon -# box_height = 115 + wall_thickness -# box_width = 157 + wall_thickness - box_radius = 87 + wall_thickness box_thickness = 42 @@ -204,18 +202,31 @@ def make_component_holder_self_tapping( ) -""" -lower_box = ( - lower_box.box(box_height, box_width, box_thickness) - .workplane(offset=wall_thickness) - .box( - box_height - wall_thickness, - box_width - wall_thickness, - box_thickness, - combine="cut", - ) -) -""" +def add_gland_holes(result, side_index, gland_holes): + num_sides = 8 + # Calculate the angle of the side's normal + angle_step = 360 / (num_sides * 2) + angle = angle_step * side_index + angle_step + + holes = Workplane("YZ").workplane(offset=82) + + for i, (x_offset, y_offset, cylinder_height, cylinder_radius) in enumerate( + gland_holes + ): + if i < len(gland_holes) - 1: + holes = ( + holes.move(x_offset, y_offset) + .cylinder(cylinder_height, cylinder_radius) + .workplane(offset=0) + ) + else: + holes = holes.move(x_offset, y_offset).cylinder( + cylinder_height, cylinder_radius + ) + + holes = holes.rotate((0, 0, 0), (0, 0, 1), angle) + return result.cut(holes) + lower_box = ( lower_box.makePolygon( @@ -237,6 +248,16 @@ lower_box = ( ) ) .extrude(box_thickness * 2, combine="cut") + .workplane(offset=(box_thickness / 2.0) + 8) + .makePolygon( + regularPolygon( + nSides=8, + radius=box_radius - wall_thickness + 2, + thetaStart=0, + thetaEnd=360, + ) + ) + .extrude(box_thickness * 2, combine="cut") ) lower_box = make_component_holder_octogon( @@ -300,7 +321,25 @@ lower_box = make_component_holder_self_tapping( y_offset=15, ) -# lower_box = lower_box.workplane(offset=(wall_thickness / 2.0)).box(lbc_height, 5, 13) +# cable gland holes +lower_box = add_gland_holes( + lower_box, + 10, + [ + (-15, gland_radius * 3.0, 5, gland_radius), + (15, gland_radius * 3.0, 5, gland_radius), + ], +) + +lower_box = add_gland_holes( + lower_box, + 8, + [ + (-15, barrel_radius * 4.0, 5, barrel_radius), + (15, gland_radius * 3.0, 5, gland_radius), + ], +) + cq.exporters.export(lower_box, "/home/deck/model_files/fan_control_box_lower.stl")