From 7b2b239a8b886f9f016b8e722471efc879572c10 Mon Sep 17 00:00:00 2001
From: Chris Palmer <nop.head@gmail.com>
Date: Fri, 19 Jul 2019 10:51:59 +0100
Subject: [PATCH] Can now override the screw type for a fan assembly.

---
 readme.md         | 2 +-
 vitamins/fan.scad | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/readme.md b/readme.md
index 7bfb758..c09a385 100644
--- a/readme.md
+++ b/readme.md
@@ -620,7 +620,7 @@ Can draw three styles: solid, open frame and open frame with screw bosses.
 | Module | Description |
 |:--- |:--- |
 | ```fan(type)``` | Draw specified fan, origin in the centre |
-| ```fan_assembly(type, thickness, include_fan = true)``` | Fan with its fasteners |
+| ```fan_assembly(type, thickness, include_fan = true, screw = 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. |
 
diff --git a/vitamins/fan.scad b/vitamins/fan.scad
index abb940f..70bf01d 100644
--- a/vitamins/fan.scad
+++ b/vitamins/fan.scad
@@ -151,16 +151,16 @@ function nut_and_washer_thickness(screw, nyloc) = washer_thickness(screw_washer(
 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
 
-module fan_assembly(type, thickness, include_fan = true) { //! Fan with its fasteners
+module fan_assembly(type, thickness, include_fan = true, screw = false) { //! Fan with its fasteners
     translate_z(-fan_depth(type) / 2) {
         if(include_fan)
             fan(type);
 
-        screw = fan_screw(type);
-        nut = screw_nut(screw);
+        Screw = screw ? screw : fan_screw(type);
+        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));
 
             translate_z(include_fan ? -fan_screw_depth(type) : 0)
                 vflip()