From 7129f0c875be04cf9ee0fb9818cb34fd03c6af6c Mon Sep 17 00:00:00 2001 From: Quinn Date: Fri, 7 Jan 2022 16:52:17 -0800 Subject: [PATCH] Add round gates library --- round_gates.scad | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 round_gates.scad diff --git a/round_gates.scad b/round_gates.scad new file mode 100644 index 0000000..06b7772 --- /dev/null +++ b/round_gates.scad @@ -0,0 +1,40 @@ +gate_height = 50; + +// ROUND GATES: CIR, OCTR, OCTNR +module pivot (throw, shaft_r) { + top_r = gate_height * tan(throw) + shaft_r; + cylinder(h = gate_height, r1 = shaft_r, r2 = top_r); +} + +module pivot_square (throw, shaft_r, throw_extend = 0) { + hull() { + rotate([0,throw,0]) + pivot(gate_height, throw_extend, shaft_r); + rotate([0,-throw,0]) + pivot(gate_height, throw_extend, shaft_r); + rotate([0,0,90]) { + rotate([0,throw,0]) + pivot(gate_height, throw_extend, shaft_r); + rotate([0,-throw,0]) + pivot(gate_height, throw_extend, shaft_r); + } + }; +} + +module cir_gate (throw, shaft_r) { + pivot(throw, shaft_r); +} +module octr_gate (throw, shaft_r) { + union(){ + rotate([0,0,45]) + pivot_square(throw, shaft_r); + pivot_square(throw, shaft_r); + } +}; +module octnr_gate (throw, shaft_r) { + union(){ + rotate([0,0,45]) + pivot_square(throw + 1, shaft_r, 1); + pivot_square(throw, shaft_r); + } +};