mirror of
https://github.com/DJSundog/NopSCADlib.git
synced 2025-02-18 16:43:45 -05:00
Fixed drag_chains exploding when they shouldn't do.
This commit is contained in:
parent
07766d8cf0
commit
773a53829f
@ -250,9 +250,8 @@ module drag_chain_link(type, start = false, end = false) { //! One link of the c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! 1. Remove the support material from the links with side cutters.
|
// Need to use a wrapper because can't define nested modules in an assembly
|
||||||
//! 1. Clip the links together with the special ones at the ends.
|
module _drag_chain_assembly(type, pos = 0) {
|
||||||
module drag_chain_assembly(type, pos = 0) { //! Drag chain assembly
|
|
||||||
s = drag_chain_size(type);
|
s = drag_chain_size(type);
|
||||||
x = (1 + exploded()) * s.x;
|
x = (1 + exploded()) * s.x;
|
||||||
r = drag_chain_radius(type) * x / s.x;
|
r = drag_chain_radius(type) * x / s.x;
|
||||||
@ -287,22 +286,36 @@ module drag_chain_assembly(type, pos = 0) { //! Drag chain assembly
|
|||||||
screws = drag_chain_screw_lists(type);
|
screws = drag_chain_screw_lists(type);
|
||||||
custom_start = screws[0] == [0, 0, 0, 0];
|
custom_start = screws[0] == [0, 0, 0, 0];
|
||||||
custom_end = screws[1] == [0, 0, 0, 0];
|
custom_end = screws[1] == [0, 0, 0, 0];
|
||||||
assert($children == bool2int(custom_start) + bool2int(custom_end), "wrong number of children for end customisation");
|
assert($children == bool2int(custom_start) + bool2int(custom_end), str("wrong number of children for end customisation: ", $children));
|
||||||
assembly(str(drag_chain_name(type), "_drag_chain")) {
|
|
||||||
for(i = [0 : npoints - 2]) let(v = points[i+1] - points[i])
|
|
||||||
translate(points[i])
|
|
||||||
rotate([0, -atan2(v.z, v.x), 0])
|
|
||||||
link(i);
|
|
||||||
|
|
||||||
translate(points[0] - [x, 0, 0])
|
for(i = [0 : npoints - 2]) let(v = points[i+1] - points[i])
|
||||||
link(-1)
|
translate(points[i])
|
||||||
if(custom_start)
|
rotate([0, -atan2(v.z, v.x), 0])
|
||||||
children(0);
|
link(i);
|
||||||
|
|
||||||
translate(points[npoints - 1])
|
translate(points[0] - [x, 0, 0])
|
||||||
hflip()
|
link(-1)
|
||||||
link(npoints - 1)
|
if(custom_start)
|
||||||
if(custom_end)
|
children(0);
|
||||||
children(custom_start ? 1 : 0);
|
|
||||||
}
|
translate(points[npoints - 1])
|
||||||
|
hflip()
|
||||||
|
link(npoints - 1)
|
||||||
|
if(custom_end)
|
||||||
|
children(custom_start ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! 1. Remove the support material from the links with side cutters.
|
||||||
|
//! 1. Clip the links together with the special ones at the ends.
|
||||||
|
module drag_chain_assembly(type, pos = 0) //! Drag chain assembly
|
||||||
|
assembly(str(drag_chain_name(type), "_drag_chain"))
|
||||||
|
if($children == 2)
|
||||||
|
_drag_chain_assembly(type, pos) {
|
||||||
|
children(0);
|
||||||
|
children(1);
|
||||||
|
}
|
||||||
|
else if($children == 1)
|
||||||
|
_drag_chain_assembly(type, pos)
|
||||||
|
children(0);
|
||||||
|
else
|
||||||
|
_drag_chain_assembly(type, pos);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user