Skip to content

Instantly share code, notes, and snippets.

@pocomane
Created August 7, 2022 09:56
Show Gist options
  • Save pocomane/92a9cdd2027de35c62db56cdccbbc42e to your computer and use it in GitHub Desktop.
Save pocomane/92a9cdd2027de35c62db56cdccbbc42e to your computer and use it in GitHub Desktop.
workaround to linear extrude a 3d object
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