From 132b75bad1a9353df6d06411a04a6b4e9460e5f6 Mon Sep 17 00:00:00 2001 From: "Jan \"Yenya\" Kasprzak" Date: Wed, 1 Nov 2023 07:19:08 +0100 Subject: [PATCH] yenyalib --- yenyalib.scad | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 yenyalib.scad diff --git a/yenyalib.scad b/yenyalib.scad new file mode 100644 index 0000000..9c71534 --- /dev/null +++ b/yenyalib.scad @@ -0,0 +1,63 @@ + +module round_with() { + if ($preview) { + children([1:1:$children-1]); + } else { + minkowski() { + difference() { + children([1:1:$children-1]); + minkowski() { + difference() { + minkowski() { + children([1:1:$children-1]); + children(0); + } + children([1:1:$children-1]); + } + children(0); + } + } + children(0); + } + } +} + +module round_edges(r) { + round_with() { + sphere(r, $fn = 8); + children(); + } +} + +// deprecated +module tx(l) { translate([l, 0, 0]) children(); } +module ty(l) { translate([0, l, 0]) children(); } +module tz(l) { translate([0, 0, l]) children(); } + +module rx(a) { rotate([a, 0, 0]) children(); } +module ry(a) { rotate([0, a, 0]) children(); } +module rz(a) { rotate([0, 0, a]) children(); } + +module sx(a) { scale([a, 1, 1]) children(); } +module sy(a) { scale([1, a, 1]) children(); } +module sz(a) { scale([1, 1, a]) children(); } + +// capital letters are ugly, but more visible in short identifiers +module Tx(l) { translate([l, 0, 0]) children(); } +module Ty(l) { translate([0, l, 0]) children(); } +module Tz(l) { translate([0, 0, l]) children(); } + +module Rx(a) { rotate([a, 0, 0]) children(); } +module Ry(a) { rotate([0, a, 0]) children(); } +module Rz(a) { rotate([0, 0, a]) children(); } + +module Sx(a) { scale([a, 1, 1]) children(); } +module Sy(a) { scale([1, a, 1]) children(); } +module Sz(a) { scale([1, 1, a]) children(); } + +module Mx() { for (s = [-1, 1]) Sx(s) children(); } +module My() { for (s = [-1, 1]) Sy(s) children(); } +module Mz() { for (s = [-1, 1]) Sz(s) children(); } + +eps = 0.01; +infty = 100; -- 2.43.0