diff --git a/libtest.scad b/libtest.scad index 48cd060..7eb9b72 100644 --- a/libtest.scad +++ b/libtest.scad @@ -38,13 +38,13 @@ use use use use -use +use use use -use +use use -use -use +use +use use use use @@ -53,22 +53,22 @@ use use use use -use +use use -use +use use use use use use use -use +use use use -use +use use use -use +use use use use @@ -90,14 +90,14 @@ use use use use -use +use use use use use use -use -use +use +use x0 = 0; x1 = x0 + 100; diff --git a/readme.md b/readme.md index 7278e60..4af2ab3 100644 --- a/readme.md +++ b/readme.md @@ -18,25 +18,25 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa ## Table of Contents - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -976,8 +976,8 @@ Mini LCD Celsius Digital Thermometer Hygrometer Temperature Humidity Meter Gauge Top --- - -## Iecs + +## IECs IEC mains inlets and outlet. @@ -985,7 +985,7 @@ IEC mains inlets and outlet. [vitamins/iec.scad](vitamins/iec.scad) Implementation. -[tests/iecs.scad](tests/iecs.scad) Code for this example. +[tests/IECs.scad](tests/IECs.scad) Code for this example. ### Properties | Function | Description | @@ -1132,8 +1132,8 @@ E.g. a "brown" socket for mains live needs to be displayed as "sienna" to look r Top --- - -## Kp_pillow_blocks + +## KP_pillow_blocks KP pillow block bearings @@ -1141,7 +1141,7 @@ KP pillow block bearings [vitamins/kp_pillow_block.scad](vitamins/kp_pillow_block.scad) Implementation. -[tests/kp_pillow_blocks.scad](tests/kp_pillow_blocks.scad) Code for this example. +[tests/KP_pillow_blocks.scad](tests/KP_pillow_blocks.scad) Code for this example. ### Properties | Function | Description | @@ -1185,8 +1185,8 @@ KP pillow block bearings Top --- - -## Ldrs + +## LDRs Light dependent resistors. Larger ones seem to have both a higher dark resistance and a lower bright light resistance. @@ -1196,7 +1196,7 @@ Larger ones seem to have both a higher dark resistance and a lower bright light [vitamins/ldr.scad](vitamins/ldr.scad) Implementation. -[tests/ldrs.scad](tests/ldrs.scad) Code for this example. +[tests/LDRs.scad](tests/LDRs.scad) Code for this example. ### Properties | Function | Description | @@ -1276,8 +1276,8 @@ Nuts for leadscrews. Top --- - -## Leds + +## LEDs Standard domed through hole LEDs. Can specify colour and lead length. @@ -1285,7 +1285,7 @@ Standard domed through hole LEDs. Can specify colour and lead length. [vitamins/led.scad](vitamins/led.scad) Implementation. -[tests/leds.scad](tests/leds.scad) Code for this example. +[tests/LEDs.scad](tests/LEDs.scad) Code for this example. ### Properties | Function | Description | @@ -1807,14 +1807,14 @@ A permanent magnet that can be magnatized and de-magnatized electronically. Top --- - -## Pcb + +## PCB PCBs and perfboard with optional components. The shape can be a rectangle with optionally rounded corners or a polygon for odd shapes like Arduino. [vitamins/pcb.scad](vitamins/pcb.scad) Implementation. -[tests/pcb.scad](tests/pcb.scad) Code for this example. +[tests/PCB.scad](tests/PCB.scad) Code for this example. ### Properties | Function | Description | @@ -1889,8 +1889,8 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o Top --- - -## Pcbs + +## PCBs PCBs and perfboard with optional components. The shape can be a rectangle with optionally rounded corners or a polygon for odd shapes like Arduino. @@ -1898,7 +1898,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o [vitamins/pcb.scad](vitamins/pcb.scad) Implementation. -[tests/pcbs.scad](tests/pcbs.scad) Code for this example. +[tests/PCBs.scad](tests/PCBs.scad) Code for this example. ### Properties | Function | Description | @@ -2136,8 +2136,8 @@ Pin headers and sockets, etc. Top --- - -## Psus + +## PSUs Powersupplies. Can be a simple cube or can be defined by a list of six faces, each with thickness, holes, cutouts, etc. Face order is bottom, top, left, right, front, back. @@ -2147,7 +2147,7 @@ Face order is bottom, top, left, right, front, back. [vitamins/psu.scad](vitamins/psu.scad) Implementation. -[tests/psus.scad](tests/psus.scad) Code for this example. +[tests/PSUs.scad](tests/PSUs.scad) Code for this example. ### Properties | Function | Description | @@ -2590,8 +2590,8 @@ Machine screws and wood screws with various head styles. Top --- - -## Scs_bearing_blocks + +## SCS_bearing_blocks SCSnUU and SCSnLUU bearing blocks @@ -2599,7 +2599,7 @@ SCSnUU and SCSnLUU bearing blocks [vitamins/scs_bearing_block.scad](vitamins/scs_bearing_block.scad) Implementation. -[tests/scs_bearing_blocks.scad](tests/scs_bearing_blocks.scad) Code for this example. +[tests/SCS_bearing_blocks.scad](tests/SCS_bearing_blocks.scad) Code for this example. ### Properties | Function | Description | @@ -2740,8 +2740,8 @@ Note that modules that drill holes will return a 2D object if ```h``` is set to Top --- - -## Sk_brackets + +## SK_brackets SK shaft support brackets @@ -2749,7 +2749,7 @@ SK shaft support brackets [vitamins/sk_bracket.scad](vitamins/sk_bracket.scad) Implementation. -[tests/sk_brackets.scad](tests/sk_brackets.scad) Code for this example. +[tests/SK_brackets.scad](tests/SK_brackets.scad) Code for this example. ### Properties | Function | Description | @@ -2923,8 +2923,8 @@ By default springs have their origin at the bottom but can be centered. Top --- - -## Ssrs + +## SSRs Solid state relays. @@ -2932,7 +2932,7 @@ Solid state relays. [vitamins/ssr.scad](vitamins/ssr.scad) Implementation. -[tests/ssrs.scad](tests/ssrs.scad) Code for this example. +[tests/SSRs.scad](tests/SSRs.scad) Code for this example. ### Properties | Function | Description | @@ -4241,15 +4241,15 @@ Printed handle that can be printed without needing support material due to its t Top --- - -## Pcb_mount + +## PCB_mount A frame to mount a PCB by its corners when it has no mounting holes. The stl must be given a parameterless wrapper in the project that uses it. [printed/pcb_mount.scad](printed/pcb_mount.scad) Implementation. -[tests/pcb_mount.scad](tests/pcb_mount.scad) Code for this example. +[tests/PCB_mount.scad](tests/PCB_mount.scad) Code for this example. ### Functions | Function | Description | @@ -4370,15 +4370,15 @@ It can also have printed feet on the base with the screws doubling up to hold th Top --- - -## Psu_shroud + +## PSU_shroud A cover to go over the mains end of a PSU terminal strip to make it safe. The stl and assembly must be given a name and parameterless wrappers for the stl and assembly added to the project. [printed/psu_shroud.scad](printed/psu_shroud.scad) Implementation. -[tests/psu_shroud.scad](tests/psu_shroud.scad) Code for this example. +[tests/PSU_shroud.scad](tests/PSU_shroud.scad) Code for this example. ### Functions | Function | Description | @@ -4572,15 +4572,15 @@ UK 13A socket and printed backbox with earth terminal for the panel it is mounte Top --- - -## Ssr_shroud + +## SSR_shroud A cover to go over the mains end of an SSR to make it safe to be touched. The STL and assembly must be given a name and parameterless wrappers for the stl and assembly added to the project. [printed/ssr_shroud.scad](printed/ssr_shroud.scad) Implementation. -[tests/ssr_shroud.scad](tests/ssr_shroud.scad) Code for this example. +[tests/SSR_shroud.scad](tests/SSR_shroud.scad) Code for this example. ### Functions | Function | Description | @@ -5095,8 +5095,8 @@ Simple tube or ring Top --- - -## Bom + +## BOM Bill Of Materials generation via echo and the ```bom.py``` script. Also handles exploded assembly views and posing. Assembly instructions can precede the module definition that makes the assembly. @@ -5106,7 +5106,7 @@ heirachical BOMs are also generated for real projects. [utils/core/bom.scad](utils/core/bom.scad) Implementation. -[tests/bom.scad](tests/bom.scad) Code for this example. +[tests/BOM.scad](tests/BOM.scad) Code for this example. ### Functions | Function | Description | diff --git a/scripts/tests.py b/scripts/tests.py index ac2a4a8..3d3dea5 100755 --- a/scripts/tests.py +++ b/scripts/tests.py @@ -109,13 +109,14 @@ def tests(tests): # # List of individual part files # - scads = [i for i in sorted(os.listdir(scad_dir)) if i[-5:] == ".scad"] + scads = [i for i in sorted(os.listdir(scad_dir), key = lambda s: s.lower()) if i[-5:] == ".scad"] for scad in scads: base_name = scad[:-5] if not tests or base_name in tests: print(base_name) cap_name = base_name[0].capitalize() + base_name[1:] + base_name = base_name.lower() scad_name = scad_dir + '/' + scad png_name = png_dir + '/' + base_name + '.png' bom_name = bom_dir + '/' + base_name + '.json' @@ -191,10 +192,10 @@ def tests(tests): body += ["![%s](%s)\n" %(base_name, png_name)] - dname = deps_name(deps_dir, scad) + dname = deps_name(deps_dir, scad.lower()) oldest = png_name if mtime(png_name) < mtime(bom_name) else bom_name changed = check_deps(oldest, dname) - changed = times.check_have_time(changed, scad_name) + changed = times.check_have_time(changed, scad_name.lower()) changed = options.have_changed(changed, oldest) if changed: print(changed) diff --git a/scripts/views.py b/scripts/views.py index 4d9804b..c4740fc 100755 --- a/scripts/views.py +++ b/scripts/views.py @@ -89,6 +89,14 @@ def eop(print_mode, doc_file, last = False, first = False): def pad(s, before, after = 0): return ' ' * before + str(s) + ' ' * after +def titalise(name): + cap_next = True + result = '' + for c in name.replace('_', ' '): + result = result + (c.upper() if cap_next else c); + cap_next = c == ' ' + return result + def views(target, do_assemblies = None): done_assemblies = [] # @@ -216,7 +224,7 @@ def views(target, do_assemblies = None): print('1. [Parts list](#Parts_list)', file = doc_file) for ass in flat_bom: name = ass["name"] - cap_name = name.replace('_', ' ').title() + cap_name = titalise(name) print('1. [%s](#%s)' % (cap_name, name), file = doc_file) print(file = doc_file) eop(print_mode, doc_file) @@ -237,7 +245,7 @@ def views(target, do_assemblies = None): else: things[t][thing] = ass[t][thing] for ass in flat_bom: - name = ass["name"][:-9].replace('_', ' ').title().replace(' ',' ') + name = titalise(ass["name"][:-9]).replace(' ',' ') print('| %s ' % name, file = doc_file, end = '') print('| TOTALS | |', file = doc_file) @@ -274,7 +282,7 @@ def views(target, do_assemblies = None): # for ass in flat_bom: name = ass["name"] - cap_name = name.replace('_', ' ').title() + cap_name = titalise(name) if ass["count"] > 1: print('\n## %d x %s' % (name, ass["count"], cap_name), file = doc_file) diff --git a/tests/BOM.scad b/tests/BOM.scad new file mode 100644 index 0000000..19568c3 --- /dev/null +++ b/tests/BOM.scad @@ -0,0 +1,107 @@ +// +// NopSCADlib Copyright Chris Palmer 2018 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// + +// +//! BOM and assembly demonstration +// +include <../core.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; +sheet = PMMA3; +height = 10; + +insert = screw_insert(screw); +washer = screw_washer(screw); + +module widget(thickness) { + vitamin(str("widget(", thickness, "): Rivit like thing for ", thickness, "mm sheets")); + t = 1; + color("silver") { + cylinder(d = 3, h = thickness + 2 * eps, center = true); + + for(end = [-1, 1]) + translate_z(end * (thickness / 2 + t / 2 + eps)) + cylinder(d = 4, h = t, center = true); + } +} + +module widgit_stl() { + stl("widget"); + + union() { + rounded_rectangle([30, 30, 3], 2); + + render() insert_boss(insert, height, 2.2); + } +} + +module widgit_dxf() { + dxf("widget"); + + difference() { + sheet_2D(sheet, 20, 20, 1); + + drill(screw_clearance_radius(screw), 0); + } +} + +//! * Push the insert into the base with a soldering iron heated to 200°C +module widgit_base_assembly() +assembly("widgit_base") { + color(pp1_colour) + widgit_stl(); + + translate_z(height) + insert(insert); +} + +//! * Magically insert the widget into the acrylic sheet +module widget_top_assembly() +assembly("widget_top") { + translate([-5, 5]) + widget(sheet_thickness(sheet)); + + render_2D_sheet(sheet) // Must be last because it is transparent + widgit_dxf(); +} + +//! * Screw the two assemblies together +module widgit_assembly() +assembly("wigdit") { + + widgit_base_assembly(); // Note this is not exloded because it is sub-assembly + + translate_z(height) { + translate_z(sheet_thickness(sheet)) + screw_and_washer(screw, screw_longer_than(sheet_thickness(sheet) + 2 * washer_thickness(washer) + 3), true); + + explode(5) + translate_z(sheet_thickness(sheet) / 2 + eps) + widget_top_assembly(); + } +} + +module boms() { + widgit_assembly(); +} + +boms(); diff --git a/tests/IECs.scad b/tests/IECs.scad new file mode 100644 index 0000000..77245ee --- /dev/null +++ b/tests/IECs.scad @@ -0,0 +1,30 @@ +// +// NopSCADlib Copyright Chris Palmer 2018 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> +include <../vitamins/iecs.scad> + +use <../utils/layout.scad> + +module iecs() + layout([for(i = iecs) iec_flange_h(i)], 10) + rotate(90) + iec_assembly(iecs[$i], 3); + +if($preview) + iecs(); diff --git a/tests/KP_pillow_blocks.scad b/tests/KP_pillow_blocks.scad new file mode 100644 index 0000000..fc4eb7c --- /dev/null +++ b/tests/KP_pillow_blocks.scad @@ -0,0 +1,33 @@ +// +// NopSCADlib Copyright Chris Palmer 2018 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> +include <../vitamins/kp_pillow_blocks.scad> + +use <../utils/layout.scad> + +module kp_pillow_blocks() { + screws = [M4_cap_screw, M4_cap_screw, M5_cap_screw, M5_cap_screw]; + nuts = [M4_sliding_t_nut, M4_hammer_nut, M5_sliding_t_nut, M5_nut]; + assert(len(screws) == len(kp_pillow_blocks) && len(nuts) == len(kp_pillow_blocks)); + layout([for(k = kp_pillow_blocks) 2 * kp_size(k)[1]]) + kp_pillow_block_assembly(kp_pillow_blocks[$i], screw_type = screws[$i], nut_type = nuts[$i]); +} + +if($preview) + kp_pillow_blocks(); diff --git a/tests/LDRs.scad b/tests/LDRs.scad new file mode 100644 index 0000000..a3139ed --- /dev/null +++ b/tests/LDRs.scad @@ -0,0 +1,27 @@ +// +// NopSCADlib Copyright Chris Palmer 2018 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../vitamins/ldrs.scad> + +use <../utils/layout.scad> + +module ldrs() + layout([for(l = ldrs) ldr_diameter(l)], 5) + LDR(ldrs[$i]); + +ldrs(); diff --git a/tests/LEDs.scad b/tests/LEDs.scad new file mode 100644 index 0000000..98e4ca1 --- /dev/null +++ b/tests/LEDs.scad @@ -0,0 +1,29 @@ +// +// NopSCADlib Copyright Chris Palmer 2018 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../utils/core/core.scad> +use <../utils/layout.scad> + +include <../vitamins/leds.scad> + +module leds() + layout([for(l = LEDs) led_diameter(l)], 5) + led(LEDs[$i], ["green", "blue", "red"][$i % 3]); + +if($preview) + leds(); diff --git a/tests/PCB.scad b/tests/PCB.scad new file mode 100644 index 0000000..d0c1014 --- /dev/null +++ b/tests/PCB.scad @@ -0,0 +1,109 @@ +// +// NopSCADlib Copyright Chris Palmer 2020 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> +include <../vitamins/microswitches.scad> +include <../vitamins/d_connectors.scad> + +use <../vitamins/pcb.scad> + +gt_5x17 = ["gt_5x17", 5, 10, 17, 5, 11, 0.4, 9, 2,1.5, 1, 3, 6, 0, 0, 0]; +gt_5x11 = ["gt_5x11", 5, 8, 11, 5, 7, 0.4, 7, 1.5,1.5, 1,2.5, 6, 0, 0, 0]; + +TMC2130HeatSinkColor = "DeepSkyBlue"; +TMC2130 = ["TMC2130", "TMC2130", + 20, 14, 1.6, 0, 3, 0, "white", false, [], + [ + [ 10, 1, 0, "-2p54header", 8, 1 ,undef, "blue" ], + [ 10, 13, 0, "-2p54header", 8, 1], + [ 12, 7, 0, "-chip", 6, 4, 1, grey20 ], + // mock up a heat sink + [ 10, 7, 0, "block", 9, 9, 2, TMC2130HeatSinkColor ], + [ 10, 11, 0, "block", 9, 1, 11, TMC2130HeatSinkColor ], + [ 10, 9, 0, "block", 9, 1, 11, TMC2130HeatSinkColor ], + [ 10, 7, 0, "block", 9, 1, 11, TMC2130HeatSinkColor ], + [ 10, 5, 0, "block", 9, 1, 11, TMC2130HeatSinkColor ], + [ 10, 3, 0, "block", 9, 1, 11, TMC2130HeatSinkColor ], + ], + [] +]; + +test_pcb = ["TestPCB", "Test PCB", + 50, 500, 1.6, // length, width, thickness + 3, // Corner radius + 2.75, // Mounting hole diameter + 6, // Pad around mounting hole + "green",// Color + false, // True if the parts should be separate BOM items + // hole offsets + [ [3, 3], [3, -3], [-3, 3], [-3, -3] ], + // components + [ + [ 10, 10, 0, "2p54header", 4, 1], + [ 25, 10, 0, "2p54header", 5, 1, undef, "blue" ], + [ 10, 20, 0, "2p54boxhdr", 4, 2], + [ 10, 30, 0, "2p54socket", 6, 1], + [ 25, 30, 0, "2p54socket", 4, 1, undef, undef, undef, "red" ], + [ 10, 40, 0, "chip", 10, 5, 1, grey20], + [ 10, 60, 180, "rj45"], + [ 8, 80, 180, "usb_A"], + [ 8, 100, 180, "usb_Ax2"], + [ 3, 120, 180, "usb_uA"], + [ 8, 140, 180, "usb_B"], + [ 10, 160, 0, "buzzer"], + [ 25, 160, 0, "buzzer", 4.5, 8.5], + [ 10, 175, 0, "potentiometer"], + [ 30, 175, 0, "potentiometer", 7, 8], + [ 8, 190, 180, "jack"], + [ 6, 200, 180, "barrel_jack"], + [ 5, 220, 180, "hdmi"], + [ 3, 240, 180, "mini_hdmi"], + [ 10, 250, 0, "flex"], + [ 10, 265, 0, "flat_flex"], + [ 10, 280, 0, "D_plug", DCONN9], + [ 10, 300, 0, "molex_hdr", 2], + [ 10, 310, 0, "jst_xh", 2], + [ 10, 320, 180, "term254", 3], + [ 20, 320, 180, "term254", 3, undef, grey20], + [ 10, 340, 180, "gterm35", 4, [1,2]], + [ 20, 340, 180, "gterm35", 4, [1,2], "red"], + [ 30, 340, 180, "gterm", gt_5x11, 3], + [ 10, 360, 180, "gterm635", 2], + [ 25, 360, 180, "gterm635", 2, undef, "blue"], + [ 40, 360, 180, "gterm", gt_5x17, 2, undef, grey20], + [ 40, 340, 180, "gterm", gt_5x17, 3, [1], "red"], + [ 10, 380, 180, "term35", 4], + [ 20, 380, 180, "term35", 3, "lime"], + [ 10, 400, 0, "transition", 5], + [ 10, 410, 0, "block", 10, 5, 8, "orange"], + [ 10, 420, 0, "button_6mm"], + [ 10, 435, 0, "microswitch", small_microswitch], + [ 12, 450, 0, "pcb", 11, TMC2130 ], + [ 12, 456, 0, "2p54socket", 8, 1 ], + [ 12, 444, 0, "2p54socket", 8, 1, undef, undef, undef, "red" ], + [ 10, 470, 0, "standoff", 5, 4.5, 12.5, 2.54], + [ 6, 480, 180, "uSD", [12, 11.5, 1.4]], + ], + // accessories + [] +]; + + +if($preview) + let($show_threads = true) + pcb(test_pcb); diff --git a/tests/PCB_mount.scad b/tests/PCB_mount.scad new file mode 100644 index 0000000..e1fe8a3 --- /dev/null +++ b/tests/PCB_mount.scad @@ -0,0 +1,35 @@ +// +// NopSCADlib Copyright Chris Palmer 2019 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../utils/core/core.scad> +use <../printed/pcb_mount.scad> + +PI_IO = ["PI_IO", "PI_IO V2", 35.56, 25.4, 1.6, 0, 0, 0, "green", true, [], + [[(3.015 - 2.7) * 25.4 - 3.5 /2, (4.5 - 3.685) * 25.4, 90, "term35", 2], + [(3.46 - 2.7) * 25.4 - 3.5 /2, (4.5 - 3.69) * 25.4, 90, "term35", 2], + [(3.91 - 2.7) * 25.4 - 3.5 /2, (4.5 - 3.69) * 25.4, 90, "term35", 2], + [(3.4 - 2.7) * 25.4, (4.5 - 4.15) * 25.4, 0, "2p54socket", 13, 2], + ], []]; + +module pcb_mounts() + if($preview) + pcb_mount_assembly(PI_IO, 3); + else + pcb_mount(PI_IO); + +pcb_mounts(); diff --git a/tests/PCBs.scad b/tests/PCBs.scad new file mode 100644 index 0000000..7493ad9 --- /dev/null +++ b/tests/PCBs.scad @@ -0,0 +1,31 @@ +// +// NopSCADlib Copyright Chris Palmer 2018 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> +include <../vitamins/pcbs.scad> + +use <../utils/layout.scad> + +module pcbs() + layout([for(p = pcbs) pcb_width(p)], 10) + translate([0, pcb_length(pcbs[$i]) / 2]) + rotate(90) + pcb_assembly(pcbs[$i], 5 + $i, 3); + +if($preview) + pcbs(); diff --git a/tests/PSU_shroud.scad b/tests/PSU_shroud.scad new file mode 100644 index 0000000..c2ceb4e --- /dev/null +++ b/tests/PSU_shroud.scad @@ -0,0 +1,37 @@ +// +// NopSCADlib Copyright Chris Palmer 2018 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> +include <../vitamins/psus.scad> + +use <../utils/layout.scad> +use <../printed/psu_shroud.scad> + +thickness = 3; + +module psu_shrouds() + layout([for(p = psus) psu_width(p)], 10) let(psu = psus[$i]) + if(psu_terminals(psu)) + rotate(90) { + if($preview) + psu_shroud_fastened_assembly(psu, 6, thickness, psu[0]); + else + psu_shroud(psu, 6, psu[0]); + } + +psu_shrouds(); diff --git a/tests/PSUs.scad b/tests/PSUs.scad new file mode 100644 index 0000000..c964e4a --- /dev/null +++ b/tests/PSUs.scad @@ -0,0 +1,35 @@ +// +// NopSCADlib Copyright Chris Palmer 2018 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> +include <../vitamins/psus.scad> + +use <../utils/layout.scad> + +module psus() + layout([for(p = psus) psu_width(p)], 10) let(p = psus[$i]) + rotate(atx_psu(p) ? 0 : 90) { + psu(p); + + psu_screw_positions(p) + translate_z(3) + screw_and_washer(psu_screw(p), 8); + } + +if($preview) + psus(); diff --git a/tests/SCS_bearing_blocks.scad b/tests/SCS_bearing_blocks.scad new file mode 100644 index 0000000..d927ca1 --- /dev/null +++ b/tests/SCS_bearing_blocks.scad @@ -0,0 +1,35 @@ +// +// NopSCADlib Copyright Chris Palmer 2020 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> +include <../vitamins/scs_bearing_blocks.scad> + +use <../utils/layout.scad> + +module scs_bearing_blocks() + layout([for(s = scs_bearing_blocks) scs_size(s).x], 10) { + part_thickness = 5; + scs_bearing_block_assembly(scs_bearing_blocks[$i], part_thickness); + + if($i > 0) // skip $i==0, since no SCS6LUU long variant to match SCS6UU + translate([0, 60]) + scs_bearing_block_assembly(scs_bearing_blocks_long[$i - 1], part_thickness); + } + +if($preview) + scs_bearing_blocks(); diff --git a/tests/SK_brackets.scad b/tests/SK_brackets.scad new file mode 100644 index 0000000..f2d34f8 --- /dev/null +++ b/tests/SK_brackets.scad @@ -0,0 +1,39 @@ +// +// NopSCADlib Copyright Chris Palmer 2018 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> +include <../vitamins/sk_brackets.scad> +include <../vitamins/extrusions.scad> + +use <../utils/layout.scad> + +module sk_brackets() { + screws = [M4_dome_screw, M4_cap_screw, M5_cap_screw, M5_cap_screw]; + nuts = [M4_hammer_nut, M4_sliding_t_nut, M5_sliding_t_nut, undef]; + // channel depth = 6 for 2020 extrusion, 9 for 3030 extrusion + depths = [6, 6, 9, 0]; + layout([for(s = sk_brackets) 1.5 * sk_size(s)[1]]) { + sk_bracket_assembly(sk_brackets[$i], screw_type = screws[$i], nut_type = nuts[$i], max_screw_depth = depths[$i]); + translate([0, -sk_hole_offset(sk_brackets[$i]) - extrusion_width($i < 2 ? E2020 : E3030) / 2, 0]) + rotate([0, 90, 0]) + extrusion($i < 2 ? E2020 : E3030, 20, false); + } +} + +if($preview) + sk_brackets(); diff --git a/tests/SSR_shroud.scad b/tests/SSR_shroud.scad new file mode 100644 index 0000000..2745c0a --- /dev/null +++ b/tests/SSR_shroud.scad @@ -0,0 +1,36 @@ +// +// NopSCADlib Copyright Chris Palmer 2018 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> +include <../vitamins/ssrs.scad> + +use <../utils/layout.scad> +use <../printed/ssr_shroud.scad> + +thickness = 3; + +module ssr_shrouds() + layout([for(s = ssrs) ssr_width(s)], 15) let(ssr = ssrs[$i]) + rotate(90) { + if($preview) + ssr_shroud_fastened_assembly(ssr, 6, thickness, ssr[0]); + else + ssr_shroud(ssr, 6, ssr[0]); + } + +ssr_shrouds(); diff --git a/tests/SSRs.scad b/tests/SSRs.scad new file mode 100644 index 0000000..b55a51b --- /dev/null +++ b/tests/SSRs.scad @@ -0,0 +1,30 @@ +// +// NopSCADlib Copyright Chris Palmer 2018 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> +include <../vitamins/ssrs.scad> + +use <../utils/layout.scad> + +module ssrs() + layout([for(s = ssrs) ssr_width(s)], 15) + rotate(90) + ssr_assembly(ssrs[$i], M4_cap_screw, 3); + +if($preview) + ssrs();
Vitamins A-J Vitamins K-Q Vitamins R-Z Printed Utilities Core Utilities
Ball_bearings Kp_pillow_blocks Rails Box Annotation Bom
Batteries Ldrs Ring_terminals Butt_box Bezier Clip
Belts Leadnuts Rockers Cable_grommets Dogbones Global
Blowers Leds Rod Carriers Fillet Polyholes
Bulldogs Light_strips Screws Corner_block Hanging_hole Rounded_rectangle
Buttons Linear_bearings Scs_bearing_blocks Door_hinge Layout Sphere
Cable_strips Mains_sockets Sealing_strip Door_latch Maths Teardrops
Components Meter Sheets Fan_guard Offset
D_connectors Microswitches Sk_brackets Fixing_block Quadrant
Displays Microview Spades Flat_hinge Round
Extrusion_brackets Modules Spools Foot Rounded_cylinder
Extrusions Nuts Springs Handle Rounded_polygon
Fans O_ring Ssrs Pcb_mount Sector
Fuseholder Opengrab Stepper_motors Printed_box Sweep
Geared_steppers Pcb Toggles Psu_shroud Thread
Green_terminals Pcbs Transformers Ribbon_clamp Tube
Hot_ends Pillars Tubings Screw_knob
Hygrometer Pin_headers Variacs Socket_box
Iecs Psus Veroboard Ssr_shroud
Ball_bearings KP_pillow_blocks Rails Box Annotation BOM
Batteries LDRs Ring_terminals Butt_box Bezier Clip
Belts LEDs Rockers Cable_grommets Dogbones Global
Blowers Leadnuts Rod Carriers Fillet Polyholes
Bulldogs Light_strips SCS_bearing_blocks Corner_block Hanging_hole Rounded_rectangle
Buttons Linear_bearings SK_brackets Door_hinge Layout Sphere
Cable_strips Mains_sockets SSRs Door_latch Maths Teardrops
Components Meter Screws Fan_guard Offset
D_connectors Microswitches Sealing_strip Fixing_block Quadrant
Displays Microview Sheets Flat_hinge Round
Extrusion_brackets Modules Spades Foot Rounded_cylinder
Extrusions Nuts Spools Handle Rounded_polygon
Fans O_ring Springs PCB_mount Sector
Fuseholder Opengrab Stepper_motors PSU_shroud Sweep
Geared_steppers PCB Toggles Printed_box Thread
Green_terminals PCBs Transformers Ribbon_clamp Tube
Hot_ends PSUs Tubings SSR_shroud
Hygrometer Pillars Variacs Screw_knob
IECs Pin_headers Veroboard Socket_box
Inserts Pulleys Washers Strap_handle
Jack Wire
Zipties