Sign in with STEVE

steve/spur-gear

Involute spur gear, ISO 53 basic rack, ISO 54 modules 0.5 to 2: teeth, bore and width as presets.

v1.0.0 Latest STEVE MIT 0
Isometric
part.py 90 lines · Python · STEVE runtime · checked
Download
1"""Spur gear cut from the ISO 53 basic rack: module m, z teeth, pressure angle 20 degrees, addendum 1.0 m, dedendum 1.25 m, no profile shift, a plain disc
2with a round bore. Axis along Z, centred on the origin. detail = "full": involute flanks, and below them the root curve the rack's tip corner cuts (a trochoid), which
3undercuts small tooth counts as a real cutter does; flanks are smooth splines on computed involute points, the root curve a polyline. detail = "simple": a disc at the tip diameter, for big assemblies."""
4import math
5
6from steve import Model
7
8module = 1 # ISO 54 module
9teeth = 20 # Number of teeth
10bore = 8 # mm Bore
11width = 8 # mm Face width
12detail = "full" # full: real teeth; simple: a disc at the tip diameter
13
14PRESSURE_ANGLE = 20 # degrees: ISO 53:1998 standard basic rack, profile A
15ADDENDUM = 1.0 # x module: ISO 53
16DEDENDUM = 1.25 # x module: ISO 53
17FLANK_POINTS = 5 # involute points on each flank
18MIN_WALL = 1.0 # x module: least ring left between the bore and the root circle, or the gear reads as a thin hoop
19
20a = math.radians(PRESSURE_ANGLE)
21rp = module * teeth / 2
22rb = rp * math.cos(a)
23ra = rp + ADDENDUM * module
24h = DEDENDUM * module
25rf = rp - h
26if rf - bore / 2 < MIN_WALL * module:
27 raise ValueError(f"Bore {bore} leaves less than one module of wall under the teeth: the root diameter is {2 * rf:.2f} mm.")
28
29
30def involute(angle):
31 return math.tan(angle) - angle
32
33
34def flank_angle(r):
35 """Half the tooth's angular width on the involute at radius r (r >= rb)."""
36 return math.pi / (2 * teeth) + involute(a) - involute(math.acos(rb / r))
37
38
39# the rack's tip corner, at c from the tooth's axis on the rack's tip line, traces the root curve as the rack rolls on the pitch circle
40c = math.pi * module / 4 + h * math.tan(a)
41start = c / rp
42root_curve = []
43for i in range(40):
44 beta = start * (1 + i / 39 * 1.5)
45 x = (c - beta * rp) * math.cos(beta) + rf * math.sin(beta)
46 y = -(c - beta * rp) * math.sin(beta) + rf * math.cos(beta)
47 root_curve.append((math.hypot(x, y), math.atan2(x, y)))
48if h <= rp * math.sin(a) ** 2: # no undercut: the involute starts where the rack's flank ends
49 join = max(rf, math.sqrt(rb ** 2 + (rp * math.sin(a) - h / math.sin(a)) ** 2))
50else: # undercut: the root curve crosses the involute
51 join = next((r for r, angle in root_curve if r >= rb and angle >= flank_angle(r)), max(rb, rf))
52kept = [p for p in root_curve if p[0] < join - 1e-6]
53step = max(1, len(kept) // 4)
54root_part = kept[::step] + [(join, flank_angle(join) if join >= rb else kept[-1][1])] if kept else []
55if root_part and join >= rb:
56 root_part[-1] = (join, flank_angle(join))
57flank_part = [(join + (ra - join) * i / (FLANK_POINTS - 1), 0) for i in range(FLANK_POINTS)]
58flank_part = [(r, flank_angle(r)) for r, _ in flank_part]
59if not root_part:
60 root_part = [(rf, flank_angle(max(rf, rb)))]
61
62
63def at(r, angle):
64 return (r * math.sin(angle), r * math.cos(angle))
65
66
67model = Model()
68if detail == "simple":
69 with model.sketch("gear_sketch", on="XY", name="Disc") as sk:
70 sk.circle("tip", (0, 0), ra)
71 sk.circle("bore_d", (0, 0), bore / 2)
72else:
73 with model.sketch("gear_sketch", on="XY", name="Tooth profile") as sk:
74 for n in range(teeth):
75 centre = 2 * math.pi * n / teeth
76 rise = [at(r, centre - angle) for r, angle in root_part]
77 fall = [at(r, centre + angle) for r, angle in reversed(root_part)]
78 if len(rise) > 1:
79 sk.polyline(f"root_a_{n}", rise, closed=False)
80 sk.polyline(f"root_b_{n}", fall, closed=False)
81 sk.spline(f"flank_a_{n}", [at(r, centre - angle) for r, angle in flank_part])
82 sk.polyline(f"tip_{n}", [at(flank_part[-1][0], centre - flank_part[-1][1]), at(flank_part[-1][0], centre + flank_part[-1][1])], closed=False)
83 sk.spline(f"flank_b_{n}", [at(r, centre + angle) for r, angle in reversed(flank_part)])
84 following = centre + 2 * math.pi / teeth
85 sk.polyline(f"land_{n}", [fall[-1], at(root_part[0][0], following - root_part[0][1])], closed=False)
86 sk.circle("bore_d", (0, 0), bore / 2)
87model.extrude("gear", "gear_sketch", distance=width, both=True, name="Gear")
88model.material("steel-generic", color="#b4b8bd")
89result = model.result()
90

Spur gear with real teeth cut from the ISO 53 basic rack: involute flanks and the trochoid root a rack cutter makes (20 degree pressure angle, no profile shift), as a plain disc with a round bore. detail = simple gives a disc at the tip diameter for big assemblies. Axis along Z, centred on the origin. See the README.

Spur gear (ISO 53)

Involute spur gear, cut from the standard basic rack, as a plain disc with a round bore.

Geometry

Axis along Z, centred on the origin. Pitch diameter m z, tip diameter m (z + 2), root diameter m (z − 2.5), base diameter m z cos 20°, tooth thickness π m / 2 on the pitch circle. Flanks are smooth splines on computed involute points, so they sit very close to the true involute, not exactly on it; the root curve is a polyline. Below them runs the trochoid that the basic rack's tip corner cuts, so small tooth counts are undercut as a real cutter leaves them. No profile shift is applied, and the rack's tip radius isn't modelled.

detail = "simple" is a disc at the tip diameter, for big assemblies. A bore must leave at least one module of wall under the root circle.

Source

  • Basic rack: ISO 53:1998, standard basic rack profile: pressure angle 20°, addendum 1.0 m, dedendum 1.25 m.
  • Modules: ISO 54:1996, preferred modules (1.25 and others from its series).
  • Involute geometry: derived from these with the standard relations for an unshifted gear (radii above; flank angle from the involute function inv φ = tan φ − φ; the root curve is the path of the rack's tip corner as it rolls on the pitch circle).

Tooth counts, bores and face widths come from the step.parts catalogue metadata (MIT, library/NOTICE.md): they are the gear's size, set by the designer. Tooth quality and bore fit aren't stated: neither standard above sets them for a gear.

  1. 1.0.0 Latest
More #gear
STEVEMIT

steve/gear-rack

Straight gear rack, ISO 53 basic rack, modules 0.5 to 2, any length, with common lengths as presets.

0 38 sizes 0 3 hours ago v1.0.0
STEVEMIT

steve/miter-gear

Straight miter gear (1:1 bevel, 90 degree) envelope, modules 1 to 3, with catalogue numbers as presets.

1 22 sizes 0 3 hours ago v1.1.0
STEVEMIT

steve/shaft-collar

Shaft collar: DIN 705 A set collar, bores 3 to 20 mm, and one-piece clamp collars.

0 12 sizes 0 8 minutes ago v1.1.0
STEVEMIT

steve/parallel-key

Parallel key, DIN 6885-1 form A, 2 x 2 to 12 x 8, any length, with the common sizes as presets.

0 46 sizes 0 5 hours ago v1.0.0