From d2874a0531e79dc9c12d8ef82a5a5d9bc86c58bf Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Wed, 26 Feb 2020 13:46:11 +0000 Subject: [PATCH] Moved washers.scad from screws.scad to nuts.scad. Moved screw_insert() from inserts.scad to screw.scad. Changed most includes of inserts.scad to use insert.scad. Removed linear_bearings, iecs, rockers and microswitches from lib.scad as already included by other vitamins. --- lib.scad | 6 +----- printed/box.scad | 3 +-- printed/corner_block.scad | 2 +- printed/fixing_block.scad | 2 +- printed/foot.scad | 2 +- printed/handle.scad | 2 +- printed/psu_shroud.scad | 2 +- printed/ribbon_clamp.scad | 2 +- printed/socket_box.scad | 2 +- printed/ssr_shroud.scad | 2 +- printed/strap_handle.scad | 2 +- tests/belts.scad | 2 +- tests/bom.scad | 2 +- tests/box.scad | 2 +- tests/butt_box.scad | 2 +- vitamins/iec.scad | 2 +- vitamins/inserts.scad | 4 ---- vitamins/kp_pillow_block.scad | 3 +-- vitamins/kp_pillow_blocks.scad | 3 +-- vitamins/mains_socket.scad | 2 +- vitamins/nuts.scad | 2 +- vitamins/screw.scad | 6 ++++++ vitamins/screws.scad | 3 +-- vitamins/scs_bearing_block.scad | 10 +++++----- vitamins/scs_bearing_blocks.scad | 5 ++--- vitamins/sk_bracket.scad | 3 +-- vitamins/sk_brackets.scad | 6 ++---- vitamins/veroboard.scad | 2 +- 28 files changed, 38 insertions(+), 48 deletions(-) diff --git a/lib.scad b/lib.scad index 0cdbd64..a4390c0 100644 --- a/lib.scad +++ b/lib.scad @@ -34,14 +34,12 @@ include include include include -include +include include include include include include -include -include include include include @@ -55,7 +53,6 @@ include include include include -include include include include @@ -64,7 +61,6 @@ include include include include -include use use diff --git a/printed/box.scad b/printed/box.scad index 66e612b..46f28a5 100644 --- a/printed/box.scad +++ b/printed/box.scad @@ -35,8 +35,7 @@ include <../core.scad> use <../vitamins/sheet.scad> use <../vitamins/screw.scad> use <../vitamins/washer.scad> - -include <../vitamins/inserts.scad> +use <../vitamins/insert.scad> use <../utils/quadrant.scad> bezel_clearance = 0.2; diff --git a/printed/corner_block.scad b/printed/corner_block.scad index b9d20c1..8d04216 100644 --- a/printed/corner_block.scad +++ b/printed/corner_block.scad @@ -32,7 +32,7 @@ // include <../core.scad> include <../vitamins/screws.scad> -include <../vitamins/inserts.scad> +use <../vitamins/insert.scad> use <../utils/rounded_cylinder.scad> use <../utils/maths.scad> diff --git a/printed/fixing_block.scad b/printed/fixing_block.scad index 1524280..64e9619 100644 --- a/printed/fixing_block.scad +++ b/printed/fixing_block.scad @@ -32,7 +32,7 @@ // include <../core.scad> include <../vitamins/screws.scad> -include <../vitamins/inserts.scad> +use <../vitamins/insert.scad> use <../utils/maths.scad> def_screw = M3_cap_screw; diff --git a/printed/foot.scad b/printed/foot.scad index 94bc0a6..855f617 100644 --- a/printed/foot.scad +++ b/printed/foot.scad @@ -23,7 +23,7 @@ // include <../core.scad> include <../vitamins/screws.scad> -include <../vitamins/inserts.scad> +use <../vitamins/insert.scad> foot = [25, 12, 3, 2, M4_cap_screw, 10]; insert_foot = [20, 10, 0, 2, M3_cap_screw, 10]; diff --git a/printed/handle.scad b/printed/handle.scad index ae98856..048f68d 100644 --- a/printed/handle.scad +++ b/printed/handle.scad @@ -22,7 +22,7 @@ // include <../core.scad> include <../vitamins/screws.scad> -include <../vitamins/inserts.scad> +use <../vitamins/insert.scad> dia = 18; length = 90; // inside length diff --git a/printed/psu_shroud.scad b/printed/psu_shroud.scad index 0a16478..05de99f 100644 --- a/printed/psu_shroud.scad +++ b/printed/psu_shroud.scad @@ -23,7 +23,7 @@ // include <../core.scad> include <../vitamins/screws.scad> -include <../vitamins/inserts.scad> +use <../vitamins/insert.scad> use <../vitamins/wire.scad> use <../vitamins/psu.scad> diff --git a/printed/ribbon_clamp.scad b/printed/ribbon_clamp.scad index bae1e15..344281f 100644 --- a/printed/ribbon_clamp.scad +++ b/printed/ribbon_clamp.scad @@ -22,7 +22,7 @@ // include <../core.scad> include <../vitamins/screws.scad> -include <../vitamins/inserts.scad> +use <../vitamins/insert.scad> use <../vitamins/cable_strip.scad> wall = 2; diff --git a/printed/socket_box.scad b/printed/socket_box.scad index 6b81d49..3832f6f 100644 --- a/printed/socket_box.scad +++ b/printed/socket_box.scad @@ -23,7 +23,7 @@ include <../core.scad> include <../vitamins/mains_sockets.scad> include <../vitamins/screws.scad> -include <../vitamins/inserts.scad> +use <../vitamins/insert.scad> include <../vitamins/ring_terminals.scad> box_height = 19; diff --git a/printed/ssr_shroud.scad b/printed/ssr_shroud.scad index 8818df4..1df31b8 100644 --- a/printed/ssr_shroud.scad +++ b/printed/ssr_shroud.scad @@ -23,7 +23,7 @@ // include <../core.scad> include <../vitamins/screws.scad> -include <../vitamins/inserts.scad> +use <../vitamins/insert.scad> use <../vitamins/wire.scad> use <../vitamins/ssr.scad> diff --git a/printed/strap_handle.scad b/printed/strap_handle.scad index 1c0dc3c..47e675f 100644 --- a/printed/strap_handle.scad +++ b/printed/strap_handle.scad @@ -23,7 +23,7 @@ // include <../core.scad> include <../vitamins/screws.scad> -include <../vitamins/inserts.scad> +use <../vitamins/insert.scad> strap = [18, 2, M3_pan_screw, 3, 25]; function strap() = strap; diff --git a/tests/belts.scad b/tests/belts.scad index 3477a39..a8556a5 100644 --- a/tests/belts.scad +++ b/tests/belts.scad @@ -20,8 +20,8 @@ include <../core.scad> include <../vitamins/belts.scad> include <../vitamins/screws.scad> -include <../vitamins/inserts.scad> include <../vitamins/pulleys.scad> +use <../vitamins/insert.scad> use <../utils/layout.scad> module belt_test() { diff --git a/tests/bom.scad b/tests/bom.scad index f6da423..2deab95 100644 --- a/tests/bom.scad +++ b/tests/bom.scad @@ -22,8 +22,8 @@ // include <../core.scad> include <../vitamins/screws.scad> -include <../vitamins/inserts.scad> include <../vitamins/sheets.scad> +use <../vitamins/insert.scad> $explode = 1; // Normally set on the command line when generating assembly views with views.py screw = M3_cap_screw; diff --git a/tests/box.scad b/tests/box.scad index a9698ee..3ffeb5c 100644 --- a/tests/box.scad +++ b/tests/box.scad @@ -20,7 +20,7 @@ include <../core.scad> include <../vitamins/screws.scad> include <../vitamins/sheets.scad> -include <../vitamins/inserts.scad> +use <../vitamins/insert.scad> use <../printed/box.scad> diff --git a/tests/butt_box.scad b/tests/butt_box.scad index 1811efc..9fdcc24 100644 --- a/tests/butt_box.scad +++ b/tests/butt_box.scad @@ -20,7 +20,7 @@ include <../core.scad> include <../vitamins/screws.scad> include <../vitamins/sheets.scad> -include <../vitamins/inserts.scad> +use <../vitamins/insert.scad> include <../printed/butt_box.scad> diff --git a/vitamins/iec.scad b/vitamins/iec.scad index b61322a..6c2dae8 100644 --- a/vitamins/iec.scad +++ b/vitamins/iec.scad @@ -25,7 +25,7 @@ use use use use -include +use function iec_part(type) = type[1]; //! Description function iec_screw(type) = type[2]; //! Screw type diff --git a/vitamins/inserts.scad b/vitamins/inserts.scad index 4d3362c..8a2e053 100644 --- a/vitamins/inserts.scad +++ b/vitamins/inserts.scad @@ -36,8 +36,4 @@ F1BM4 = [ "F1BM4", 8.2, 6.3, 5.6, 4, 5.15, 2.3, 6.0, 5.55 ]; inserts = [ F1BM2, F1BM2p5, F1BM3, F1BM4 ]; -function screw_insert(screw, i = 0) = let(d = screw_radius(screw) * 2) - i >= len(inserts) ? undef - : insert_screw_diameter(inserts[i]) == d ? inserts[i] - : screw_insert(screw, i + 1); use diff --git a/vitamins/kp_pillow_block.scad b/vitamins/kp_pillow_block.scad index ec94084..8e41003 100644 --- a/vitamins/kp_pillow_block.scad +++ b/vitamins/kp_pillow_block.scad @@ -1,5 +1,5 @@ // -// NopSCADlib Copyright Chris Palmer 2018 +// NopSCADlib Copyright Chris Palmer 2020 // nop.head@gmail.com // hydraraptor.blogspot.com // @@ -114,4 +114,3 @@ module kp_pillow_block_assembly(type, part_thickness = 2, screw_type = M5_cap_sc sliding_t_nut(nut_type); } } - diff --git a/vitamins/kp_pillow_blocks.scad b/vitamins/kp_pillow_blocks.scad index db7773b..14c9d92 100644 --- a/vitamins/kp_pillow_blocks.scad +++ b/vitamins/kp_pillow_blocks.scad @@ -1,5 +1,5 @@ // -// NopSCADlib Copyright Chris Palmer 2018 +// NopSCADlib Copyright Chris Palmer 2020 // nop.head@gmail.com // hydraraptor.blogspot.com // @@ -21,7 +21,6 @@ //! KP pillow block bearings // -include <../core.scad> include include diff --git a/vitamins/mains_socket.scad b/vitamins/mains_socket.scad index e7dc2ac..065cb27 100644 --- a/vitamins/mains_socket.scad +++ b/vitamins/mains_socket.scad @@ -23,7 +23,7 @@ include <../core.scad> include include -include +use function mains_socket_width(type) = type[1]; //! Width at the base function mains_socket_depth(type) = type[2]; //! Depth at the base diff --git a/vitamins/nuts.scad b/vitamins/nuts.scad index 34ba11f..fa733cf 100644 --- a/vitamins/nuts.scad +++ b/vitamins/nuts.scad @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along with NopSCADlib. // If not, see . // - +include // // Nuts // diff --git a/vitamins/screw.scad b/vitamins/screw.scad index c33027c..9710baa 100644 --- a/vitamins/screw.scad +++ b/vitamins/screw.scad @@ -25,6 +25,7 @@ include <../core.scad> use use <../utils/rounded_cylinder.scad> use <../utils/thread.scad> +include function screw_head_type(type) = type[2]; //! Head style hs_cap, hs_pan, hs_cs, hs_hex, hs_grub, hs_cs_cap, hs_dome function screw_radius(type) = type[3] / 2; //! Nominal radius @@ -58,6 +59,11 @@ function screw_shorter_than(x) = x >= 20 ? floor(x / 5) * 5 : //! Returns longes function screw_smaller_than(d) = d >= 2.5 && d < 3 ? 2.5 : floor(d); // Largest diameter screw less than or equal to specified diameter +function screw_insert(screw, i = 0) = let(d = screw_radius(screw) * 2) + i >= len(inserts) ? undef + : insert_screw_diameter(inserts[i]) == d ? inserts[i] + : screw_insert(screw, i + 1); + module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified screw, optionally hobbed or nylon description = str("Screw ", nylon ? "Nylon " : "", type[1], length < 10 ? " x " : " x ", length, "mm", hob_point ? str(", hobbed at ", hob_point) : ""); vitamin(str("screw(", type[0], "_screw, ", length, arg(hob_point, 0, "hob_point"), arg(nylon, false, "nylon"), "): ", description)); diff --git a/vitamins/screws.scad b/vitamins/screws.scad index 037193f..0ced009 100644 --- a/vitamins/screws.scad +++ b/vitamins/screws.scad @@ -20,7 +20,6 @@ // // Screws // -include include No2_pilot_radius = 1.7 / 2; // self tapper into ABS @@ -119,7 +118,7 @@ screw_lists = [ use -screws = [for(list = screw_lists) for(screw = list) screw]; +screws = [for(list = screw_lists) each list]; function find_screw(type, size, i = 0) = i >= len(screws) ? undef diff --git a/vitamins/scs_bearing_block.scad b/vitamins/scs_bearing_block.scad index e9e4d51..6a8d4b2 100644 --- a/vitamins/scs_bearing_block.scad +++ b/vitamins/scs_bearing_block.scad @@ -22,11 +22,11 @@ // -include -use -use -use -use +include <../core.scad> +use +use +use +use function scs_size(type) = [type[4],type[6],type[5]]; //! Size of scs bracket bounding block function scs_hole_offset(type) = type[2]; //! Offset of bearing hole from base of block diff --git a/vitamins/scs_bearing_blocks.scad b/vitamins/scs_bearing_blocks.scad index 72d22ad..110e7bb 100644 --- a/vitamins/scs_bearing_blocks.scad +++ b/vitamins/scs_bearing_blocks.scad @@ -21,9 +21,8 @@ // SCS bearing blocks // -include -include -include +include +include // T h E W L F G B C K S1 S2 L1 LB SCS6UU = ["SCS6UU", 6, 9, 15, 30, 25, 18, 15, 20, 15, 5, M4_cap_screw, 3.4, 8, LM6UU]; diff --git a/vitamins/sk_bracket.scad b/vitamins/sk_bracket.scad index 803e80e..cc084b5 100644 --- a/vitamins/sk_bracket.scad +++ b/vitamins/sk_bracket.scad @@ -1,5 +1,5 @@ // -// NopSCADlib Copyright Chris Palmer 2018 +// NopSCADlib Copyright Chris Palmer 2020 // nop.head@gmail.com // hydraraptor.blogspot.com // @@ -122,4 +122,3 @@ module sk_bracket_assembly(type, part_thickness = 2, screw_type = M5_cap_screw, sliding_t_nut(nut_type); } } - diff --git a/vitamins/sk_brackets.scad b/vitamins/sk_brackets.scad index e8ece9e..9bdd9f3 100644 --- a/vitamins/sk_brackets.scad +++ b/vitamins/sk_brackets.scad @@ -1,5 +1,5 @@ // -// NopSCADlib Copyright Chris Palmer 2018 +// NopSCADlib Copyright Chris Palmer 2020 // nop.head@gmail.com // hydraraptor.blogspot.com // @@ -21,8 +21,7 @@ // SK shaft support brackets // -include <../core.scad> -include <../vitamins/screws.scad> +include // d h E W L F G P B S bolthole SK8 = ["SK8", 8, 20, 21, 42, 14, 32.8, 6, 18, 32, 5.5, M5_clearance_radius]; @@ -32,4 +31,3 @@ SK16 = ["SK16", 16, 27, 24, 48, 16, 44.0, 8, 25, 38, 5.5, M5_clearance_radius]; sk_brackets = [SK8, SK10, SK12, SK16]; use - diff --git a/vitamins/veroboard.scad b/vitamins/veroboard.scad index 9b62ca9..eeef3a3 100644 --- a/vitamins/veroboard.scad +++ b/vitamins/veroboard.scad @@ -22,7 +22,7 @@ // include <../core.scad> use -include <../vitamins/screws.scad> +include function vero_assembly(type) = type[1]; //! Name of the assembly function vero_holes(type) = type[2]; //! Number of holes in each strip