diff --git a/readme.md b/readme.md index 4792f19..260a7a4 100644 --- a/readme.md +++ b/readme.md @@ -616,16 +616,11 @@ Can draw three styles: solid, open frame and open frame with screw bosses. | ```fan_thickness(type)``` | Thickness of the frame | | ```fan_width(type)``` | Width of square | -### Functions -| Function | Description | -|:--- |:--- | -| ```fan_screw_length(type, thickness)``` | Screw length required | - ### Modules | Module | Description | |:--- |:--- | | ```fan(type)``` | Draw specified fan, origin in the centre | -| ```fan_assembly(type, thickness, include_fan = true, screw = false)``` | Fan with its fasteners | +| ```fan_assembly(type, thickness, include_fan = true, screw = false, full_depth = false)``` | Fan with its fasteners | | ```fan_hole_positions(type, z = undef)``` | Position children at the screw hole positions | | ```fan_holes(type, poly = false, screws = true, h = 100)``` | Make all the holes for the fan, or just the aperture if ```screws``` is false. Set ```poly``` true for poly_holes. | @@ -652,9 +647,9 @@ Can draw three styles: solid, open frame and open frame with screw bosses. | 20 | ```screw(M4_dome_screw, 16)``` | Screw M4 dome x 16mm | | 4 | ```screw(M4_dome_screw, 25)``` | Screw M4 dome x 25mm | | 4 | ```screw(M4_dome_screw, 30)``` | Screw M4 dome x 30mm | -| 4 | ```washer(M2p5_washer)``` | Washer M2.5 x 5.9mm x 0.5mm | -| 8 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm | -| 28 | ```washer(M4_washer)``` | Washer M4 x 9mm x 0.8mm | +| 8 | ```washer(M2p5_washer)``` | Washer M2.5 x 5.9mm x 0.5mm | +| 12 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm | +| 32 | ```washer(M4_washer)``` | Washer M4 x 9mm x 0.8mm | Top @@ -1683,6 +1678,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o ### Functions | Function | Description | |:--- |:--- | +| ```pcb_component_position(type, name)``` | Return x y position of specified component | | ```pcb_coord(type, p)``` | Convert offsets from the edge to coordinates relative to the centre | | ```pcb_screw(type, cap = hs_cap)``` | Mounting screw type | diff --git a/tests/png/fans.png b/tests/png/fans.png index c0572fa..152826c 100644 Binary files a/tests/png/fans.png and b/tests/png/fans.png differ diff --git a/vitamins/fan.scad b/vitamins/fan.scad index 70bf01d..89de9c3 100644 --- a/vitamins/fan.scad +++ b/vitamins/fan.scad @@ -147,11 +147,16 @@ module fan_holes(type, poly = false, screws = true, h = 100) { //! Make all the } } -function nut_and_washer_thickness(screw, nyloc) = washer_thickness(screw_washer(screw)) + nut_thickness(screw_nut(screw), nyloc); -function fan_screw_depth(type) = fan_boss_d(type) ? fan_depth(type) : fan_thickness(type); -function fan_screw_length(type, thickness) = screw_longer_than(thickness + fan_screw_depth(type) + nut_and_washer_thickness(fan_screw(type), true)); //! Screw length required +function fan_screw_depth(type, full_depth = false) = fan_boss_d(type) || full_depth ? fan_depth(type) : fan_thickness(type); -module fan_assembly(type, thickness, include_fan = true, screw = false) { //! Fan with its fasteners +function fan_screw_length(type, thickness, full_depth = false) = + let(depth = fan_screw_depth(type, full_depth), + washers = depth == fan_depth(type) ? 2 : 1, + washer = screw_washer(fan_screw(type)), + nut = screw_nut(fan_screw(type))) + screw_longer_than(thickness + depth + washer_thickness(washer) * washers + nut_thickness(nut, true)); //! Screw length required + +module fan_assembly(type, thickness, include_fan = true, screw = false, full_depth = false) { //! Fan with its fasteners translate_z(-fan_depth(type) / 2) { if(include_fan) fan(type); @@ -160,11 +165,14 @@ module fan_assembly(type, thickness, include_fan = true, screw = false) { //! Fa nut = screw_nut(Screw); fan_hole_positions(type) { translate_z(thickness) - screw_and_washer(Screw, fan_screw_length(type, thickness)); + screw_and_washer(Screw, fan_screw_length(type, thickness, full_depth)); - translate_z(include_fan ? -fan_screw_depth(type) : 0) + translate_z(include_fan ? -fan_screw_depth(type, full_depth) : 0) vflip() - nut(nut, true); + if(fan_screw_depth(type, full_depth) == fan_depth(type)) + nut_and_washer(nut, true); + else + nut(nut, true); } } }