Skip to content

Instantly share code, notes, and snippets.

@neomatrixcode
Forked from apua/cube_split.rst
Created September 29, 2018 16:57
Show Gist options
  • Save neomatrixcode/d52110647064ec4cb7aea5fc1211ff74 to your computer and use it in GitHub Desktop.
Save neomatrixcode/d52110647064ec4cb7aea5fc1211ff74 to your computer and use it in GitHub Desktop.
Cube Split
// https://openjscad.org/
function top() { return polyhedron({
points: [
[0,4,4],[1,3,4],[3,3,4],[3,1,4],[0,1,4],
[0,3,3],[1,3,3],[3,3,3],[3,1,3],[0,1,3],
],
triangles: [
[0,1,4],[1,3,4],[1,2,3],
[0,6,1],[0,5,6],[1,6,7],[1,7,2],[2,7,3],[3,7,8],
[3,8,9],[4,3,9],[4,9,5],[0,4,5],
[5,8,7],[5,9,8]
],
}); }
function bottom() { return polyhedron({
points: [
[0,4,1],[3,4,1],[3,1,1],[0,1,1],
[0,4,0],[4,4,0],[4,0,0],[0,0,0],
],
triangles: [
[0,1,2],[0,2,3],
[0,4,5],[0,5,1],[2,1,5],[2,5,6],[3,2,6],[3,6,7],[3,7,4],[3,4,0],
[4,6,5],[4,7,6],
],
}); }
function pillar() { return polyhedron({
points: [
[1,1,3],[3,3,3],[3,1,3],
[1,1,1],[2,2,2],[2,2,1],
[2,1,2],[3,1,1],
],
triangles: [
[0,1,2],
[0,3,1],[3,5,4],
[0,2,3],[3,6,7],
[1,4,2],[2,4,6],[4,5,6],[6,5,7],
[3,7,5],
],
}); }
function main() {
//return pillar().translate([-2,-2,0]).scale(10);
return union(top(), bottom(), pillar()).translate([-2,-2,0]).scale(10);
}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment