-
-
Save Octogonapus/39627229040b15ee43c70ae613d0698d to your computer and use it in GitHub Desktop.
slice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CSG motor = Vitamins.get("hobbyServo", "standardMicro") | |
// Vitamins.get("hobbyServo", "standardMicro") Vitamins.get("stepperMotor", "GenericNEMA14") Vitamins.get("roundMotor", "WPI-gb37y3530-50en") | |
CSG motorShaft = Vitamins.get("hobbyServoHorn", "standardMicro1") | |
// Vitamins.get("hobbyServoHorn", "standardMicro1") Vitamins.get("dShaft", "5mm") Vitamins.get("dShaft", "WPI-gb37y3530-50en") | |
double pitch = 3.0 | |
double thickness = 10.0 | |
double gearDiameter = 30.0 | |
double gearTeeth = (gearDiameter * Math.PI) / pitch | |
def gearGenResult = ScriptingEngine.gitScriptRun( | |
"https://github.com/madhephaestus/GearGenerator.git", | |
"bevelGear.groovy", | |
[gearTeeth, gearTeeth, thickness, pitch] | |
) | |
CSG gearL = gearGenResult[0] | |
CSG gearR = gearGenResult[1] | |
double gearSeparationDistance = gearGenResult[2] | |
CSG base = new Cube( | |
gearL.totalX, | |
gearL.totalY + gearR.totalY, | |
motor.totalZ | |
).toCSG() | |
base = base.movey(-base.maxY/2) | |
// Put the thrust bearing in | |
CSG thrustBearing = Vitamins.get("ballBearing", "Thrust_1andAHalfinch") | |
thrustBearing = thrustBearing.toZMin().movez(base.maxZ - thrustBearing.totalZ + 0.5) | |
base = base.difference(thrustBearing.hull()) | |
// Cut a path for the bolt to be inserted | |
double baseBoltKeepawayRadius = 5 | |
CSG boltKeepaway = new Cylinder(baseBoltKeepawayRadius, 10000).toCSG() | |
boltKeepaway = boltKeepaway.toZMax().movez(thrustBearing.minZ - 5) | |
base = base.difference(boltKeepaway) | |
// Cut a path for the bolt threads | |
CSG bolt = Vitamins.get("capScrew", "M5x25") | |
bolt = bolt.rotx(180).movez(boltKeepaway.maxZ) | |
base = base.difference(bolt) | |
// Add gears | |
gearL = gearL.toZMin().movez(thrustBearing.maxZ) | |
double meshDistance = 1.0 | |
gearR = gearR.toZMin().movez(thrustBearing.maxZ).movey(gearSeparationDistance)//.movey(-(gearR.maxY - gearL.minY) + meshDistance) | |
// Cut a pat h for the bolt threads through gearL | |
gearL = gearL.difference(bolt) | |
// Add a bearing flush with the gear for the nut to sit on | |
CSG nutBearing = Vitamins.get("ballBearing", "695zz") | |
nutBearing = nutBearing.toZMin().movez(gearL.maxZ - nutBearing.totalZ) | |
gearL = gearL.difference(nutBearing) | |
// Add a nut for the bolt | |
CSG nut = Vitamins.get("lockNut", "M5") | |
nut = nut.movez(gearL.maxZ) | |
// Add the motor | |
double motorBracketThickness = motor.maxZ | |
motor = motor.toZMax().movey(gearR.centerY).movez(base.maxZ) | |
base = base.difference(motor) | |
// Add the motor's shaft | |
motorShaft = motorShaft.movey(gearR.centerY).movez(base.maxZ) | |
gearR = gearR.difference(motorShaft) | |
//CSG assembly = CSG.unionAll([base, thrustBearing, bolt, nut, gearL, gearR, nutBearing, motor, motorShaft]) | |
//assembly = assembly.toZMin() | |
//return assembly | |
return [base, thrustBearing, bolt, nut, gearL, gearR, nutBearing, motor, motorShaft] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment