From d19f5d70c29b9ef988ffc648aceb789d14ff1e0a Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 25 Mar 2022 17:56:00 +0000 Subject: threaded holes! --- enclosure/enclosure.scad | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/enclosure/enclosure.scad b/enclosure/enclosure.scad index c3424f7..52fef36 100644 --- a/enclosure/enclosure.scad +++ b/enclosure/enclosure.scad @@ -10,11 +10,15 @@ * bottom, for battery and pm sensor */ +use + WALL_THICKNESS=1; SCREW_DIAM=4; SCREW_PAD=0; +BOLT_STEM_Z=24.7; + PM_X=40.8; PM_Y=40.8; PM_Z=12.5; @@ -104,31 +108,58 @@ module screw_hole() { cylinder(h=200,d=SCREW_DIAM,center=true,$fs=0.1); } -module screw_holes() { +module myScrew(outer_diam, height, position=[0,0,0], rotation=[0,0,0], pitch=0, tooth_angle=30, tolerance=0.4, tooth_height=0) { + extra_height = 0.001 * height; + + translate(position) + rotate(rotation) + translate([0, 0, -extra_height/2]) + ScrewThread(1.01*outer_diam + 1.25*tolerance, height + extra_height, + pitch, tooth_angle, tolerance, tooth_height=tooth_height); +} + +module screw_hole_threaded() { + H=BOLT_STEM_Z-TOP_Z-MIDDLE_Z; + myScrew( + outer_diam=SCREW_DIAM, + height=H, + position=[0,0,BOTTOM_Z-H] + ); +} + +module place_screw_holes() { OFF=WALL_THICKNESS + SCREW_DIAM/2 + SCREW_PAD; translate([ TOTAL_X/2 - OFF, TOTAL_Y/2 - OFF, - 0]) screw_hole(); + 0]) children(); translate([ -(TOTAL_X/2 - OFF), TOTAL_Y/2 - OFF, - 0]) screw_hole(); + 0]) children(); translate([ TOTAL_X/2 - OFF, -(TOTAL_Y/2 - OFF), - 0]) screw_hole(); + 0]) children(); translate([ -(TOTAL_X/2 - OFF), -(TOTAL_Y/2 - OFF), - 0]) screw_hole(); + 0]) children(); } +module screw_holes() { + place_screw_holes() screw_hole(); +} + +module screw_holes_threaded() { + place_screw_holes() screw_hole_threaded(); +} + module pm_sensor() { box([PM_X,PM_Y,PM_Z]); } @@ -284,7 +315,7 @@ module bottom() { difference() { box([TOTAL_X, TOTAL_Y, BOTTOM_Z]); - screw_holes(); + screw_holes_threaded(); translate([PM_X_OFF, 0, WALL_THICKNESS]) pm_sensor(); translate([CABLE_X_OFF, CABLE_Y_OFF, CABLE_Z_OFF]) bottom_cable_well(); translate([BATT_X_OFF, 0, BATT_Z_OFF]) battery(); -- cgit v1.2.3