From 2b7b0b531baea198da7fff2018ef136c857bef08 Mon Sep 17 00:00:00 2001
From: Adrian Mariano <avm4@cornell.edu>
Date: Sat, 20 Feb 2021 16:03:49 -0500
Subject: [PATCH 1/2] bug fix for UTS heads

---
 screws.scad | 86 +++++++++++++++++++++++++++--------------------------
 1 file changed, 44 insertions(+), 42 deletions(-)

diff --git a/screws.scad b/screws.scad
index 9f66a85..bd503a4 100644
--- a/screws.scad
+++ b/screws.scad
@@ -307,7 +307,9 @@ function _screw_info_english(diam, threadcount, head, thread, drive) =
                [2,    [      3,   1.5, undef, undef, undef]],
             ],
             entry = struct_val(UTS_socket, diam),
-            hexdepth = is_def(entry[3]) ? entry[3] : if_def(diam) ? diam/2 : undef,
+            hexdepth = is_def(entry[3]) ? entry[3]
+                     : is_def(diam) ? diam/2
+                     : undef,
             drive_size =  drive=="hex" ? [["drive_size",inch*entry[1]], ["drive_depth",inch*hexdepth]] :
                           drive=="torx" ? [["drive_size",entry[2]],["drive_depth",inch*entry[4]]] : []
             )
@@ -854,47 +856,47 @@ module screw_head(screw_info,details=false) {
 //     screw("M5", head="hex", length=12);
 //   }
 // Example: Demonstration of all head types for UTS screws (using pitch zero for fast preview)
-//   xdistribute(spacing=15){
-//     ydistribute(spacing=15){
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="none", drive="hex");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="none", drive="torx");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="none");
-//     }
-//     screw("1/4", thread=0, length=8, anchor=TOP, head="hex");
-//     ydistribute(spacing=15){
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="socket", drive="hex");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="socket", drive="torx");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="socket");
-//     }
-//     ydistribute(spacing=15){
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="button", drive="hex");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="button", drive="torx");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="button");
-//     }
-//     ydistribute(spacing=15){
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="round", drive="slot");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="round", drive="phillips");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="round");
-//     }
-//     ydistribute(spacing=15){
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="fillister", drive="slot");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="fillister", drive="phillips");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="fillister");
-//     }
-//     ydistribute(spacing=15){
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="slot");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="phillips");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="hex");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="torx");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat large");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat small");
-//     }
-//     ydistribute(spacing=15){
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat undercut", drive="slot");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat undercut", drive="phillips");
-//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat undercut");
-//     }
-//   }
+   xdistribute(spacing=15){
+     ydistribute(spacing=15){
+        screw("1/4", thread=0,length=8, anchor=TOP, head="none", drive="hex");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="none", drive="torx");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="none");
+     }
+     screw("1/4", thread=0, length=8, anchor=TOP, head="hex");
+     ydistribute(spacing=15){
+        screw("1/4", thread=0,length=8, anchor=TOP, head="socket", drive="hex");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="socket", drive="torx");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="socket");
+     }
+     ydistribute(spacing=15){
+        screw("1/4", thread=0,length=8, anchor=TOP, head="button", drive="hex");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="button", drive="torx");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="button");
+     }
+     ydistribute(spacing=15){
+        screw("1/4", thread=0,length=8, anchor=TOP, head="round", drive="slot");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="round", drive="phillips");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="round");
+     }
+     ydistribute(spacing=15){
+        screw("1/4", thread=0,length=8, anchor=TOP, head="fillister", drive="slot");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="fillister", drive="phillips");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="fillister");
+     }
+     ydistribute(spacing=15){
+        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="slot");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="phillips");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="hex");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="torx");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="flat large");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="flat small");
+     }
+     ydistribute(spacing=15){
+        screw("1/4", thread=0,length=8, anchor=TOP, head="flat undercut", drive="slot");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="flat undercut", drive="phillips");
+        screw("1/4", thread=0,length=8, anchor=TOP, head="flat undercut");
+     }
+   }
 // Example: Demonstration of all head types for metric screws without threading.
 //   xdistribute(spacing=15){
 //     ydistribute(spacing=15){

From 016478e664ec103c795be35d07c1f8ba63f2f0c5 Mon Sep 17 00:00:00 2001
From: Adrian Mariano <avm4@cornell.edu>
Date: Sat, 20 Feb 2021 17:06:02 -0500
Subject: [PATCH 2/2] recommend example

---
 screws.scad | 82 ++++++++++++++++++++++++++---------------------------
 1 file changed, 41 insertions(+), 41 deletions(-)

diff --git a/screws.scad b/screws.scad
index bd503a4..68537c1 100644
--- a/screws.scad
+++ b/screws.scad
@@ -856,47 +856,47 @@ module screw_head(screw_info,details=false) {
 //     screw("M5", head="hex", length=12);
 //   }
 // Example: Demonstration of all head types for UTS screws (using pitch zero for fast preview)
-   xdistribute(spacing=15){
-     ydistribute(spacing=15){
-        screw("1/4", thread=0,length=8, anchor=TOP, head="none", drive="hex");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="none", drive="torx");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="none");
-     }
-     screw("1/4", thread=0, length=8, anchor=TOP, head="hex");
-     ydistribute(spacing=15){
-        screw("1/4", thread=0,length=8, anchor=TOP, head="socket", drive="hex");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="socket", drive="torx");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="socket");
-     }
-     ydistribute(spacing=15){
-        screw("1/4", thread=0,length=8, anchor=TOP, head="button", drive="hex");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="button", drive="torx");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="button");
-     }
-     ydistribute(spacing=15){
-        screw("1/4", thread=0,length=8, anchor=TOP, head="round", drive="slot");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="round", drive="phillips");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="round");
-     }
-     ydistribute(spacing=15){
-        screw("1/4", thread=0,length=8, anchor=TOP, head="fillister", drive="slot");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="fillister", drive="phillips");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="fillister");
-     }
-     ydistribute(spacing=15){
-        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="slot");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="phillips");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="hex");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="torx");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="flat large");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="flat small");
-     }
-     ydistribute(spacing=15){
-        screw("1/4", thread=0,length=8, anchor=TOP, head="flat undercut", drive="slot");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="flat undercut", drive="phillips");
-        screw("1/4", thread=0,length=8, anchor=TOP, head="flat undercut");
-     }
-   }
+//   xdistribute(spacing=15){
+//     ydistribute(spacing=15){
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="none", drive="hex");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="none", drive="torx");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="none");
+//     }
+//     screw("1/4", thread=0, length=8, anchor=TOP, head="hex");
+//     ydistribute(spacing=15){
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="socket", drive="hex");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="socket", drive="torx");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="socket");
+//     }
+//     ydistribute(spacing=15){
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="button", drive="hex");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="button", drive="torx");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="button");
+//     }
+//     ydistribute(spacing=15){
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="round", drive="slot");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="round", drive="phillips");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="round");
+//     }
+//     ydistribute(spacing=15){
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="fillister", drive="slot");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="fillister", drive="phillips");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="fillister");
+//     }
+//     ydistribute(spacing=15){
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="slot");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="phillips");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="hex");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat", drive="torx");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat large");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat small");
+//     }
+//     ydistribute(spacing=15){
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat undercut", drive="slot");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat undercut", drive="phillips");
+//        screw("1/4", thread=0,length=8, anchor=TOP, head="flat undercut");
+//     }
+//   }
 // Example: Demonstration of all head types for metric screws without threading.
 //   xdistribute(spacing=15){
 //     ydistribute(spacing=15){