aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2023-01-15 01:26:12 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2023-01-15 01:26:12 +0100
commit3a2f90b4c45055184221a64e35127398edf0a26d (patch)
tree6b642a43b1a229405fd843a085f3dcb428145ac5
parent67fa1c87b2fed7dd407b73d3e4286a60e66356c1 (diff)
downloadoscad_gridfinity-3a2f90b4c45055184221a64e35127398edf0a26d.tar.gz
helper functions
-rw-r--r--gridfinity.scad10
1 files changed, 10 insertions, 0 deletions
diff --git a/gridfinity.scad b/gridfinity.scad
index 2ebd8a1..31ba3c9 100644
--- a/gridfinity.scad
+++ b/gridfinity.scad
@@ -9,6 +9,16 @@ rounding = 3.75;
minimal_thickness = 1.5;
+// Get top of GridFinity object from GF units
+function gf_top(units_z) =
+ max(units_z * height - 4.75, minimal_thickness) + 4.75;
+
+// Get center of GridFinity object
+function gf_center(units_x, units_y) = [
+ (units_x * width - 0.5) / 2 - width/2,
+ (units_y * width - 0.5) / 2 - width/2
+];
+
module rounding(r,angle) {
rotate(angle,[0,0,1])
translate([-r + 0.01, -r + 0.01])