Skip to content

Instantly share code, notes, and snippets.

@Octogonapus
Created December 29, 2017 21:52
Show Gist options
  • Save Octogonapus/a5d739653e319263be6b1201bd6952e2 to your computer and use it in GitHub Desktop.
Save Octogonapus/a5d739653e319263be6b1201bd6952e2 to your computer and use it in GitHub Desktop.
getInsert
CSG getInsert(boolean isRound) {
CSG roundPart = new Cylinder(10/2, 10/2, 1.2, 80).toCSG();
CSG shaft = new Cube(6.4, 6.4, 5.15).toCSG();
CSG axleHole;
if (isRound) {
double diameter = Math.sqrt(Math.pow(3.1, 2) + Math.pow(3.1, 2));
axleHole = new Cylinder(diameter/2, diameter/2, 5.15, 80).toCSG();
} else {
axleHole = new Cube(3.1, 3.1, 5.15).toCSG();
}
return roundPart.union(shaft.toZMin()).difference(axleHole.toZMin());
}
return getInsert(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment