Skip to content

Instantly share code, notes, and snippets.

@hrgdavor
Created November 21, 2019 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrgdavor/5c10d51c4c45b2bf6fdaab15c1961ae2 to your computer and use it in GitHub Desktop.
Save hrgdavor/5c10d51c4c45b2bf6fdaab15c1961ae2 to your computer and use it in GitHub Desktop.
var len = 200;
var off = 2.5;
function main() {
return shape().subtract(holes()).translate([-100,-25,0]);
// return
}
function shape(){
return prism(len,25,10).union([
prism(len,25,10).rotateZ(180).translate([len,60,0]),
cube([len,10,10]).translate([0,25,0])
]);
}
function holes(){
return cylinder({h:len+1,r:4.1, resolution:16}).rotateY(90).translate([0,25+off,4]).union([
cylinder({h:len+1,r:3, resolution:16}).rotateY(90).translate([0,34.5+off,3]),
cube([len+1,8.2,4]).translate([0,20.9+off,0]),
cube([len+1,6,3]).translate([0,31.5+off,0])
]);
}
function prism(l, w, h){
return polyhedron({
points:[
[0,0,0],
[l,0,0],
[l,w,0],
[0,w,0],
[0,w,h],
[l,w,h]
],
triangles:[
[0,1,2,3],
[5,4,3,2],
[0,4,5,1],
[0,3,4],
[5,2,1]
]
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment