Skip to content

Instantly share code, notes, and snippets.

@gfwilliams
Created August 21, 2012 12:32
Show Gist options
  • Save gfwilliams/3415059 to your computer and use it in GitHub Desktop.
Save gfwilliams/3415059 to your computer and use it in GitHub Desktop.
/*OpenJsCad*/
// change me!
var holeDistance = 1;
var holeHeight = 0.5;
var bracket =
CSG.cube({ center: [0, 0, 0], radius : [1, 1, 0.1] }).union(
CSG.cube({ center: [0, 1, holeHeight/2 + 0.15], radius : [1, 0.1, holeHeight/2 + 0.25] }));
var holes =
CSG.cylinder({ start: [0, 0, -1], end: [0, 0, 1], radius: 0.4 }).union(
CSG.cylinder({ start: [-holeDistance/2.0, 0.5, holeHeight], end: [-0.5, 1.5, holeHeight], radius: 0.2 })).union(
CSG.cylinder({ start: [holeDistance/2.0, 0.5, holeHeight], end: [0.5, 1.5, holeHeight], radius: 0.2 }));
bracket.setColor(1, 1, 0);
holes.setColor(0, 0.5, 1);
//return bracket.union(holes);
return bracket.subtract(holes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment