Created
June 4, 2021 23:22
-
-
Save thehans/ca0ec0516c0b1b4af8ce2f580ef5ffc7 to your computer and use it in GitHub Desktop.
Different ways of mirroring in OpenSCAD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
independent = false; // Note: Independent mirroring of 2 axes is actually a rotation | |
fix111 = false; // Only relevant if independent=false | |
module thing(i,j,k) { | |
translate([2,2,2]) difference() { | |
cube(2,center=true); | |
linear_extrude(convexity=10) | |
text(text=str("M",i,j,k),size=0.5,valign="center",halign="center"); | |
} | |
} | |
if (independent) { | |
for(i=[0,1],j=[0,1],k=[0,1]) | |
mirror([i,0,0]) mirror([0,j,0]) mirror([0,0,k]) thing(i,j,k); | |
} else { | |
if (fix111) { | |
for(i=[0,1],j=[0,1],k=[0:1:2-i-j]) | |
mirror([i,j,k]) thing(i,j,k); | |
scale(-1) thing(1,1,1); // mirror through origin | |
} else { | |
for(i=[0,1],j=[0,1],k=[0,1]) | |
mirror([i,j,k]) thing(i,j,k); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment