From 25dceee20a15411a2d74dfd9faf2c6e7bb0b9ae0 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Fri, 20 Nov 2020 08:46:17 +0000 Subject: [PATCH] Made hflip and vflip conditional. --- tests/belts.scad | 2 +- utils/core/global.scad | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/belts.scad b/tests/belts.scad index a76d2c1..9894386 100644 --- a/tests/belts.scad +++ b/tests/belts.scad @@ -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); diff --git a/utils/core/global.scad b/utils/core/global.scad index 2a2bbeb..c67cbff 100644 --- a/utils/core/global.scad +++ b/utils/core/global.scad @@ -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° flip around the X axis -module hflip() rotate([0, 180, 0]) children(); //! Invert children by doing a 180° flip around the Y 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(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 function slice_str(str, start, end, s ="") = start >= end ? s : slice_str(str, start + 1, end, str(s, str[start])); // Helper for slice()