-
-
Save pocomane/92a9cdd2027de35c62db56cdccbbc42e to your computer and use it in GitHub Desktop.
workaround to linear extrude a 3d object
This file contains 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
module inclinate(direction = [0, 0, 1]){ | |
a = norm([direction[0], direction[1], direction[2]]); | |
b = acos(direction[2]/a); | |
c = atan2(direction[1], direction[0]); | |
rotate([0, b, c]) union() { | |
children(); | |
} | |
} | |
module extrude_3d(length, direction){ | |
minkowski(){ | |
inclinate(direction) cube([1e-300,1e-300,length]); | |
children(); | |
} | |
} | |
module usage_example(){ | |
extrude_3d(length = 10, direction = [1,0,0]){ | |
union(){ | |
cube(center=true,[1,1,1]); | |
cube(center=true,[0.5,0.5,10]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment