Merge branch 'martinbudden-conditional_flip'
This commit is contained in:
commit
1dbfafd366
|
@ -6057,11 +6057,11 @@ Global constants, functions and modules. This file is used directly or indirectl
|
||||||
| ```circle4n(r, d = undef)``` | Circle with multiple of 4 vertices |
|
| ```circle4n(r, d = undef)``` | Circle with multiple of 4 vertices |
|
||||||
| ```ellipse(xr, yr)``` | Draw an ellipse |
|
| ```ellipse(xr, yr)``` | Draw an ellipse |
|
||||||
| ```extrude_if(h, center = true)``` | Extrudes 2D object to 3D when ```h``` is nonzero, otherwise leaves it 2D |
|
| ```extrude_if(h, center = true)``` | Extrudes 2D object to 3D when ```h``` is nonzero, otherwise leaves it 2D |
|
||||||
| ```hflip()``` | Invert children by doing a 180° flip around the Y axis |
|
| ```hflip(flip=true)``` | Invert children by doing a 180° flip around the Y axis |
|
||||||
| ```right_triangle(width, height, h, center = true)``` | A right angled triangle with the 90° corner at the origin. 3D when ```h``` is nonzero, otherwise 2D |
|
| ```right_triangle(width, height, h, center = true)``` | A right angled triangle with the 90° corner at the origin. 3D when ```h``` is nonzero, otherwise 2D |
|
||||||
| ```semi_circle(r, d = undef)``` | A semi circle in the positive Y domain |
|
| ```semi_circle(r, d = undef)``` | A semi circle in the positive Y domain |
|
||||||
| ```translate_z(z)``` | Shortcut for Z only translations |
|
| ```translate_z(z)``` | Shortcut for Z only translations |
|
||||||
| ```vflip()``` | Invert children by doing a 180° flip around the X axis |
|
| ```vflip(flip=true)``` | Invert children by doing a 180° flip around the X axis |
|
||||||
|
|
||||||
![global](tests/png/global.png)
|
![global](tests/png/global.png)
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ module belt_test() {
|
||||||
screw = find_screw(hs_cs_cap, pulley_bore(pulley));
|
screw = find_screw(hs_cs_cap, pulley_bore(pulley));
|
||||||
insert = screw_insert(screw);
|
insert = screw_insert(screw);
|
||||||
|
|
||||||
rotate([0, flip ? 180 : 0, 0]) {
|
hflip(flip) {
|
||||||
pulley_assembly(pulley);
|
pulley_assembly(pulley);
|
||||||
translate_z(pulley_height(pulley) + pulley_offset(pulley) + screw_head_depth(screw, pulley_bore(pulley)))
|
translate_z(pulley_height(pulley) + pulley_offset(pulley) + screw_head_depth(screw, pulley_bore(pulley)))
|
||||||
screw(screw, 20);
|
screw(screw, 20);
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 106 KiB |
|
@ -39,8 +39,8 @@ function r2sides4n(r) = floor((r2sides(r) + 3) / 4) * 4;
|
||||||
function limit(x, min, max) = max(min(x, max), min); //! Force x in range min <= x <= max
|
function limit(x, min, max) = max(min(x, max), min); //! Force x in range min <= x <= max
|
||||||
|
|
||||||
module translate_z(z) translate([0, 0, z]) children(); //! Shortcut for Z only translations
|
module translate_z(z) translate([0, 0, z]) children(); //! Shortcut for Z only translations
|
||||||
module vflip() rotate([180, 0, 0]) children(); //! Invert children by doing a 180° flip around the X axis
|
module vflip(flip=true) rotate([flip ? 180 : 0, 0, 0]) children(); //! Invert children by doing a 180° flip around the X axis
|
||||||
module hflip() rotate([0, 180, 0]) children(); //! Invert children by doing a 180° flip around the Y axis
|
module hflip(flip=true) rotate([0, flip ? 180: 0, 0]) children(); //! Invert children by doing a 180° flip around the Y axis
|
||||||
module ellipse(xr, yr) scale([1, yr / xr]) circle4n(xr); //! Draw an ellipse
|
module ellipse(xr, yr) scale([1, yr / xr]) circle4n(xr); //! Draw an ellipse
|
||||||
|
|
||||||
function slice_str(str, start, end, s ="") = start >= end ? s : slice_str(str, start + 1, end, str(s, str[start])); // Helper for slice()
|
function slice_str(str, start, end, s ="") = start >= end ? s : slice_str(str, start + 1, end, str(s, str[start])); // Helper for slice()
|
||||||
|
|
Loading…
Reference in New Issue