Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
dbf930fd36 | ||
|
97cea65f41 | ||
|
c7e912cd77 | ||
|
f563645e45 | ||
|
2840cc2390 | ||
|
a5b2018008 | ||
|
7a395e475e | ||
|
7b7348d98f | ||
|
19dadcb58d | ||
|
60a2ef8976 | ||
|
188b3f706d | ||
|
c565f2912e |
27
CHANGELOG.md
@@ -3,6 +3,33 @@
|
|||||||
This changelog is generated by `changelog.py` using manually added semantic version tags to classify commits as breaking changes, additions or fixes.
|
This changelog is generated by `changelog.py` using manually added semantic version tags to classify commits as breaking changes, additions or fixes.
|
||||||
|
|
||||||
|
|
||||||
|
### [v21.18.0](https://github.com/nophead/NopSCADlib/releases/tag/v21.18.0 "show release") Additions [...](https://github.com/nophead/NopSCADlib/compare/v21.17.0...v21.18.0 "diff with v21.17.0")
|
||||||
|
* 2024-03-14 [`19dadcb`](https://github.com/nophead/NopSCADlib/commit/19dadcb58db0dd7408726c69d46cf2b7b26c764b "show commit") [C.P.](# "Chris Palmer") Updated images and readme.
|
||||||
|
|
||||||
|
* 2024-03-14 [`c565f29`](https://github.com/nophead/NopSCADlib/commit/c565f2912e7319575fc6ec3262699b73305c46b4 "show commit") [V.](# "V.Shkriabets") Update MT3608 pcb module
|
||||||
|
|
||||||
|
### [v21.17.0](https://github.com/nophead/NopSCADlib/releases/tag/v21.17.0 "show release") Additions [...](https://github.com/nophead/NopSCADlib/compare/v21.16.1...v21.17.0 "diff with v21.16.1")
|
||||||
|
* 2024-03-14 [`5579c0d`](https://github.com/nophead/NopSCADlib/commit/5579c0d988c6d7983d3884afa7e42fdb283109a8 "show commit") [C.P.](# "Chris Palmer") Fixed `box_shelf_bracket()` horizontal holes.
|
||||||
|
Added a third child to `box_shelf_bracket()` to allow custom additions.
|
||||||
|
|
||||||
|
* 2024-03-14 [`67408f8`](https://github.com/nophead/NopSCADlib/commit/67408f8422918416c617ec7389dbc09b2c62a2ae "show commit") [C.P.](# "Chris Palmer") Added `d_hole()` module.
|
||||||
|
|
||||||
|
* 2024-03-14 [`929abbe`](https://github.com/nophead/NopSCADlib/commit/929abbefda2c380b121c775371f197860c6c3aff "show commit") [C.P.](# "Chris Palmer") Updated front page image.
|
||||||
|
|
||||||
|
* 2024-03-14 [`c7727e7`](https://github.com/nophead/NopSCADlib/commit/c7727e7106e3829a6b5f6c501b1a082d540a4a68 "show commit") [C.P.](# "Chris Palmer") Added Sellotape to sheets.
|
||||||
|
|
||||||
|
* 2024-03-14 [`1dbba5a`](https://github.com/nophead/NopSCADlib/commit/1dbba5a650f8dac2d05a5668008e61a5ec22ea4f "show commit") [C.P.](# "Chris Palmer") Added `camera_lens_height()` function.
|
||||||
|
|
||||||
|
#### [v21.16.1](https://github.com/nophead/NopSCADlib/releases/tag/v21.16.1 "show release") Fixes [...](https://github.com/nophead/NopSCADlib/compare/v21.16.0...v21.16.1 "diff with v21.16.0")
|
||||||
|
* 2024-03-14 [`db2a9a8`](https://github.com/nophead/NopSCADlib/commit/db2a9a8a24966f098d4c0c8157de98a885b79a85 "show commit") [C.P.](# "Chris Palmer") Ziptie test can now show wires with t `=` 0.
|
||||||
|
|
||||||
|
* 2024-03-14 [`6ced9c8`](https://github.com/nophead/NopSCADlib/commit/6ced9c871c5a637dbe8494836a4233e1f6cd4971 "show commit") [C.P.](# "Chris Palmer") Fixed FOV for ESP32 camera being rotated.
|
||||||
|
Shortened the ESP32 camera header pins.
|
||||||
|
|
||||||
|
* 2024-03-14 [`d6b00fb`](https://github.com/nophead/NopSCADlib/commit/d6b00fbf5719239adc5e8b66f863c003a50806d3 "show commit") [C.P.](# "Chris Palmer") Removed unused test code.
|
||||||
|
|
||||||
|
* 2024-03-14 [`2c996bb`](https://github.com/nophead/NopSCADlib/commit/2c996bb7a143a85c21833a69f56f2f47afabe072 "show commit") [C.P.](# "Chris Palmer") Fixed random error caused by not running bom first.
|
||||||
|
|
||||||
### [v21.16.0](https://github.com/nophead/NopSCADlib/releases/tag/v21.16.0 "show release") Additions [...](https://github.com/nophead/NopSCADlib/compare/v21.15.0...v21.16.0 "diff with v21.15.0")
|
### [v21.16.0](https://github.com/nophead/NopSCADlib/releases/tag/v21.16.0 "show release") Additions [...](https://github.com/nophead/NopSCADlib/compare/v21.15.0...v21.16.0 "diff with v21.15.0")
|
||||||
* 2024-02-19 [`fdb92ec`](https://github.com/nophead/NopSCADlib/commit/fdb92ec263d60a42e04f06abfeec5e1648a12b6b "show commit") [C.P.](# "Chris Palmer") Improved layout to fit into front page view.
|
* 2024-02-19 [`fdb92ec`](https://github.com/nophead/NopSCADlib/commit/fdb92ec263d60a42e04f06abfeec5e1648a12b6b "show commit") [C.P.](# "Chris Palmer") Improved layout to fit into front page view.
|
||||||
|
|
||||||
|
1
lib.scad
@@ -97,6 +97,7 @@ use <utils/hanging_hole.scad>
|
|||||||
use <utils/fillet.scad>
|
use <utils/fillet.scad>
|
||||||
use <utils/rounded_polygon.scad>
|
use <utils/rounded_polygon.scad>
|
||||||
use <utils/rounded_triangle.scad>
|
use <utils/rounded_triangle.scad>
|
||||||
|
use <utils/splines.scad>
|
||||||
use <utils/layout.scad>
|
use <utils/layout.scad>
|
||||||
use <utils/round.scad>
|
use <utils/round.scad>
|
||||||
use <utils/offset.scad>
|
use <utils/offset.scad>
|
||||||
|
BIN
libtest.png
Before Width: | Height: | Size: 1001 KiB After Width: | Height: | Size: 1001 KiB |
@@ -18,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
//! Cable clips to order. Can be for one or two cables of different sizes. Can use an insert and a screw from below or a screw and nut either way up.
|
//! Cable clips to order. Can be for one or two cables of different sizes. Can use an insert and a screw from below or a screw and nut, nyloc or plain, either way up.
|
||||||
//
|
//
|
||||||
include <../core.scad>
|
include <../core.scad>
|
||||||
use <../vitamins/wire.scad>
|
use <../vitamins/wire.scad>
|
||||||
@@ -30,27 +30,29 @@ wall = 2;
|
|||||||
function cable_clip_insert(screw, insert = true) = //! Insert type for clip, given screw.
|
function cable_clip_insert(screw, insert = true) = //! Insert type for clip, given screw.
|
||||||
is_list(insert) ? insert : insert ? screw_insert(screw, true) : false;
|
is_list(insert) ? insert : insert ? screw_insert(screw, true) : false;
|
||||||
|
|
||||||
function cable_clip_width(screw, insert = false) = //! Width given the `screw` and possibly insert.
|
function cable_clip_width(screw, insert = false, nut = false) = //! Width given the `screw` and possibly insert or nut.
|
||||||
let(insert = cable_clip_insert(screw, insert))
|
let(insert = cable_clip_insert(screw, insert))
|
||||||
insert ? 2 * (insert_hole_radius(insert) + wall) :
|
insert ? 2 * (insert_hole_radius(insert) + wall) :
|
||||||
max(wall + 2 * screw_clearance_radius(screw) + wall, washer_diameter(screw_washer(screw)));
|
nut ? 2 * (nut_radius(screw_nut(screw)) + wall) :
|
||||||
|
max(wall + 2 * screw_clearance_radius(screw) + wall, washer_diameter(screw_washer(screw)));
|
||||||
|
|
||||||
function cable_clip_height(cable, screw = false, insert = false) = //! Height given the `cable`.
|
function cable_clip_height(cable, screw = false, insert = false, nut = false) = //! Height given the `cable`.
|
||||||
let(insert = cable_clip_insert(screw, insert))
|
let(insert = cable_clip_insert(screw, insert))
|
||||||
max(cable_height(cable) + wall, insert ? insert_hole_length(insert) + 1 : 0);
|
max(cable_height(cable) + wall, insert ? insert_hole_length(insert) + 1 : 0, nut ? nut_trap_depth(screw_nut(screw)) + wall : 0);
|
||||||
|
|
||||||
function cable_clip_extent(screw, cable, insert = false) = cable_clip_width(screw, insert) / 2 + cable_width(cable) + wall; //! How far it extends from the screw.
|
function cable_clip_extent(screw, cable, insert = false, nut = false) = cable_clip_width(screw, insert, nut) / 2 + cable_width(cable) + wall; //! How far it extends from the screw.
|
||||||
function cable_clip_offset(screw, cable, insert = false) = cable_clip_width(screw, insert) / 2 + cable_width(cable) / 2; //! The offset of the cable from the screw.
|
function cable_clip_offset(screw, cable, insert = false, nut = false) = cable_clip_width(screw, insert, nut) / 2 + cable_width(cable) / 2; //! The offset of the cable from the screw.
|
||||||
|
|
||||||
module single_cable_clip(screw, cable, h = 0, insert = false) {
|
module single_cable_clip(screw, cable, h = 0, insert = false, nut = false) {
|
||||||
insert = cable_clip_insert(screw, insert);
|
insert = cable_clip_insert(screw, insert);
|
||||||
height = cable_clip_width(screw, insert);
|
height = cable_clip_width(screw, insert, nut);
|
||||||
depth = h ? h : cable_clip_height(cable, screw, insert);
|
depth = h ? h : cable_clip_height(cable, screw, insert, nut);
|
||||||
w = cable_width(cable);
|
w = cable_width(cable);
|
||||||
width = wall + w + height;
|
width = wall + w + height;
|
||||||
hole_x = wall + w + height / 2;
|
hole_x = wall + w + height / 2;
|
||||||
rad = min(wall + cable_wire_size(cable) / 2, depth / 2);
|
rad = min(wall + cable_wire_size(cable) / 2, depth / 2);
|
||||||
r = extrusion_width - eps;
|
r = extrusion_width - eps;
|
||||||
|
the_nut = screw_nut(screw);
|
||||||
translate([-hole_x, 0])
|
translate([-hole_x, 0])
|
||||||
difference() {
|
difference() {
|
||||||
linear_extrude(height)
|
linear_extrude(height)
|
||||||
@@ -85,62 +87,68 @@ module single_cable_clip(screw, cable, h = 0, insert = false) {
|
|||||||
if(insert)
|
if(insert)
|
||||||
insert_hole(insert, 10, horizontal = true);
|
insert_hole(insert, 10, horizontal = true);
|
||||||
else
|
else
|
||||||
teardrop_plus(h = 2 * depth + 1, r = screw_clearance_radius(screw), center = true);
|
if(nut) {
|
||||||
|
translate_z(depth - wall - nut_trap_depth(the_nut))
|
||||||
|
nut_trap(screw, the_nut, horizontal = true);
|
||||||
|
nut_trap(screw, the_nut, horizontal = true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
teardrop_plus(h = 2 * depth + 1, r = screw_clearance_radius(screw), center = true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module double_cable_clip(screw, cable1, cable2, insert = false) {
|
module double_cable_clip(screw, cable1, cable2, insert = false, nut = false) {
|
||||||
h = max(cable_clip_height(cable1, screw, insert), cable_clip_height(cable2, screw, insert));
|
h = max(cable_clip_height(cable1, screw, insert, nut), cable_clip_height(cable2, screw, insert, nut));
|
||||||
union() {
|
union() {
|
||||||
single_cable_clip(screw, cable1, h, insert);
|
single_cable_clip(screw, cable1, h, insert, nut);
|
||||||
|
|
||||||
mirror([1,0,0]) single_cable_clip(screw, cable2, h, insert);
|
mirror([1,0,0]) single_cable_clip(screw, cable2, h, insert, nut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module cable_clip(screw, cable1, cable2 = 0, insert = false) { //! Create the STL for a single cable or two cable clip
|
module cable_clip(screw, cable1, cable2 = 0, insert = false, nut = false) { //! Create the STL for a single cable or two cable clip
|
||||||
function clip_str(screw) = str("cable_clip_", screw_radius(screw) * 20, insert ? "I" : "");
|
function clip_str(screw) = str("cable_clip_", screw_radius(screw) * 20, insert ? "I" : nut ? "N" : "");
|
||||||
function cable_str(cable) = str("_", cable_wires(cable), "_", round(cable_wire_size(cable) * 10));
|
function cable_str(cable) = str("_", cable_wires(cable), "_", round(cable_wire_size(cable) * 10));
|
||||||
|
assert(!(insert && nut), "insert and nut mutually exclusive");
|
||||||
if(cable2) {
|
if(cable2)
|
||||||
stl(str(clip_str(screw), cable_str(cable1), cable_str(cable2)));
|
stl(str(clip_str(screw), cable_str(cable1), cable_str(cable2)))
|
||||||
|
double_cable_clip(screw, cable1, cable2, insert, nut);
|
||||||
double_cable_clip(screw, cable1, cable2, insert);
|
else
|
||||||
}
|
stl(str(clip_str(screw), cable_str(cable1)))
|
||||||
else {
|
single_cable_clip(screw, cable1, h = 0, insert = insert, nut = nut);
|
||||||
stl(str(clip_str(screw), cable_str(cable1)));
|
|
||||||
|
|
||||||
single_cable_clip(screw, cable1, h = 0, insert = insert);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module cable_clip_assembly(screw, thickness, cable1, cable2 = 0, flip = false, insert = false, nut = false, nyloc = true) { //! Cable clip with the fasteners
|
||||||
module cable_clip_assembly(screw, thickness, cable1, cable2 = 0, flip = false, insert = false) { //! Cable clip with the fasteners
|
flip = flip || insert || nut; // Screw must be below if using an insert or nut
|
||||||
flip = flip || insert; // Screw must be below if using an insert
|
|
||||||
insert = cable_clip_insert(screw, insert);
|
insert = cable_clip_insert(screw, insert);
|
||||||
height = max(cable_clip_height(cable1, screw, insert), cable2 ? cable_clip_height(cable2, screw, insert) : 0);
|
height = max(cable_clip_height(cable1, screw, insert, nut), cable2 ? cable_clip_height(cable2, screw, insert, nut) : 0);
|
||||||
|
|
||||||
stl_colour(pp1_colour) render()
|
stl_colour(pp1_colour) render()
|
||||||
translate([0, cable_clip_width(screw, insert) / 2])
|
translate([0, cable_clip_width(screw, insert, nut) / 2])
|
||||||
rotate([90, 0, 0])
|
rotate([90, 0, 0])
|
||||||
cable_clip(screw, cable1, cable2, insert);
|
cable_clip(screw, cable1, cable2, insert, nut);
|
||||||
|
|
||||||
nut = screw_nut(screw);
|
the_nut = screw_nut(screw);
|
||||||
screw_len = screw_length(screw, height + thickness, 2, nyloc = !insert, insert = insert);
|
screw_len = nut ? screw_length(screw, thickness + wall, nyloc ? 1 : 2, nyloc = nyloc, nut = !nyloc)
|
||||||
|
: screw_length(screw, thickness + height, 2, nut = !nyloc && !insert, nyloc = !insert && nyloc, insert = insert);
|
||||||
translate_z(height)
|
translate_z(height)
|
||||||
if(flip)
|
if(flip)
|
||||||
if(insert)
|
if(insert)
|
||||||
insert(insert);
|
insert(insert);
|
||||||
else
|
else
|
||||||
nut_and_washer(nut, true);
|
if(nut)
|
||||||
|
translate_z(-height + wall)
|
||||||
|
nut(the_nut, nyloc);
|
||||||
|
else
|
||||||
|
nut_and_washer(the_nut, nyloc);
|
||||||
else
|
else
|
||||||
screw_and_washer(screw, screw_len);
|
screw_and_washer(screw, screw_len);
|
||||||
|
|
||||||
translate_z(-thickness)
|
translate_z(-thickness)
|
||||||
vflip()
|
vflip()
|
||||||
if(flip)
|
if(flip)
|
||||||
screw_and_washer(screw, screw_len, insert);
|
screw_and_washer(screw, screw_len, insert || !nyloc);
|
||||||
else
|
else
|
||||||
nut_and_washer(nut, true);
|
nut_and_washer(the_nut, nyloc);
|
||||||
}
|
}
|
||||||
|
67
readme.md
@@ -40,10 +40,10 @@ A list of changes classified as breaking, additions or fixes is maintained in [C
|
|||||||
<tr><td> <a href = "#dip">DIP</a> </td><td> <a href = "#opengrab">Opengrab</a> </td><td> <a href = "#springs">Springs</a> </td><td> <a href = "#led_bezel">LED_bezel</a> </td><td> <a href = "#rounded_polygon">Rounded_polygon</a> </td><td></td></tr>
|
<tr><td> <a href = "#dip">DIP</a> </td><td> <a href = "#opengrab">Opengrab</a> </td><td> <a href = "#springs">Springs</a> </td><td> <a href = "#led_bezel">LED_bezel</a> </td><td> <a href = "#rounded_polygon">Rounded_polygon</a> </td><td></td></tr>
|
||||||
<tr><td> <a href = "#d_connectors">D_connectors</a> </td><td> <a href = "#pcb">PCB</a> </td><td> <a href = "#stepper_motors">Stepper_motors</a> </td><td> <a href = "#pcb_mount">PCB_mount</a> </td><td> <a href = "#rounded_triangle">Rounded_triangle</a> </td><td></td></tr>
|
<tr><td> <a href = "#d_connectors">D_connectors</a> </td><td> <a href = "#pcb">PCB</a> </td><td> <a href = "#stepper_motors">Stepper_motors</a> </td><td> <a href = "#pcb_mount">PCB_mount</a> </td><td> <a href = "#rounded_triangle">Rounded_triangle</a> </td><td></td></tr>
|
||||||
<tr><td> <a href = "#displays">Displays</a> </td><td> <a href = "#pcbs">PCBs</a> </td><td> <a href = "#swiss_clips">Swiss_clips</a> </td><td> <a href = "#psu_shroud">PSU_shroud</a> </td><td> <a href = "#sector">Sector</a> </td><td></td></tr>
|
<tr><td> <a href = "#displays">Displays</a> </td><td> <a href = "#pcbs">PCBs</a> </td><td> <a href = "#swiss_clips">Swiss_clips</a> </td><td> <a href = "#psu_shroud">PSU_shroud</a> </td><td> <a href = "#sector">Sector</a> </td><td></td></tr>
|
||||||
<tr><td> <a href = "#extrusion_brackets">Extrusion_brackets</a> </td><td> <a href = "#psus">PSUs</a> </td><td> <a href = "#terminals">Terminals</a> </td><td> <a href = "#pocket_handle">Pocket_handle</a> </td><td> <a href = "#sweep">Sweep</a> </td><td></td></tr>
|
<tr><td> <a href = "#extrusion_brackets">Extrusion_brackets</a> </td><td> <a href = "#psus">PSUs</a> </td><td> <a href = "#terminals">Terminals</a> </td><td> <a href = "#pocket_handle">Pocket_handle</a> </td><td> <a href = "#splines">Splines</a> </td><td></td></tr>
|
||||||
<tr><td> <a href = "#extrusions">Extrusions</a> </td><td> <a href = "#panel_meters">Panel_meters</a> </td><td> <a href = "#toggles">Toggles</a> </td><td> <a href = "#press_fit">Press_fit</a> </td><td> <a href = "#thread">Thread</a> </td><td></td></tr>
|
<tr><td> <a href = "#extrusions">Extrusions</a> </td><td> <a href = "#panel_meters">Panel_meters</a> </td><td> <a href = "#toggles">Toggles</a> </td><td> <a href = "#press_fit">Press_fit</a> </td><td> <a href = "#sweep">Sweep</a> </td><td></td></tr>
|
||||||
<tr><td> <a href = "#fans">Fans</a> </td><td> <a href = "#photo_interrupters">Photo_interrupters</a> </td><td> <a href = "#transformers">Transformers</a> </td><td> <a href = "#printed_box">Printed_box</a> </td><td> <a href = "#tube">Tube</a> </td><td></td></tr>
|
<tr><td> <a href = "#fans">Fans</a> </td><td> <a href = "#photo_interrupters">Photo_interrupters</a> </td><td> <a href = "#transformers">Transformers</a> </td><td> <a href = "#printed_box">Printed_box</a> </td><td> <a href = "#thread">Thread</a> </td><td></td></tr>
|
||||||
<tr><td> <a href = "#fastons">Fastons</a> </td><td> <a href = "#pillars">Pillars</a> </td><td> <a href = "#ttracks">Ttracks</a> </td><td> <a href = "#printed_pulleys">Printed_pulleys</a> </td><td></td><td></td></tr>
|
<tr><td> <a href = "#fastons">Fastons</a> </td><td> <a href = "#pillars">Pillars</a> </td><td> <a href = "#ttracks">Ttracks</a> </td><td> <a href = "#printed_pulleys">Printed_pulleys</a> </td><td> <a href = "#tube">Tube</a> </td><td></td></tr>
|
||||||
<tr><td> <a href = "#fuseholder">Fuseholder</a> </td><td> <a href = "#pillow_blocks">Pillow_blocks</a> </td><td> <a href = "#tubings">Tubings</a> </td><td> <a href = "#ribbon_clamp">Ribbon_clamp</a> </td><td></td><td></td></tr>
|
<tr><td> <a href = "#fuseholder">Fuseholder</a> </td><td> <a href = "#pillow_blocks">Pillow_blocks</a> </td><td> <a href = "#tubings">Tubings</a> </td><td> <a href = "#ribbon_clamp">Ribbon_clamp</a> </td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#gear_motors">Gear_motors</a> </td><td> <a href = "#pin_headers">Pin_headers</a> </td><td> <a href = "#variacs">Variacs</a> </td><td> <a href = "#ssr_shroud">SSR_shroud</a> </td><td></td><td></td></tr>
|
<tr><td> <a href = "#gear_motors">Gear_motors</a> </td><td> <a href = "#pin_headers">Pin_headers</a> </td><td> <a href = "#variacs">Variacs</a> </td><td> <a href = "#ssr_shroud">SSR_shroud</a> </td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#geared_steppers">Geared_steppers</a> </td><td> <a href = "#potentiometers">Potentiometers</a> </td><td> <a href = "#veroboard">Veroboard</a> </td><td> <a href = "#screw_knob">Screw_knob</a> </td><td></td><td></td></tr>
|
<tr><td> <a href = "#geared_steppers">Geared_steppers</a> </td><td> <a href = "#potentiometers">Potentiometers</a> </td><td> <a href = "#veroboard">Veroboard</a> </td><td> <a href = "#screw_knob">Screw_knob</a> </td><td></td><td></td></tr>
|
||||||
@@ -4229,6 +4229,7 @@ E.g. 475A is 4.7uF 10V on the parts list.
|
|||||||
### Vitamins
|
### Vitamins
|
||||||
| Qty | Module call | BOM entry |
|
| Qty | Module call | BOM entry |
|
||||||
| ---:|:--- |:---|
|
| ---:|:--- |:---|
|
||||||
|
| 1 | `smd_inductor(CDRH104)` | CDRH104 package 10R |
|
||||||
| 1 | `smd_diode(DO214AC)` | DO214AC package SS34 |
|
| 1 | `smd_diode(DO214AC)` | DO214AC package SS34 |
|
||||||
| 1 | `smd_inductor(IND2525)` | IND2525 package 4R7 |
|
| 1 | `smd_inductor(IND2525)` | IND2525 package 4R7 |
|
||||||
| 1 | `smd_led(LED0603, green)` | SMD LED 0603 green |
|
| 1 | `smd_led(LED0603, green)` | SMD LED 0603 green |
|
||||||
@@ -4770,7 +4771,7 @@ T-Tracks used in woodworking jigs
|
|||||||
---
|
---
|
||||||
<a name="tubings"></a>
|
<a name="tubings"></a>
|
||||||
## Tubings
|
## Tubings
|
||||||
Tubing and sleeving. The internal diameter can be forced to stretch it over something.
|
Tubing and sleeving. The internal diameter can be forced to stretch it over something. A path can be specified, otherwise it is just straight with the specified length.
|
||||||
|
|
||||||
[vitamins/tubings.scad](vitamins/tubings.scad) Object definitions.
|
[vitamins/tubings.scad](vitamins/tubings.scad) Object definitions.
|
||||||
|
|
||||||
@@ -4795,7 +4796,7 @@ Tubing and sleeving. The internal diameter can be forced to stretch it over some
|
|||||||
### Modules
|
### Modules
|
||||||
| Module | Description |
|
| Module | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
| `tubing(type, length = 15, forced_id = 0, center = true)` | Draw specified tubing with optional forced internal diameter |
|
| `tubing(type, length = 15, forced_id = 0, center = true, path = [])` | Draw specified tubing with optional forced internal diameter and optional path. |
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -5364,7 +5365,7 @@ fixing_blocks along the sides.
|
|||||||
---
|
---
|
||||||
<a name="cable_clip"></a>
|
<a name="cable_clip"></a>
|
||||||
## Cable_clip
|
## Cable_clip
|
||||||
Cable clips to order. Can be for one or two cables of different sizes. Can use an insert and a screw from below or a screw and nut either way up.
|
Cable clips to order. Can be for one or two cables of different sizes. Can use an insert and a screw from below or a screw and nut, nyloc or plain, either way up.
|
||||||
|
|
||||||
[printed/cable_clip.scad](printed/cable_clip.scad) Implementation.
|
[printed/cable_clip.scad](printed/cable_clip.scad) Implementation.
|
||||||
|
|
||||||
@@ -5373,17 +5374,17 @@ Cable clips to order. Can be for one or two cables of different sizes. Can use a
|
|||||||
### Functions
|
### Functions
|
||||||
| Function | Description |
|
| Function | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
| `cable_clip_extent(screw, cable, insert = false)` | How far it extends from the screw. |
|
| `cable_clip_extent(screw, cable, insert = false, nut = false)` | How far it extends from the screw. |
|
||||||
| `cable_clip_height(cable, screw = false, insert = false)` | Height given the `cable`. |
|
| `cable_clip_height(cable, screw = false, insert = false, nut = false)` | Height given the `cable`. |
|
||||||
| `cable_clip_insert(screw, insert = true)` | Insert type for clip, given screw. |
|
| `cable_clip_insert(screw, insert = true)` | Insert type for clip, given screw. |
|
||||||
| `cable_clip_offset(screw, cable, insert = false)` | The offset of the cable from the screw. |
|
| `cable_clip_offset(screw, cable, insert = false, nut = false)` | The offset of the cable from the screw. |
|
||||||
| `cable_clip_width(screw, insert = false)` | Width given the `screw` and possibly insert. |
|
| `cable_clip_width(screw, insert = false, nut = false)` | Width given the `screw` and possibly insert or nut. |
|
||||||
|
|
||||||
### Modules
|
### Modules
|
||||||
| Module | Description |
|
| Module | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
| `cable_clip(screw, cable1, cable2 = 0, insert = false)` | Create the STL for a single cable or two cable clip |
|
| `cable_clip(screw, cable1, cable2 = 0, insert = false, nut = false)` | Create the STL for a single cable or two cable clip |
|
||||||
| `cable_clip_assembly(screw, thickness, cable1, cable2 = 0, flip = false, insert = false)` | Cable clip with the fasteners |
|
| `cable_clip_assembly(screw, thickness, cable1, cable2 = 0, flip = false, insert = false, nut = false, nyloc = true)` | Cable clip with the fasteners |
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -5392,10 +5393,10 @@ Cable clips to order. Can be for one or two cables of different sizes. Can use a
|
|||||||
| ---:|:--- |:---|
|
| ---:|:--- |:---|
|
||||||
| 2 | `insert(CNCKM3)` | Heatfit insert M3 x 3mm |
|
| 2 | `insert(CNCKM3)` | Heatfit insert M3 x 3mm |
|
||||||
| 5 | `nut(M3_nut, nyloc = true)` | Nut M3 x 2.4mm nyloc |
|
| 5 | `nut(M3_nut, nyloc = true)` | Nut M3 x 2.4mm nyloc |
|
||||||
| 2 | `screw(M3_dome_screw, 10)` | Screw M3 dome x 10mm |
|
| 3 | `screw(M3_dome_screw, 10)` | Screw M3 dome x 10mm |
|
||||||
| 1 | `screw(M3_dome_screw, 12)` | Screw M3 dome x 12mm |
|
| 1 | `screw(M3_dome_screw, 12)` | Screw M3 dome x 12mm |
|
||||||
| 4 | `screw(M3_dome_screw, 16)` | Screw M3 dome x 16mm |
|
| 3 | `screw(M3_dome_screw, 16)` | Screw M3 dome x 16mm |
|
||||||
| 12 | `washer(M3_washer)` | Washer M3 x 7mm x 0.5mm |
|
| 11 | `washer(M3_washer)` | Washer M3 x 7mm x 0.5mm |
|
||||||
| 2 | `star_washer(M3_washer)` | Washer star M3 x 0.5mm |
|
| 2 | `star_washer(M3_washer)` | Washer star M3 x 0.5mm |
|
||||||
|
|
||||||
### Printed
|
### Printed
|
||||||
@@ -5403,10 +5404,10 @@ Cable clips to order. Can be for one or two cables of different sizes. Can use a
|
|||||||
| ---:|:--- |
|
| ---:|:--- |
|
||||||
| 1 | cable_clip_30I_10_13.stl |
|
| 1 | cable_clip_30I_10_13.stl |
|
||||||
| 1 | cable_clip_30I_5_14_6_14.stl |
|
| 1 | cable_clip_30I_5_14_6_14.stl |
|
||||||
|
| 1 | cable_clip_30N_7_14_8_14.stl |
|
||||||
| 1 | cable_clip_30_1_14_2_14.stl |
|
| 1 | cable_clip_30_1_14_2_14.stl |
|
||||||
| 1 | cable_clip_30_1_60.stl |
|
| 1 | cable_clip_30_1_60.stl |
|
||||||
| 1 | cable_clip_30_3_14_4_14.stl |
|
| 1 | cable_clip_30_3_14_4_14.stl |
|
||||||
| 1 | cable_clip_30_7_14_8_14.stl |
|
|
||||||
| 1 | cable_clip_30_9_14.stl |
|
| 1 | cable_clip_30_9_14.stl |
|
||||||
|
|
||||||
|
|
||||||
@@ -5487,7 +5488,8 @@ Housings for PCB cameras.
|
|||||||
| 1 | `camera(rpi_camera_v1)` | Raspberry Pi camera V1 |
|
| 1 | `camera(rpi_camera_v1)` | Raspberry Pi camera V1 |
|
||||||
| 1 | `camera(rpi_camera_v2)` | Raspberry Pi camera V2 |
|
| 1 | `camera(rpi_camera_v2)` | Raspberry Pi camera V2 |
|
||||||
| 1 | `camera(rpi_camera)` | Raspberry Pi focusable camera |
|
| 1 | `camera(rpi_camera)` | Raspberry Pi focusable camera |
|
||||||
| 7 | `screw(M2_cap_screw, 10)` | Screw M2 cap x 10mm |
|
| 3 | `screw(M2_cap_screw, 8)` | Screw M2 cap x 8mm |
|
||||||
|
| 4 | `screw(M2_cap_screw, 10)` | Screw M2 cap x 10mm |
|
||||||
| 4 | `screw(M3_cap_screw, 16)` | Screw M3 cap x 16mm |
|
| 4 | `screw(M3_cap_screw, 16)` | Screw M3 cap x 16mm |
|
||||||
| 4 | `screw(M3_dome_screw, 10)` | Screw M3 dome x 10mm |
|
| 4 | `screw(M3_dome_screw, 10)` | Screw M3 dome x 10mm |
|
||||||
| 2 | `screw(M3_dome_screw, 12)` | Screw M3 dome x 12mm |
|
| 2 | `screw(M3_dome_screw, 12)` | Screw M3 dome x 12mm |
|
||||||
@@ -7418,6 +7420,32 @@ A sector of a circle between two angles.
|
|||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
<a href="#top">Top</a>
|
||||||
|
|
||||||
|
---
|
||||||
|
<a name="splines"></a>
|
||||||
|
## Splines
|
||||||
|
Cubic splines that interpolate between a list of 2D points passing through all of them.
|
||||||
|
Translated from the Python version at <https://community.alteryx.com/t5/Engine-Works/Creating-a-Cubic-Spline-in-Python-and-Alteryx/ba-p/581173>.
|
||||||
|
Note the x values of the points must be strictly increasing.
|
||||||
|
|
||||||
|
Catmull-Rom splines are well behaved but the ends points are control points and the curve only goes from the second point to the penultimate point.
|
||||||
|
Coded from <https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline#Code_example_in_Python>.
|
||||||
|
No restrictions on points and they can be 3D.
|
||||||
|
|
||||||
|
[utils/splines.scad](utils/splines.scad) Implementation.
|
||||||
|
|
||||||
|
[tests/splines.scad](tests/splines.scad) Code for this example.
|
||||||
|
|
||||||
|
### Functions
|
||||||
|
| Function | Description |
|
||||||
|
|:--- |:--- |
|
||||||
|
| `catmull_rom_spline(points, n, alpha = 0.5)` | Interpolate n new points between the specified points with a Catmull-Rom spline, alpha = 0.5 for centripetal, 0 for uniform and 1 for chordal. |
|
||||||
|
| `cubic_spline(points, N = 100)` | Interpolate the list of points given to produce N points on a cubic spline that passes through points given. |
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
<a href="#top">Top</a>
|
<a href="#top">Top</a>
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -7450,6 +7478,7 @@ Each vertex, apart from the first and the last, has an associated radius and the
|
|||||||
| `cap(facets, segment = 0, end)` | Create the mesh for an end cap |
|
| `cap(facets, segment = 0, end)` | Create the mesh for an end cap |
|
||||||
| `circle_points(r = 1, z = 0, dir = -1)` | Generate the points of a circle, setting z makes a single turn spiral |
|
| `circle_points(r = 1, z = 0, dir = -1)` | Generate the points of a circle, setting z makes a single turn spiral |
|
||||||
| `helical_twist_per_segment(r, pitch, sides)` | Calculate the twist around Z that rotate_from_to() introduces |
|
| `helical_twist_per_segment(r, pitch, sides)` | Calculate the twist around Z that rotate_from_to() introduces |
|
||||||
|
| `offset_paths(path, offsets, twists = 0)` | Create new paths offset from the original, optionally spiralling around it |
|
||||||
| `rectangle_points(w, h)` | Generate the points of a rectangle |
|
| `rectangle_points(w, h)` | Generate the points of a rectangle |
|
||||||
| `rounded_path(path)` | Convert a rounded_path, consisting of a start coordinate, vertex / radius pairs and then an end coordinate, to a path of points for sweep. |
|
| `rounded_path(path)` | Convert a rounded_path, consisting of a start coordinate, vertex / radius pairs and then an end coordinate, to a path of points for sweep. |
|
||||||
| `rounded_path_vertices(path)` | Show the unrounded version of a rounded_path for debug |
|
| `rounded_path_vertices(path)` | Show the unrounded version of a rounded_path for debug |
|
||||||
@@ -7461,7 +7490,7 @@ Each vertex, apart from the first and the last, has an associated radius and the
|
|||||||
### Modules
|
### Modules
|
||||||
| Module | Description |
|
| Module | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
| `show_path(path)` | Show a path using a chain of hulls for debugging, duplicate points are highlighted. |
|
| `show_path(path, r = 0.1)` | Show a path using a chain of hulls for debugging, duplicate points are highlighted. |
|
||||||
| `sweep(path, profile, loop = false, twist = 0, convexity = 1)` | Draw a polyhedron that is the swept volume |
|
| `sweep(path, profile, loop = false, twist = 0, convexity = 1)` | Draw a polyhedron that is the swept volume |
|
||||||
|
|
||||||

|

|
||||||
|
@@ -67,7 +67,7 @@ module smds() {
|
|||||||
translate([0, 39])
|
translate([0, 39])
|
||||||
layout([for(i = smd_inductors) smd_inductor_leads(i).x], 1)
|
layout([for(i = smd_inductors) smd_inductor_leads(i).x], 1)
|
||||||
let(i = smd_inductors[$i])
|
let(i = smd_inductors[$i])
|
||||||
smd_inductor(i, "4R7");
|
smd_inductor(i, ["4R7", "10R"][$i % 2]);
|
||||||
|
|
||||||
translate([20, 6])
|
translate([20, 6])
|
||||||
layout([for(q = smd_qfps) smd_qfp_body_size(q).x], 3)
|
layout([for(q = smd_qfps) smd_qfp_body_size(q).x], 3)
|
||||||
|
@@ -20,33 +20,39 @@
|
|||||||
include <../core.scad>
|
include <../core.scad>
|
||||||
use <../printed/cable_clip.scad>
|
use <../printed/cable_clip.scad>
|
||||||
use <../vitamins/wire.scad>
|
use <../vitamins/wire.scad>
|
||||||
|
use <../utils/layout.scad>
|
||||||
|
|
||||||
|
screw = M3_dome_screw;
|
||||||
sheet_thickness = 3;
|
sheet_thickness = 3;
|
||||||
|
|
||||||
cables = [
|
cables = [
|
||||||
[10, inch(0.05), true], 0, for(i = [1 : 9]) [i, 1.4], 0, [1, 6], 0,
|
[10, inch(0.05), true], 0, for(i = [1 : 9]) [i, 1.4], 0, [1, 6], 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
screw = M3_dome_screw;
|
clips = [for(i = [0 : ceil(len(cables) / 2) - 1]) let(c1= cables[2 * i], c2 = cables[2 * i + 1]) [c1, c2]];
|
||||||
|
|
||||||
|
function use_insert(i) = in([0, 3], i);
|
||||||
|
function use_nut(i) = in([4], i);
|
||||||
|
|
||||||
|
clip_lengths = [for(i = [0 : len(clips) - 1])
|
||||||
|
let(c = clips[i], c1 = c.x, c2 = c.y, ins = use_insert(i), nut = use_nut(i))
|
||||||
|
cable_clip_extent(screw, c1, insert = ins, nut = nut) + (c2 ? cable_clip_extent(screw, c2, insert = ins, nut = nut) : cable_clip_width(screw, insert = ins, nut = nut) / 2)];
|
||||||
|
|
||||||
module cable_clips() {
|
module cable_clips() {
|
||||||
for(i = [0 : ceil(len(cables) / 2) - 1]) {
|
layout(clip_lengths, 3, true) let(cable1 = clips[$i].x, cable2 = clips[$i].y) {
|
||||||
cable1 = cables[2 * i];
|
insert = use_insert($i);
|
||||||
cable2 = cables[2 * i + 1];
|
nut = use_nut($i);
|
||||||
translate([i * 21 + (!cable2 ? cable_clip_offset(screw, cable1) / 2 : 0), 0]) {
|
translate([cable_clip_extent(screw, cable1, insert = insert, nut = nut) - clip_lengths[$i] / 2, 0]) {
|
||||||
insert = in([0, 3], i);
|
|
||||||
if($preview) {
|
if($preview) {
|
||||||
cable_clip_assembly(screw, sheet_thickness, cable1, cable2, insert = insert, flip = i == 1);
|
cable_clip_assembly(screw, sheet_thickness, cable1, cable2, insert = insert, nut = nut, flip = $i == 1);
|
||||||
|
|
||||||
for(j = [0 : 1])
|
for(j = [0 : 1])
|
||||||
let(cable = cables[2 * i + j])
|
let(cable = clips[$i][j])
|
||||||
if(cable)
|
if(cable)
|
||||||
let(positions = cable_bundle_positions(cable))
|
let(positions = cable_bundle_positions(cable))
|
||||||
for(i = [0 : len(positions) - 1])
|
for(i = [0 : len(positions) - 1])
|
||||||
let(p = positions[i])
|
let(p = positions[i])
|
||||||
translate([p.x + [-1, 1][j] * cable_clip_offset(screw, cable, insert = insert), 0, p.y])
|
translate([p.x + [-1, 1][j] * cable_clip_offset(screw, cable, insert = insert, nut = nut), 0, p.y])
|
||||||
rotate([90, 0, 0])
|
rotate([90, 0, 0])
|
||||||
color([grey(20), "blue", "red", "orange", "yellow", "green", "brown", "purple", "grey", "white"][i])
|
color([grey(20), "blue", "red", "orange", "yellow", "green", "brown", "purple", "grey", "white"][i])
|
||||||
cylinder(d = cable_wire_size(cable), h = 30, center = true);
|
cylinder(d = cable_wire_size(cable), h = 30, center = true);
|
||||||
|
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 128 KiB |
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 122 KiB |
Before Width: | Height: | Size: 244 KiB After Width: | Height: | Size: 245 KiB |
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 190 KiB |
BIN
tests/png/splines.png
Normal file
After Width: | Height: | Size: 46 KiB |
38
tests/splines.scad
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
//
|
||||||
|
// NopSCADlib Copyright Chris Palmer 2024
|
||||||
|
// 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 <https://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
include <../utils/core/core.scad>
|
||||||
|
|
||||||
|
use <../utils/splines.scad>
|
||||||
|
use <../utils/sweep.scad>
|
||||||
|
|
||||||
|
points = [[0, 1.5], [2, 2], [3, 1], [4, -2], [5, 1], [6, 2], [7, 3]];
|
||||||
|
|
||||||
|
module splines() {
|
||||||
|
cm_spline = catmull_rom_spline(points, 100 / len(points), 0.5);
|
||||||
|
color("green") show_path(cm_spline, 0.01);
|
||||||
|
|
||||||
|
cu_spline = cubic_spline(points, 100);
|
||||||
|
color("blue") show_path(cu_spline, 0.01);
|
||||||
|
|
||||||
|
for(p = points)
|
||||||
|
translate(p) color("red")
|
||||||
|
cylinder($fn = 64, r = 0.03, h = 0.02, center = true);
|
||||||
|
}
|
||||||
|
|
||||||
|
rotate([70, 0, 315]) splines();
|
101
utils/splines.scad
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
//
|
||||||
|
// NopSCADlib Copyright Chris Palmer 2024
|
||||||
|
// 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 <https://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
//! Cubic splines that interpolate between a list of 2D points passing through all of them.
|
||||||
|
//! Translated from the Python version at <https://community.alteryx.com/t5/Engine-Works/Creating-a-Cubic-Spline-in-Python-and-Alteryx/ba-p/581173>.
|
||||||
|
//! Note the x values of the points must be strictly increasing.
|
||||||
|
//!
|
||||||
|
//! Catmull-Rom splines are well behaved but the ends points are control points and the curve only goes from the second point to the penultimate point.
|
||||||
|
//! Coded from <https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline#Code_example_in_Python>.
|
||||||
|
//! No restrictions on points and they can be 3D.
|
||||||
|
//
|
||||||
|
include <../utils/core/core.scad>
|
||||||
|
|
||||||
|
use <maths.scad>
|
||||||
|
use <sweep.scad>
|
||||||
|
|
||||||
|
function cubic_spline(points, N = 100) = let( //! Interpolate the list of points given to produce N points on a cubic spline that passes through points given.
|
||||||
|
N = N - 1,
|
||||||
|
n = len(points),
|
||||||
|
ass1 = assert(n >= 3, "must be at least 3 points")0,
|
||||||
|
|
||||||
|
dx = [for(i = [0 : n - 2]) points[i + 1].x - points[i].x], // x deltas
|
||||||
|
ass2 = assert(min(dx) > 0, "X must strictly increase")0,
|
||||||
|
|
||||||
|
//
|
||||||
|
// A and C are diagonals above and below the main diagonal B, which is all 2's
|
||||||
|
//
|
||||||
|
A = [for(i = [0 : n - 3]) dx[i] / (dx[i] + dx[i + 1]), 0],
|
||||||
|
C = [0, for(i = [0 : n - 3]) dx[i + 1] / (dx[i] + dx[i + 1]), 0],
|
||||||
|
//
|
||||||
|
// D are the target values on the right hand side of the equation
|
||||||
|
//
|
||||||
|
D = [0, for(i = [1 : n - 2]) 6 * ((points[i + 1].y - points[i].y) / dx[i] - (points[i].y - points[i - 1].y) / dx[i - 1]) / (dx[i] + dx[i - 1]), 0],
|
||||||
|
//
|
||||||
|
// Solve the tridiagonal equation using the Thomas algorithm
|
||||||
|
//
|
||||||
|
c = [for(i = 1, c = 0; i < n; c = C[i] / (2 - c * A[i - 1]), i = i + 1) c, 0],
|
||||||
|
d = [for(i = 1, d = 0; i < n; d = (D[i] - d * A[i - 1]) / (2 - c[i - 1] * A[i - 1]), i = i + 1) d, 0],
|
||||||
|
M = [for(i = n - 2, x = 0; i >= 0; x = d[i] - c[i] * x, i = i - 1) x, 0],
|
||||||
|
//
|
||||||
|
// Calculate the coefficients of each cubic curve
|
||||||
|
//
|
||||||
|
coefficients = [for(i = [0 : n - 2], dx2 = sqr(dx[i]), j = n - 1 - i)
|
||||||
|
[(M[j - 1] - M[j]) * dx2 / 6,
|
||||||
|
M[j] * dx2 / 2,
|
||||||
|
points[i + 1].y - points[i].y - (M[j - 1] + 2 * M[j]) * dx2 / 6,
|
||||||
|
points[i].y]
|
||||||
|
],
|
||||||
|
//
|
||||||
|
// Use the coefficients to interpolate between the points
|
||||||
|
//
|
||||||
|
x0 = points[0].x,
|
||||||
|
x1 = points[n - 1].x,
|
||||||
|
spline = [for(i = 0, j = 0, z = 0, x = x0; i <= N + 1;
|
||||||
|
x = x0 + (x1 - x0) * i / N,
|
||||||
|
j = i < N - 1 && x > points[j + 1].x ? j + 1 : j,
|
||||||
|
z = (x - points[j].x) / dx[j],
|
||||||
|
i = i + 1,
|
||||||
|
C = coefficients[j]
|
||||||
|
) if(i) [x, (((C[0] * z) + C[1]) * z + C[2]) * z + C[3]]
|
||||||
|
]
|
||||||
|
) spline;
|
||||||
|
|
||||||
|
function tj(ti, pi, pj, alpha = 0.5) = ti + pow(norm(pi - pj), alpha);
|
||||||
|
|
||||||
|
function catmull_rom_segment(P0, P1, P2, P3, n, alpha = 0.5, last = false) = let(
|
||||||
|
t0 = 0,
|
||||||
|
t1 = tj(t0, P0, P1, alpha),
|
||||||
|
t2 = tj(t1, P1, P2, alpha),
|
||||||
|
t3 = tj(t2, P2, P3, alpha),
|
||||||
|
end = last ? n : n - 1,
|
||||||
|
points = [for(i = [0 : end], t = t1 + (t2 - t1) * i / n) let(
|
||||||
|
A1 = (t1 - t) / (t1 - t0) * P0 + (t - t0) / (t1 - t0) * P1,
|
||||||
|
A2 = (t2 - t) / (t2 - t1) * P1 + (t - t1) / (t2 - t1) * P2,
|
||||||
|
A3 = (t3 - t) / (t3 - t2) * P2 + (t - t2) / (t3 - t2) * P3,
|
||||||
|
B1 = (t2 - t) / (t2 - t0) * A1 + (t - t0) / (t2 - t0) * A2,
|
||||||
|
B2 = (t3 - t) / (t3 - t1) * A2 + (t - t1) / (t3 - t1) * A3
|
||||||
|
) (t2 - t) / (t2 - t1) * B1 + (t - t1) / (t2 - t1) * B2],
|
||||||
|
) points;
|
||||||
|
|
||||||
|
|
||||||
|
function catmull_rom_spline(points, n, alpha = 0.5) = let( //! Interpolate n new points between the specified points with a Catmull-Rom spline, alpha = 0.5 for centripetal, 0 for uniform and 1 for chordal.
|
||||||
|
segs = len(points) - 3
|
||||||
|
) [for(i = [0 : segs - 1]) each catmull_rom_segment(points[i], points[i + 1], points[i + 2], points[i + 3], n, alpha, last = i == segs - 1)];
|
@@ -111,7 +111,7 @@ function helical_twist_per_segment(r, pitch, sides) = //! Calculate the twist ar
|
|||||||
//
|
//
|
||||||
// Generate all the transforms for the profile of the swept volume.
|
// Generate all the transforms for the profile of the swept volume.
|
||||||
//
|
//
|
||||||
function sweep_transforms(path, loop = false, twist = 0) =
|
function sweep_transforms(path, loop = false, twist = 0, initial_rotation = undef) =
|
||||||
let(len = len(path),
|
let(len = len(path),
|
||||||
last = len - 1,
|
last = len - 1,
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ function sweep_transforms(path, loop = false, twist = 0) =
|
|||||||
lengths = [for(i = 0, t = 0; i < len; t = t + norm(path[min(i + 1, last)] - path[i]), i = i + 1) t],
|
lengths = [for(i = 0, t = 0; i < len; t = t + norm(path[min(i + 1, last)] - path[i]), i = i + 1) t],
|
||||||
length = lengths[last],
|
length = lengths[last],
|
||||||
|
|
||||||
rotations = [for(i = 0, rot = fs_frame(tangents);
|
rotations = [for(i = 0, rot = is_undef(initial_rotation) ? fs_frame(tangents) : rot3_z(initial_rotation);
|
||||||
i < len;
|
i < len;
|
||||||
i = i + 1,
|
i = i + 1,
|
||||||
rot = i < len ? rotate_from_to(tangents[i - 1], tangents[i]) * rot : undef) rot],
|
rot = i < len ? rotate_from_to(tangents[i - 1], tangents[i]) * rot : undef) rot],
|
||||||
@@ -169,7 +169,7 @@ function sweep(path, profile, loop = false, twist = 0) = //! Generate the point
|
|||||||
points = skin_points(profile, path, loop, twist),
|
points = skin_points(profile, path, loop, twist),
|
||||||
skin_faces = skin_faces(points, npoints, facets, loop),
|
skin_faces = skin_faces(points, npoints, facets, loop),
|
||||||
faces = loop ? skin_faces : concat([cap(facets)], skin_faces, [cap(facets, npoints - 1)])
|
faces = loop ? skin_faces : concat([cap(facets)], skin_faces, [cap(facets, npoints - 1)])
|
||||||
) [points, faces];
|
) [points, faces];
|
||||||
|
|
||||||
module sweep(path, profile, loop = false, twist = 0, convexity = 1) { //! Draw a polyhedron that is the swept volume
|
module sweep(path, profile, loop = false, twist = 0, convexity = 1) { //! Draw a polyhedron that is the swept volume
|
||||||
mesh = sweep(path, profile, loop, twist);
|
mesh = sweep(path, profile, loop, twist);
|
||||||
@@ -229,16 +229,20 @@ function rounded_path(path) = //! Convert a rounded_path, consisting of a start
|
|||||||
|
|
||||||
function segmented_path(path, min_segment) = [ //! Add points to a path to enforce a minimum segment length
|
function segmented_path(path, min_segment) = [ //! Add points to a path to enforce a minimum segment length
|
||||||
for(i = [0 : len(path) - 2])
|
for(i = [0 : len(path) - 2])
|
||||||
let(delta =
|
let(delta =
|
||||||
assert(path[i] != path[i + 1], str("Coincident points at path[", i, "] = ", path[i]))
|
assert(path[i] != path[i + 1], str("Coincident points at path[", i, "] = ", path[i]))
|
||||||
path[i+1] - path[i],
|
path[i+1] - path[i],
|
||||||
segs = ceil(norm(delta) / min_segment)
|
segs = ceil(norm(delta) / min_segment)
|
||||||
)
|
)
|
||||||
for(j = [0 : segs - 1])
|
for(j = [0 : segs - 1])
|
||||||
path[i] + delta * j / segs, // Linear interpolation
|
path[i] + delta * j / segs, // Linear interpolation
|
||||||
path[len(path) - 1]
|
path[len(path) - 1]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
function offset_paths(path, offsets, twists = 0) = let( //! Create new paths offset from the original, optionally spiralling around it
|
||||||
|
transforms = sweep_transforms(path, twist = 360 * twists, initial_rotation = 0)
|
||||||
|
) [for(o = offsets) let(initial = [o.x, o.y, o.z, 1]) [for(t = transforms) initial * t]];
|
||||||
|
|
||||||
function spiral_paths(path, n, r, twists, start_angle) = let( //! Create a new paths which spiral around the given path. Use for making twisted cables
|
function spiral_paths(path, n, r, twists, start_angle) = let( //! Create a new paths which spiral around the given path. Use for making twisted cables
|
||||||
segment = twists ? path_length(path) / twists / r2sides(2 * r) : inf,
|
segment = twists ? path_length(path) / twists / r2sides(2 * r) : inf,
|
||||||
transforms = sweep_transforms(segmented_path(path, segment), twist = 360 * twists)
|
transforms = sweep_transforms(segmented_path(path, segment), twist = 360 * twists)
|
||||||
@@ -246,16 +250,16 @@ function spiral_paths(path, n, r, twists, start_angle) = let( //! Create a new p
|
|||||||
|
|
||||||
function rounded_path_vertices(path) = [path[0], for(i = [1 : 2 : len(path) - 1]) path[i]]; //! Show the unrounded version of a rounded_path for debug
|
function rounded_path_vertices(path) = [path[0], for(i = [1 : 2 : len(path) - 1]) path[i]]; //! Show the unrounded version of a rounded_path for debug
|
||||||
|
|
||||||
module show_path(path) //! Show a path using a chain of hulls for debugging, duplicate points are highlighted.
|
module show_path(path, r = 0.1) //! Show a path using a chain of hulls for debugging, duplicate points are highlighted.
|
||||||
for(i = [0 : len(path) - 2]) {
|
for(i = [0 : len(path) - 2]) {
|
||||||
hull($fn = 16) {
|
hull($fn = 16) {
|
||||||
translate(path[i])
|
translate(path[i])
|
||||||
sphere(0.1);
|
sphere(r);
|
||||||
|
|
||||||
translate(path[i + 1])
|
translate(path[i + 1])
|
||||||
sphere(0.1);
|
sphere(r);
|
||||||
}
|
}
|
||||||
if(path[i] == path[i + 1])
|
if(path[i] == path[i + 1])
|
||||||
translate(path[i])
|
translate(path[i])
|
||||||
color("red") sphere(1);
|
color("red") sphere($fn = 16, r * 4);
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ include <washers.scad>
|
|||||||
//
|
//
|
||||||
// Nuts
|
// Nuts
|
||||||
//
|
//
|
||||||
M2_nut_trap_depth = 2.5;
|
M2_nut_trap_depth = 1.75;
|
||||||
M2p5_nut_trap_depth = 2.5;
|
M2p5_nut_trap_depth = 2.5;
|
||||||
M3_nut_trap_depth = 3;
|
M3_nut_trap_depth = 3;
|
||||||
M4_nut_trap_depth = 4;
|
M4_nut_trap_depth = 4;
|
||||||
|
@@ -760,9 +760,15 @@ ZC_A0591 = ["ZC_A0591", "ZC-A0591 ULN2003 driver PCB", 35, 32, 1.6, 0, 2.5, 0, "
|
|||||||
], [], [], [], M2p5_pan_screw];
|
], [], [], [], M2p5_pan_screw];
|
||||||
|
|
||||||
|
|
||||||
MT3608 = ["MT3608", "MT3608 boost converter module", 37, 17, 1.2, 2, 1.5, [5, 3], "#2140BE", false, [[3.0725, 5.095], [3.0725, -5.095], [-3.0725, 5.095], [-3.0725, -5.095]],
|
MT3608 = ["MT3608", "MT3608 boost converter module", 37, 17, 1.2, 2, 1.5, [5, 3], "#2140BE", false,
|
||||||
[ [-12.05 , -6.8, 180, "trimpot10"]
|
[[3.0725, 5.095], [3.0725, -5.095], [-3.0725, 5.095], [-3.0725, -5.095]],
|
||||||
]];
|
[[-12.05 , -6.8, 180, "trimpot10"],
|
||||||
|
[-24.05 , 13.8, 90, "smd_soic", SOT23_6, "B628"],
|
||||||
|
[-12.3, -14.4, 0, "smd_diode",DO214AC, "SS34"],
|
||||||
|
[-28.5, 13.2, 90,"smd_cap", CAP1206, 0.5],
|
||||||
|
[-20, 13.2, 90,"smd_cap", CAP1206, 0.5],
|
||||||
|
[-24.05 , -11.8, 180, "smd_inductor", CDRH104, "220"]]
|
||||||
|
];
|
||||||
|
|
||||||
HW803_1WAY_RELAY = [
|
HW803_1WAY_RELAY = [
|
||||||
"HW803_1WAY_RELAY", "HW-803 5V 1 way relay module",
|
"HW803_1WAY_RELAY", "HW-803 5V 1 way relay module",
|
||||||
|
@@ -70,8 +70,9 @@ TANT_C = ["TANT_C", [5.8, 3.2, 2.6], 0.1, 1.3, [6.0, 2.2, 0.08, 2.9], ["#E9D769
|
|||||||
smd_tants = [TANT_A, TANT_B, TANT_C];
|
smd_tants = [TANT_A, TANT_B, TANT_C];
|
||||||
|
|
||||||
IND2525 = ["IND2525", [6.75, 6.75, 2], 0.1, 1.75, [7.24, 3.2, 0.15, 4.4], grey(50)];
|
IND2525 = ["IND2525", [6.75, 6.75, 2], 0.1, 1.75, [7.24, 3.2, 0.15, 4.4], grey(50)];
|
||||||
|
CDRH104 = ["CDRH104", [10.3, 10.3, 4.0], 0.1, 3.85, [10.5, 3.2, 0.15, 4.4], grey(50)];
|
||||||
|
|
||||||
smd_inductors = [IND2525];
|
smd_inductors = [IND2525, CDRH104];
|
||||||
|
|
||||||
TC33X1 = ["TC33X1", [3.0, 3.8, 0.5], [0.95, 0.9, 0.88, 1.5, 0.2, 0.75],[3.0, 0.1, 0.2, 1.2, 1.7, 1.2, 1, 0.5], [2.1, 0.5], 1.5];
|
TC33X1 = ["TC33X1", [3.0, 3.8, 0.5], [0.95, 0.9, 0.88, 1.5, 0.2, 0.75],[3.0, 0.1, 0.2, 1.2, 1.7, 1.2, 1, 0.5], [2.1, 0.5], 1.5];
|
||||||
|
|
||||||
|
@@ -18,10 +18,11 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
//! Tubing and sleeving. The internal diameter can be forced to stretch it over something.
|
//! Tubing and sleeving. The internal diameter can be forced to stretch it over something. A path can be specified, otherwise it is just straight with the specified length.
|
||||||
//
|
//
|
||||||
include <../utils/core/core.scad>
|
include <../utils/core/core.scad>
|
||||||
include <../utils/tube.scad>
|
include <../utils/tube.scad>
|
||||||
|
include <../utils/sweep.scad>
|
||||||
|
|
||||||
function tubing_material(type) = type[1]; //! Material description
|
function tubing_material(type) = type[1]; //! Material description
|
||||||
function tubing_od(type) = type[2]; //! Outside diameter
|
function tubing_od(type) = type[2]; //! Outside diameter
|
||||||
@@ -31,11 +32,12 @@ function tubing_colour(type) = type[4]; //! Colour
|
|||||||
function tubing_or(type) = tubing_od(type) / 2; //! Outside radius
|
function tubing_or(type) = tubing_od(type) / 2; //! Outside radius
|
||||||
function tubing_ir(type) = tubing_id(type) / 2; //! Inside radius
|
function tubing_ir(type) = tubing_id(type) / 2; //! Inside radius
|
||||||
|
|
||||||
module tubing(type, length = 15, forced_id = 0, center = true) { //! Draw specified tubing with optional forced internal diameter
|
module tubing(type, length = 15, forced_id = 0, center = true, path = []) { //! Draw specified tubing with optional forced internal diameter and optional path.
|
||||||
original_od = tubing_od(type);
|
original_od = tubing_od(type);
|
||||||
original_id = tubing_id(type);
|
original_id = tubing_id(type);
|
||||||
id = forced_id ? forced_id : original_id;
|
id = forced_id ? forced_id : original_id;
|
||||||
od = original_od + id - original_id;
|
od = original_od + id - original_id;
|
||||||
|
length = path ? round(path_length(path)) : length;
|
||||||
if(tubing_material(type) == "Heatshrink sleeving")
|
if(tubing_material(type) == "Heatshrink sleeving")
|
||||||
vitamin(str("tubing(", type[0], arg(length, 15), "): ", tubing_material(type), " ID ", original_id, "mm x ",length, "mm"));
|
vitamin(str("tubing(", type[0], arg(length, 15), "): ", tubing_material(type), " ID ", original_id, "mm x ",length, "mm"));
|
||||||
else
|
else
|
||||||
@@ -45,9 +47,19 @@ module tubing(type, length = 15, forced_id = 0, center = true) { //! Draw specif
|
|||||||
woven_tube(od / 2, id /2, center = center, length, colour = tubing_colour(type));
|
woven_tube(od / 2, id /2, center = center, length, colour = tubing_colour(type));
|
||||||
else
|
else
|
||||||
color(tubing_colour(type))
|
color(tubing_colour(type))
|
||||||
linear_extrude(length, center = center, convexity = 4)
|
if(path)
|
||||||
difference() {
|
render_if(manifold)
|
||||||
circle(d = od);
|
difference() {
|
||||||
circle(d = id);
|
sweep(path, circle_points(od / 2));
|
||||||
}
|
start = path[0] - eps * unit(path[1] - path[0]);
|
||||||
|
n = len(path) - 1;
|
||||||
|
end = path[n] + eps * unit(path[n] - path[n - 1]);
|
||||||
|
sweep(concat([start], path, [end]), circle_points(id / 2));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
linear_extrude(length, center = center, convexity = 4)
|
||||||
|
difference() {
|
||||||
|
circle(d = od);
|
||||||
|
circle(d = id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
//! If a washer is given a child, usually a screw or a nut, then it is placed on its top surface.
|
//! If a washer is given a child, usually a screw or a nut, then it is placed on its top surface.
|
||||||
//
|
//
|
||||||
include <../utils/core/core.scad>
|
include <../utils/core/core.scad>
|
||||||
include <../utils/sweep.scad>
|
use <../utils/sweep.scad>
|
||||||
|
|
||||||
soft_washer_colour = grey(20);
|
soft_washer_colour = grey(20);
|
||||||
hard_washer_colour = grey(85);
|
hard_washer_colour = grey(85);
|
||||||
|