Skip to content

Instantly share code, notes, and snippets.

@Simon-Laux
Last active September 24, 2016 20:49
Show Gist options
  • Save Simon-Laux/6ca935aa2c4404e8423d32646bd59598 to your computer and use it in GitHub Desktop.
Save Simon-Laux/6ca935aa2c4404e8423d32646bd59598 to your computer and use it in GitHub Desktop.
OpenSCAD bevelcube module
Description:
Maybe someone can use this for somthing...
Usage:
bevelcube(x,y,z,insert);
cube dimension | x,y,z | (without the bevel factor, which will add 2x its amount to each axis)
bevel factor | insert
module bevelcube(x,y,z,insert){
Cubepoints=[[insert,0,insert],//Fläche 1 front
[insert+x,0,insert],
[insert+x,0,insert+z],
[insert,0,insert+z],
[insert,y+insert*2,insert],//Fläche 2 hinten
[insert+x,y+insert*2,insert],
[insert+x,y+insert*2,insert+z],
[insert,y+insert*2,insert+z],//Fläche 3 unten
[insert+x,insert,0],
[insert+x,y+insert,0],
[insert,y+insert,0],
[insert,insert,0],//Fläche 4 oben
[insert+x,insert,z+insert*2],
[insert+x,y+insert,z+insert*2],
[insert,y+insert,z+insert*2],
[insert,insert,z+insert*2],//Fläche 5 links
[0,insert,insert],
[0,insert,insert+z],
[0,insert+y,insert+z],
[0,insert+y,insert],//Fläche 6 rechts
[x+insert*2,insert,insert],
[x+insert*2,insert,insert+z],
[x+insert*2,insert+y,insert+z],
[x+insert*2,insert+y,insert]
];
CubeFaces=[
[0,1,2,3], //F1 front
[4,5,6,7], //F2 back
[8,9,10,11], //F3 bottom
[12,13,14,15],//F4 up
[16,17,18,19],//F5 left
[20,21,22,23],//F6 right
[11,0,1,8], //F1+F3
[12,2,3,15], //F1+F4
[13,6,7,14], //F4+F2
[10,4,5,9], //F2+F3
[0,16,17,3], //F1+F5
[1,20,21,2], //F1+F6
[4,19,18,7], //F2+F5
[5,23,22,6], //F2+F6
[11,16,19,10],//F3+F5
[8,20,23,9], //F3+F6
[15,17,18,14],//F4+F5
[12,21,22,13],//F4+F6
[0,11,16], //F1+F3+F5
[1,8,20], //F1+F3+F6
[2,12,21], //F1+F4+F5
[3,15,17], //F1+F4+F6
[4,10,19], //F2+F3+F5
[5,9,23], //F2+F3+F6
[6,13,22], //F2+F4+F5w
[7,14,18] //F2+F4+F6w
];
polyhedron(Cubepoints,CubeFaces);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment