Last active
December 10, 2015 12:08
-
-
Save jwygralak67/4431721 to your computer and use it in GitHub Desktop.
Playing with parametric gears in CoffeeScad
This file contains 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
class Tooth | |
constructor: ()-> | |
@csg = new Cylinder | |
r: 1 | |
h: 1 | |
center: true | |
@csg = @csg.scale [1,2.5,1] | |
class Gear | |
constructor: (@numTeeth) -> | |
@pitchAngle = 360 / @numTeeth | |
teeth=[] | |
@dia = 4 * @numTeeth / 3.1415 | |
for angle in [0..359] by @pitchAngle | |
t = new Tooth | |
teeth.push(t.csg.translate([0,@dia/2-1.5,0]).rotate([0,0,-angle])) | |
c1 = new Cylinder | |
d: @dia-3 | |
h: 1 | |
center: true | |
c2 = new Cylinder | |
d: @dia+1.75 | |
h: 1 | |
center: true | |
@csg = c1.union(teeth) | |
@csg = @csg.intersect(c2) | |
g1 = new Gear 10 | |
g1.csg = g1.csg.rotate([0,0,g1.pitchAngle/2]) | |
g1.csg = g1.csg.translate([-g1.dia/2,0,0]) | |
g2 = new Gear 30 | |
g2.csg = g2.csg.translate([g2.dia/2,0,0]) | |
return g1.csg.union(g2.csg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment