Made hflip and vflip conditional.

This commit is contained in:
Martin Budden 2020-11-20 08:46:17 +00:00
parent d70ddf5359
commit 25dceee20a
2 changed files with 3 additions and 3 deletions

View File

@ -39,7 +39,7 @@ module belt_test() {
screw = find_screw(hs_cs_cap, pulley_bore(pulley));
insert = screw_insert(screw);
rotate([0, flip ? 180 : 0, 0]) {
hflip(flip) {
pulley_assembly(pulley);
translate_z(pulley_height(pulley) + pulley_offset(pulley) + screw_head_depth(screw, pulley_bore(pulley)))
screw(screw, 20);

View File

@ -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
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&deg; flip around the X axis
module hflip() rotate([0, 180, 0]) children(); //! Invert children by doing a 180&deg; flip around the Y axis
module vflip(flip=true) rotate([flip ? 180 : 0, 0, 0]) children(); //! Invert children by doing a 180&deg; flip around the X axis
module hflip(flip=true) rotate([0, flip ? 180: 0, 0]) children(); //! Invert children by doing a 180&deg; flip around the Y axis
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()