Skip to content

Instantly share code, notes, and snippets.

@Octogonapus
Last active December 9, 2017 23:49
Show Gist options
  • Save Octogonapus/402f8d0cb0992b221525e7b4872af32a to your computer and use it in GitHub Desktop.
Save Octogonapus/402f8d0cb0992b221525e7b4872af32a to your computer and use it in GitHub Desktop.
60t gear c channel mount
import com.neuronrobotics.bowlerstudio.vitamins.*;
double shaftWidth = 6.5, shaftLength = 20;
double startRadians = Math.toRadians(0), endRadians = Math.toRadians(90);
double startRadius = 0.7 * 25.4, endRadius = 13 * 25.4;
double screwHoleRadius = 4.4/2;
double mountThickness = 21.5;
CSG gear = Vitamins.get("vexGear", "HS60T").movez(-12.7/2);
CSG shaft = new Cube(shaftWidth, shaftWidth, shaftLength).toCSG();
CSG polygon = Extrude.points(new Vector3d(0, 0, 40),// This is the extrusion depth
new Vector3d(Math.cos(startRadians)*endRadius,Math.sin(startRadians)*endRadius),// All values after this are the points in the polygon
new Vector3d(Math.cos(endRadians)*endRadius,Math.sin(endRadians)*endRadius),// Bottom right corner
new Vector3d(Math.cos(endRadians)*startRadius,Math.sin(endRadians)*startRadius),// upper right corner
new Vector3d(Math.cos(startRadians)*startRadius,Math.sin(startRadians)*startRadius)// upper left corner
).movez(-20);
CSG center = new Cylinder(startRadius, startRadius, 12.86, 80).toCSG().movez(-12.86/2);
center = center.difference(shaft);
CSG mount = new RoundedCube(41, 11.5, mountThickness).cornerRadius(1.5).toCSG().movex(37);
CSG assembly = gear.difference(shaft).difference(polygon).union(center);
mount = mount.movez(-1 * (mount.getMinZ() - assembly.getMinZ()));
double mountCutHeight = mount.getMaxZ() - gear.getMaxZ();
CSG mountCut = new Cube(5, 13, mountCutHeight).toCSG().movex(18).movez(gear.getMaxZ() + mountCutHeight/2);
mount = mount.difference(mountCut);
assembly = assembly.union(mount);
CSG screwhole = new Cylinder(screwHoleRadius, screwHoleRadius, 100, 80).toCSG().movez(-50);
assembly = assembly.difference(screwhole.movex(12.7));
assembly = assembly.difference(screwhole.movex(-12.7));
assembly = assembly.difference(screwhole.movex(12.7*2));
assembly = assembly.difference(screwhole.movex(12.7*3));
assembly = assembly.difference(screwhole.movex(12.7*4));
return assembly;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment