2025-03-06 18:01:24 -05:00
// Cycloidal Gear
// A cycloidal gear is a gear with a continuous, curved tooth profile. They are used in watchmaking and high precision robotics actuation
2025-04-04 11:03:13 -07:00
// Set units
2025-05-06 08:44:03 +12:00
@settings(defaultLengthUnit = in, kclVersion = 1.0)
2025-03-06 18:01:24 -05:00
2025-04-04 11:03:13 -07:00
// Create a function for the cycloidal gear
2025-04-29 08:41:31 +12:00
fn cycloidalGear(gearPitch, gearHeight, holeDiameter, helixAngle: number(deg)) {
2025-03-06 18:01:24 -05:00
// Create a function to draw the gear profile as a sketch. Rotate each profile about the gear's axis by an helix angle proportional to the total gear height
2025-05-01 11:36:51 -05:00
fn gearSketch(@gHeight) {
2025-03-06 18:01:24 -05:00
helixAngleP = helixAngle * gHeight / gearHeight
2025-03-26 08:53:34 -07:00
gearProfile = startSketchOn(offsetPlane(XY, offset = gHeight))
2025-04-25 16:01:35 -05:00
|> startProfile(at = [
2025-04-30 11:07:05 -04:00
gearPitch * 1.55 * cos(helixAngleP) + gearPitch * sin(-helixAngleP),
gearPitch * 1.55 * sin(helixAngleP) + gearPitch * cos(-helixAngleP)
2025-04-25 16:01:35 -05:00
])
2025-04-18 17:40:44 -05:00
|> arc(angleStart = 90 + helixAngleP, angleEnd = -90 + helixAngleP, radius = gearPitch)
2025-04-11 14:17:20 -04:00
|> tangentialArc(radius = gearPitch * 1.67, angle = 60)
|> tangentialArc(radius = gearPitch, angle = -180)
|> tangentialArc(radius = gearPitch * 1.67, angle = 60)
|> tangentialArc(radius = gearPitch, angle = -180)
|> tangentialArc(endAbsolute = [profileStartX(%), profileStartY(%)])
2025-03-06 18:01:24 -05:00
|> close(%)
2025-04-26 15:31:51 -05:00
|> subtract2d(tool = circle(center = [0, 0], radius = holeDiameter / 2))
2025-03-06 18:01:24 -05:00
return gearProfile
}
// Draw sketches of the gear profile along the gear height and loft them together
gearLoft = loft([
gearSketch(0),
gearSketch(gearHeight / 2),
gearSketch(gearHeight)
])
return gearLoft
}
2025-04-04 11:03:13 -07:00
// Call the cycloidal gear function
2025-05-01 11:36:51 -05:00
cycloidalGear(
gearPitch = .3,
gearHeight = 1.5,
holeDiameter = 0.297,
helixAngle = -80,
)