Create std::units module (#6528)

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-04-29 08:41:31 +12:00
committed by GitHub
parent d96a4d3337
commit 3a23ec1bee
114 changed files with 4450 additions and 5591 deletions

View File

@ -19,7 +19,7 @@ pitchDiameter = module * nTeeth
pressureAngle = 20
addendum = module
deddendum = 1.25 * module
baseDiameter = pitchDiameter * cos(toRadians(pressureAngle))
baseDiameter = pitchDiameter * cos(units::toRadians(pressureAngle))
tipDiameter = pitchDiameter + 2 * module
gearHeight = 3
@ -36,7 +36,7 @@ rs = map(
angles = map(
rs,
f = fn(r) {
return toDegrees( acos(baseDiameter / 2 / r))
return units::toDegrees( acos(baseDiameter / 2 / r))
},
)
@ -44,7 +44,7 @@ angles = map(
invas = map(
angles,
f = fn(a) {
return tan(toRadians(a)) - toRadians(a)
return tan(units::toRadians(a)) - units::toRadians(a)
},
)
@ -77,8 +77,8 @@ fn leftInvolute(i, sg) {
}
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]))))
x = rs[i] * cos(units::toRadians(-toothAngle + units::toDegrees(atan(ys[i] / xs[i]))))
y = -rs[i] * sin(units::toRadians(-toothAngle + units::toDegrees(atan(ys[i] / xs[i]))))
return line(sg, endAbsolute = [x, y])
}
@ -114,8 +114,8 @@ keyWay = startSketchOn(body, face = END)
|> xLine(length = keywayDepth)
|> yLine(length = -keywayWidth)
|> xLine(length = -keywayDepth)
|> arc(angleStart = -1 * toDegrees(startAngle) + 360, angleEnd = 180, radius = holeRadius)
|> arc(angleStart = 180, angleEnd = toDegrees(startAngle), radius = holeRadius)
|> arc(angleStart = -1 * units::toDegrees(startAngle) + 360, angleEnd = 180, radius = holeRadius)
|> arc(angleStart = 180, angleEnd = units::toDegrees(startAngle), radius = holeRadius)
|> close()
|> extrude(length = -gearHeight)