-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jess Frazelle <github@jessfraz.com>
- Loading branch information
Showing
18 changed files
with
79,347 additions
and
79,221 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,112 @@ | ||
const part001 = startSketchAt([0.0000000000, 5.0000000000]) | ||
|> line([0.4900857016, -0.0240763666], %) | ||
|> line([0.6804562304, 0.9087880491], %) | ||
|> line([0.5711661314, -0.1430696680], %) | ||
|> line([0.1717090983, -1.1222443518], %) | ||
|> line([0.4435665223, -0.2097913408], %) | ||
|> line([0.9764377140, 0.5792113521], %) | ||
|> line([0.4729383069, -0.3507549536], %) | ||
|> line([-0.2708257990, -1.1025288142], %) | ||
|> line([0.3295183609, -0.3635674851], %) | ||
|> line([1.1237654070, 0.1614549773], %) | ||
|> line([0.3027099123, -0.5050409772], %) | ||
|> line([-0.6721299235, -0.9149632591], %) | ||
|> line([0.1653040161, -0.4619937756], %) | ||
|> line([1.1000100038, -0.2808814542], %) | ||
|> line([0.0863966776, -0.5824390901], %) | ||
|> line([-0.9711083600, -0.5881028420], %) | ||
|> line([-0.0240763666, -0.4900857016], %) | ||
|> line([0.9087880491, -0.6804562304], %) | ||
|> line([-0.1430696680, -0.5711661314], %) | ||
|> line([-1.1222443518, -0.1717090983], %) | ||
|> line([-0.2097913408, -0.4435665223], %) | ||
|> line([0.5792113521, -0.9764377140], %) | ||
|> line([-0.3507549536, -0.4729383069], %) | ||
|> line([-1.1025288142, 0.2708257990], %) | ||
|> line([-0.3635674851, -0.3295183609], %) | ||
|> line([0.1614549773, -1.1237654070], %) | ||
|> line([-0.5050409772, -0.3027099123], %) | ||
|> line([-0.9149632591, 0.6721299235], %) | ||
|> line([-0.4619937756, -0.1653040161], %) | ||
|> line([-0.2808814542, -1.1000100038], %) | ||
|> line([-0.5824390901, -0.0863966776], %) | ||
|> line([-0.5881028420, 0.9711083600], %) | ||
|> line([-0.4900857016, 0.0240763666], %) | ||
|> line([-0.6804562304, -0.9087880491], %) | ||
|> line([-0.5711661314, 0.1430696680], %) | ||
|> line([-0.1717090983, 1.1222443518], %) | ||
|> line([-0.4435665223, 0.2097913408], %) | ||
|> line([-0.9764377140, -0.5792113521], %) | ||
|> line([-0.4729383069, 0.3507549536], %) | ||
|> line([0.2708257990, 1.1025288142], %) | ||
|> line([-0.3295183609, 0.3635674851], %) | ||
|> line([-1.1237654070, -0.1614549773], %) | ||
|> line([-0.3027099123, 0.5050409772], %) | ||
|> line([0.6721299235, 0.9149632591], %) | ||
|> line([-0.1653040161, 0.4619937756], %) | ||
|> line([-1.1000100038, 0.2808814542], %) | ||
|> line([-0.0863966776, 0.5824390901], %) | ||
|> line([0.9711083600, 0.5881028420], %) | ||
|> line([0.0240763666, 0.4900857016], %) | ||
|> line([-0.9087880491, 0.6804562304], %) | ||
|> line([0.1430696680, 0.5711661314], %) | ||
|> line([1.1222443518, 0.1717090983], %) | ||
|> line([0.2097913408, 0.4435665223], %) | ||
|> line([-0.5792113521, 0.9764377140], %) | ||
|> line([0.3507549536, 0.4729383069], %) | ||
|> line([1.1025288142, -0.2708257990], %) | ||
|> line([0.3635674851, 0.3295183609], %) | ||
|> line([-0.1614549773, 1.1237654070], %) | ||
|> line([0.5050409772, 0.3027099123], %) | ||
|> line([0.9149632591, -0.6721299235], %) | ||
|> line([0.4619937756, 0.1653040161], %) | ||
|> line([0.2808814542, 1.1000100038], %) | ||
|> line([0.5824390901, 0.0863966776], %) | ||
|> close(%) | ||
|> extrude(1, %) | ||
// Spur Gear | ||
// A rotating machine part having cut teeth or, in the case of a cogwheel, inserted teeth (called cogs), which mesh with another toothed part to transmit torque. Geared devices can change the speed, torque, and direction of a power source. The two elements that define a gear are its circular shape and the teeth that are integrated into its outer edge, which are designed to fit into the teeth of another gear. | ||
|
||
// Set Units | ||
@settings(defaultLengthUnit = in) | ||
|
||
// Define constants | ||
nTeeth = 21 | ||
module = 0.5 | ||
pitchDiameter = module * nTeeth | ||
pressureAngle = 20 | ||
addendum = module | ||
deddendum = 1.25 * module | ||
baseDiameter = pitchDiameter * cos(toRadians(pressureAngle)) | ||
tipDiameter = pitchDiameter + 2 * module | ||
gearHeight = 3 | ||
|
||
// Interpolate points along the involute curve | ||
cmo = 101 | ||
rs = map([0..cmo], fn (i) { | ||
return baseDiameter / 2 + i / cmo * (tipDiameter - baseDiameter) / 2 | ||
}) | ||
|
||
// Calculate operating pressure angle | ||
angles = map(rs, fn (r) { | ||
return toDegrees( acos(baseDiameter / 2 / r)) | ||
}) | ||
|
||
// Calculate the involute function | ||
invas = map(angles, fn (a) { | ||
return tan(toRadians(a)) - toRadians(a) | ||
}) | ||
|
||
// Map the involute curve | ||
xs = map([0..cmo], fn (i) { | ||
return rs[i] * cos(invas[i]) | ||
}) | ||
|
||
ys = map([0..cmo], fn (i) { | ||
return rs[i] * sin(invas[i]) | ||
}) | ||
|
||
// Extrude the gear body | ||
body = startSketchOn('XY') | ||
|> circle({ | ||
center = [0, 0], | ||
radius = baseDiameter / 2 | ||
}, %) | ||
|> extrude(length = gearHeight) | ||
|
||
toothAngle = 360 / nTeeth / 1.5 | ||
|
||
// Plot the involute curve | ||
fn leftInvolute(i, sg) { | ||
j = 100 - i // iterate backwards | ||
return line(sg, endAbsolute = [xs[j], ys[j]]) | ||
} | ||
|
||
fn rightInvolute(i, sg) { | ||
x = rs[i] * cos(toRadians(-toothAngle + toDegrees(atan(ys[i] / xs[i])))) | ||
y = -rs[i] * sin(toRadians(-toothAngle + toDegrees(atan(ys[i] / xs[i])))) | ||
return line(sg, endAbsolute = [x, y]) | ||
} | ||
|
||
// Draw gear teeth | ||
start = startSketchOn('XY') | ||
|> startProfileAt([xs[101], ys[101]], %) | ||
teeth = reduce([0..100], start, leftInvolute) | ||
|> arc({ | ||
angleStart = 0, | ||
angleEnd = toothAngle, | ||
radius = baseDiameter / 2 | ||
}, %) | ||
|> reduce([1..101], %, rightInvolute) | ||
|> close() | ||
|> extrude(length = gearHeight) | ||
|> patternCircular3d({ | ||
axis = [0, 0, 1], | ||
center = [0, 0, 0], | ||
instances = nTeeth, | ||
arcDegrees = 360, | ||
rotateDuplicates = true | ||
}, %) | ||
|
||
// Define the constants of the keyway and the bore hole | ||
keywayWidth = 0.250 | ||
keywayDepth = keywayWidth / 2 | ||
holeDiam = 2 | ||
holeRadius = 1 | ||
startAngle = asin(keywayWidth / 2 / holeRadius) | ||
|
||
// Sketch the keyway and center hole and extrude | ||
keyWay = startSketchOn(body, 'END') | ||
|> startProfileAt([ | ||
holeRadius * cos(startAngle), | ||
holeRadius * sin(startAngle) | ||
], %) | ||
|> xLine(keywayDepth, %) | ||
|> yLine(-keywayWidth, %) | ||
|> xLine(-keywayDepth, %) | ||
|> arc({ | ||
angleEnd = 180, | ||
angleStart = -1 * 180 / pi() * startAngle + 360, | ||
radius = holeRadius | ||
}, %) | ||
|> arc({ | ||
angleEnd = 180 / pi() * startAngle, | ||
angleStart = 180, | ||
radius = holeRadius | ||
}, %) | ||
|> close() | ||
|> extrude(length = -gearHeight) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.