# Manufacturing Data — Tolerances, Gear Data Sheets and Profiles


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Executive Summary

**Purpose:** Turn the designed gears and parts into what a gear shop and
a machine shop need: the gear data table for each drawing, tooth
thickness limits as measurable span and over-ball dimensions, the
accuracy class with its tolerance values, fits as numeric limits, heat
treatment and case depth, and a tooth outline for prototypes.

**What it does:**

- `iso286_limits` gives the limits of a fit such as H7, G6, j5, n6 for a
  nominal size (ISO 286-2 tables).
- `iso1328_tolerances` computes the single pitch, cumulative pitch,
  profile, helix and runout tolerances of ISO 1328-1:2013 for a flank
  tolerance class.
- `backlash_allowances` splits the minimum backlash of both planetary
  meshes into tooth thickness allowances for sun, planet and ring.
- `gear_data_sheet` assembles the ISO 1340 / DIN 3966-1 data table of
  one gear, with span or over-ball limits computed from the thickness
  allowances.
- `gear_outline` and `write_dxf` give the closed tooth outline of a gear
  as points or as a DXF polyline, for wire EDM or laser-cut prototypes.

## How It Fits Into the Gear Design Workflow

**Upstream:** `gears.involute` (geometry and measurement formulas),
`gears.layout` (the set), `gears.rating` (materials), `gears.components`
(fits named on the parts).

**Downstream:** `gears.design.DesignPackage`, which writes the data
sheets, the drawing and the report to files.

## ISO 286 Fits: Theory

A fit such as H7 names a *tolerance zone* around the nominal size: the
letter gives the **fundamental deviation**, the deviation of the zone
edge nearest the zero line, and the number gives the **standard
tolerance grade** IT, the width of the zone. A hole letter is upper case
(deviations ES upper, EI lower), a shaft letter lower case (es, ei).
Both come from the ISO 286-2 tables for the size range that contains the
nominal size *d*, *D*<sub>*i* − 1</sub> \< *d* ≤ *D*<sub>*i*</sub> (here
IT5–IT12 and the letters used on these parts, sizes up to 500 mm).

![](05_manufacturing_files/figure-commonmark/cell-2-output-1.png)

From the tabulated fundamental deviation and IT, the other limit
follows:

<table>
<colgroup>
<col style="width: 33%" />
<col style="width: 33%" />
<col style="width: 33%" />
</colgroup>
<thead>
<tr>
<th>Class</th>
<th>Upper deviation</th>
<th>Lower deviation</th>
</tr>
</thead>
<tbody>
<tr>
<td>H (hole basis)</td>
<td><span
class="math inline"><em>E</em><em>S</em> = <em>I</em><em>T</em></span></td>
<td><span class="math inline"><em>E</em><em>I</em> = 0</span></td>
</tr>
<tr>
<td>h (shaft basis)</td>
<td><span class="math inline"><em>e</em><em>s</em> = 0</span></td>
<td><span
class="math inline"><em>e</em><em>i</em> = −<em>I</em><em>T</em></span></td>
</tr>
<tr>
<td>JS, js (symmetric)</td>
<td><span class="math inline">+<em>I</em><em>T</em>/2</span></td>
<td><span class="math inline">−<em>I</em><em>T</em>/2</span></td>
</tr>
<tr>
<td>G</td>
<td><span
class="math inline"><em>E</em><em>S</em> = <em>E</em><em>I</em> + <em>I</em><em>T</em></span></td>
<td><span
class="math inline"><em>E</em><em>I</em> = −<em>e</em><em>s</em><sub><em>g</em></sub></span>
(mirror of g)</td>
</tr>
<tr>
<td>g</td>
<td><span class="math inline"><em>e</em><em>s</em></span> (table,
negative)</td>
<td><span
class="math inline"><em>e</em><em>i</em> = <em>e</em><em>s</em> − <em>I</em><em>T</em></span></td>
</tr>
<tr>
<td>j5, j6</td>
<td><span class="math inline"><em>e</em><em>s</em></span> (table)</td>
<td><span class="math inline"><em>e</em><em>i</em></span> (table)</td>
</tr>
<tr>
<td>k, m, n, p</td>
<td><span
class="math inline"><em>e</em><em>s</em> = <em>e</em><em>i</em> + <em>I</em><em>T</em></span></td>
<td><span class="math inline"><em>e</em><em>i</em></span> (table; <span
class="math inline"><em>e</em><em>i</em> = 0</span> for k above
IT7)</td>
</tr>
<tr>
<td>r, s, u (interference fits)</td>
<td><span
class="math inline"><em>e</em><em>s</em> = <em>e</em><em>i</em><sub><em>m</em><em>a</em><em>x</em></sub> + <em>I</em><em>T</em></span></td>
<td><span
class="math inline"><em>e</em><em>i</em><sub><em>m</em><em>i</em><em>n</em></sub></span>
(table)</td>
</tr>
<tr>
<td>N7</td>
<td><span class="math inline"><em>E</em><em>S</em></span> (table)</td>
<td><span
class="math inline"><em>E</em><em>I</em> = <em>E</em><em>S</em> − <em>I</em><em>T</em>7</span></td>
</tr>
<tr>
<td>P (IT8 and coarser)</td>
<td><span
class="math inline"><em>E</em><em>S</em> = −<em>e</em><em>i</em><sub><em>p</em></sub></span></td>
<td><span
class="math inline"><em>E</em><em>I</em> = <em>E</em><em>S</em> − <em>I</em><em>T</em></span></td>
</tr>
</tbody>
</table>

Where ISO 286-2 splits one of the size ranges used here for r, s and u
(for example 50–65 and 65–80 mm), the zone is widened to cover both
halves: the lower deviation is the smaller tabulated *e**i* and the
upper deviation the larger *e**i* plus IT. That gives a slightly low
minimum interference and a slightly high maximum interference, the safe
side for both press-fit checks.

`iso286_limits(d, "H7")` returns the upper and lower deviation in mm;
`fmt_fit` writes the drawing text ⌀*d* fit (upper/lower).

------------------------------------------------------------------------

### fmt_fit

``` python
def fmt_fit(
    d:float, fit:str, digits:int=3
)->str:
```

*Drawing text such as ‘Ø12 H7 (+0.018/0)’.*

------------------------------------------------------------------------

### iso286_limits

``` python
def iso286_limits(
    d:float, fit:str
)->tuple[float, float]:
```

*(upper, lower) deviation \[mm\] of the tolerance class `fit`
(e.g. ‘H7’, ‘G6’, ‘N7’, ‘h11’, ‘js6’, ‘j5’, ‘k6’, ‘n6’, ‘p6’, ‘s6’,
‘u6’, ‘P9’, ‘JS9’).*

------------------------------------------------------------------------

### it_grade

``` python
def it_grade(
    d:float, grade:int
)->float:
```

*Standard tolerance IT`grade` \[mm\] for nominal size d \[mm\].*

``` python
print(fmt_fit(12, "H7"), fmt_fit(12, "n6"), fmt_fit(9, "G6"), fmt_fit(6, "j5"), fmt_fit(29.4, "h11"))
assert iso286_limits(12, "H7") == (0.018, 0.0) and iso286_limits(12, "n6") == (0.023, 0.012)
assert iso286_limits(25, "G6") == (0.020, 0.007) and iso286_limits(40, "P9") == (-0.026, -0.088)
```

    Ø12 H7 (+0.018/0) Ø12 n6 (+0.023/+0.012) Ø9 G6 (+0.014/+0.005) Ø6 j5 (+0.003/-0.002) Ø29.4 h11 (0/-0.130)

## ISO 1328-1:2013 Flank Tolerances: Theory

The flank tolerances limit how far the real teeth may depart from
perfect involutes at perfect spacing. Each is checked on a gear
measuring machine:

- **Pitch.** *f*<sub>*p**i*</sub> is the error in the spacing of tooth
  *i* from its neighbour, *F*<sub>*p**i*</sub> = ∑*f*<sub>*p**i*</sub>
  the running sum around the gear; the single pitch tolerance
  *f*<sub>*p**T*</sub> limits |*f*<sub>*p**i*</sub>| and the cumulative
  tolerance *F*<sub>*p**T*</sub> limits the spread
  *F*<sub>*p*</sub> = max *F*<sub>*p**i*</sub> − min *F*<sub>*p**i*</sub>.
- **Profile** (along the roll length *L*<sub>*α*</sub> from root to tip)
  and **helix** (across the face width): the total deviation
  *F*<sub>*α*</sub>, *F*<sub>*β*</sub> is the band containing the whole
  trace; the form deviation *f*<sub>*f**α*</sub>, *f*<sub>*f**β*</sub>
  is the band around the least-squares mean line; the slope deviation
  *f*<sub>*H**α*</sub>, *f*<sub>*H**β*</sub> is the rise of the mean
  line over the evaluation range.
- **Runout** *F*<sub>*r*</sub>: the spread of the radial position of a
  probe placed in each tooth space in turn.

![](05_manufacturing_files/figure-commonmark/cell-7-output-1.png)

The 2013 edition defines the tolerances of flank tolerance class *A* (1
to 11; the old grades 5–8 map roughly to classes 5–8) by formulas in the
reference diameter *d*, module *m* and face width *b* (mm, results in
µm), each scaled by $(\sqrt2)^{A-5}$:

<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<thead>
<tr>
<th>Tolerance</th>
<th>Formula at class 5</th>
</tr>
</thead>
<tbody>
<tr>
<td>single pitch <span
class="math inline"><em>f</em><sub><em>p</em><em>T</em></sub></span></td>
<td><span
class="math inline">0.001<em>d</em> + 0.4<em>m</em> + 5</span></td>
</tr>
<tr>
<td>cumulative pitch (total) <span
class="math inline"><em>F</em><sub><em>p</em><em>T</em></sub></span></td>
<td><span class="math inline">$0.002d + 0.55\sqrt d + 0.7m +
12$</span></td>
</tr>
<tr>
<td>total profile <span
class="math inline"><em>F</em><sub><em>α</em><em>T</em></sub></span></td>
<td><span class="math inline">$3.2\sqrt m + 0.22\sqrt d +
0.7$</span></td>
</tr>
<tr>
<td>profile form <span
class="math inline"><em>f</em><sub><em>f</em><em>α</em><em>T</em></sub></span></td>
<td><span class="math inline">$2.5\sqrt m + 0.17\sqrt d +
0.5$</span></td>
</tr>
<tr>
<td>profile slope <span
class="math inline"><em>f</em><sub><em>H</em><em>α</em><em>T</em></sub></span></td>
<td><span class="math inline">$2\sqrt m + 0.14\sqrt d + 0.5$</span></td>
</tr>
<tr>
<td>total helix <span
class="math inline"><em>F</em><sub><em>β</em><em>T</em></sub></span></td>
<td><span class="math inline">$0.07\sqrt d + 0.45\sqrt b +
4$</span></td>
</tr>
<tr>
<td>helix form and slope <span
class="math inline"><em>f</em><sub><em>f</em><em>β</em><em>T</em></sub> = <em>f</em><sub><em>H</em><em>β</em><em>T</em></sub></span></td>
<td><span class="math inline">$0.05\sqrt d + 0.35\sqrt b +
4$</span></td>
</tr>
<tr>
<td>radial runout <span
class="math inline"><em>F</em><sub><em>r</em><em>T</em></sub></span></td>
<td><span
class="math inline">0.9 <em>F</em><sub><em>p</em><em>T</em></sub></span>
(ISO 1328-2 guidance)</td>
</tr>
</tbody>
</table>

A tolerance of class *A* is the class-5 value times the step factor:

$$T_A = T_5\\(\sqrt2)^{A-5},$$

so each class is $\sqrt2$ coarser than the one before and two classes
double the tolerance. Values above 10 µm are rounded to whole µm, values
from 5 to 10 µm to 0.5 µm, and smaller values to 0.1 µm.

------------------------------------------------------------------------

### iso1328_tolerances

``` python
def iso1328_tolerances(
    g:GearGeometry, A:int
)->dict[str, float]:
```

*ISO 1328-1:2013 flank tolerances \[µm\] of gear g for flank tolerance
class A.*

``` python
t6 = iso1328_tolerances(GearGeometry(z=18, m=1.5, b=20), 6)
print(t6)
assert t6["F_pT"] > t6["f_pT"] and iso1328_tolerances(GearGeometry(z=18, m=1.5, b=20), 7)["F_pT"] > t6["F_pT"]
```

    {'f_pT': 8.0, 'F_pT': 23.0, 'F_alphaT': 8.0, 'f_falphaT': 6.5, 'f_HalphaT': 5.0, 'F_betaT': 9.0, 'f_HbetaT': 8.0, 'F_rT': 20.0}

## Backlash and Tooth Thickness Allowances: Theory

Gears are made with their teeth slightly thinner than the theoretical
value so that the mesh has backlash: with the drive flanks in contact,
the opposite flanks stand apart by the normal backlash
*j*<sub>*b**n*</sub>, measured along their line of action. The thinning
of each tooth is specified by two *thickness allowances* on the
reference circle, the upper *A*<sub>*s**n**e*</sub> and the lower
*A*<sub>*s**n**i*</sub>:

``` python
from matplotlib.path import Path
```

![](05_manufacturing_files/figure-commonmark/cell-11-output-1.png)

A thinning *Δ**s* of the arc tooth thickness on the reference circle
opens the mesh by −*Δ**s*cos *α* along the line of action, so two gears
with allowances *A*<sub>1</sub>, *A*<sub>2</sub> have
*j*<sub>*b**n*</sub> = −(*A*<sub>1</sub> + *A*<sub>2</sub>)cos *α* at
the nominal centre distance. The smallest normal backlash a mesh should
have (ISO/TR 10064-2, also AGMA 2002) is

$$j\_{bn,min} = \tfrac{2}{3}\\(0.06 + 0.0005\\a_w + 0.03\\m)\\\text{mm}.$$

A centre distance error *Δ**a* changes the backlash by
2*Δ**a*sin *α*<sub>*w*</sub>: a shorter distance takes backlash away on
an external mesh, a longer one on an internal mesh. With the centre
distance held to ±*f*<sub>*a*</sub>, the carrier pin-hole position
tolerance,

$$f_a = \tfrac12\\IT7(a_w),$$

the thickness reductions of the two gears at the reference circle must
add up to at least

$$S = \frac{j\_{bn,min} + 2f_a\sin\alpha_w}{\cos\alpha}.$$

This is evaluated for both meshes, *S*<sub>*s**p*</sub> (sun–planet,
*α*<sub>*w*</sub> of that mesh) and *S*<sub>*p**r*</sub> (planet–ring).
The planet is in both meshes, so it takes half of the larger requirement
and the sun and ring make up the rest of their own mesh, but never less
than a quarter of it. With ⌈ ⌉<sub>5</sub> meaning “rounded up to 5 µm”,
the upper allowances (negative: tooth thinner than nominal) are

$$A\_{sne,p} = -\Big\lceil \tfrac12 \max(S\_{sp}, S\_{pr}) \Big\rceil_5,\qquad A\_{sne,s} = -\Big\lceil \max\big(S\_{sp} + A\_{sne,p},\\0.25\\S\_{sp}\big)\Big\rceil_5,\qquad A\_{sne,r} = -\Big\lceil \max\big(S\_{pr} + A\_{sne,p},\\0.25\\S\_{pr}\big)\Big\rceil_5.$$

The *lower* allowance is
*A*<sub>*s**n**i*</sub> = *A*<sub>*s**n**e*</sub> − *T*<sub>*s**n*</sub>.
The tolerance *T*<sub>*s**n*</sub> must at least cover the thickness
change caused by runout (DIN 3967 practice); 15 µm is added for the
measuring and machining spread:

*T*<sub>*s**n*</sub> = ⌈2*F*<sub>*r**T*</sub>tan *α* + 0.015 mm⌉<sub>5</sub>.

Agree *T*<sub>*s**n*</sub> with your gear shop. A shop that grinds can
often hold less, a shop that shapes the ring may need more.

The backlash range of each mesh then follows from the allowance limits
and the two ends of the centre distance tolerance:

*j*<sub>*b**n*, *m**i**n*</sub> = −(*A*<sub>*s**n**e*, 1</sub> + *A*<sub>*s**n**e*, 2</sub>)cos *α* − 2*f*<sub>*a*</sub>sin *α*<sub>*w*</sub>,   *j*<sub>*b**n*, *m**a**x*</sub> = −(*A*<sub>*s**n**i*, 1</sub> + *A*<sub>*s**n**i*, 2</sub>)cos *α* + 2*f*<sub>*a*</sub>sin *α*<sub>*w*</sub>.

The smallest must reach the required value; the largest is reported so
you can check it against the positioning accuracy your application
needs.

------------------------------------------------------------------------

### backlash_allowances

``` python
def backlash_allowances(
    ps:PlanetarySet, A:int
)->dict:
```

*Thickness allowances of sun, planet and ring, plus min/max backlash of
both meshes \[mm\].*

A: ISO 1328-1 flank tolerance class (sets the runout used for the
thickness tolerance).

------------------------------------------------------------------------

### ThicknessAllowance

``` python
def ThicknessAllowance(
    A_sne:float, A_sni:float
)->None:
```

*Tooth thickness allowances of one gear on the reference circle \[mm\]
(negative = thinner).*

## Gear Data Sheet: Theory

ISO 1340 and DIN 3966-1 list what a gear drawing must carry so that the
gear can be cut and inspected without the designer’s calculation: the
basic geometry (*z*, *m*, *α*, *x* and the basic rack), the diameters,
the thickness with its allowances and the matching measurement limits,
the flank tolerance class with its values, the mating gear and centre
distance, and the material, heat treatment and surface data.
`gear_data_sheet` produces those rows. On one tooth:

![](05_manufacturing_files/figure-commonmark/cell-14-output-1.png)

**Inspection limits.** The span *W*<sub>*k*</sub> (external gears) and
the dimension over balls *M*<sub>*d*</sub> are evaluated at the two
thickness limits

*s*<sub>*m**a**x*</sub> = *s* + *A*<sub>*s**n**e*</sub>,   *s*<sub>*m**i**n*</sub> = *s* + *A*<sub>*s**n**i*</sub>

with the formulas of `gears.involute`, giving
*W*<sub>*k*</sub>(*s*<sub>*m**a**x*</sub>)/*W*<sub>*k*</sub>(*s*<sub>*m**i**n*</sub>)
and
*M*<sub>*d*</sub>(*s*<sub>*m**a**x*</sub>)/*M*<sub>*d*</sub>(*s*<sub>*m**i**n*</sub>).
They are the dimensions the gear inspector measures. On an internal gear
a thinner tooth means a wider space and a *larger* dimension between
balls, so its upper limit is *M*<sub>*d*</sub>(*s*<sub>*m**i**n*</sub>).

**Root form diameter.** The drawing requires the involute to reach the
root form diameter *d*<sub>*F**f*</sub>, which must lie below the start
of the active profile *d*<sub>*N**f*</sub> found by
`gears.involute.mesh_check` (above it for an internal gear):
*d*<sub>*F**f*</sub> ≤ *d*<sub>*N**f*</sub> (external),
*d*<sub>*F**f*</sub> ≥ *d*<sub>*N**f*</sub> (internal).

**Tip diameter and centre distance tolerances.** External gears h11,
internal gears H11 (the tip diameter only needs to be held loosely,
because it only affects the contact ratio and the clearances checked in
`gears.layout`). The centre distance is given as
*a*<sub>*w*</sub> ± *f*<sub>*a*</sub> with
*f*<sub>*a*</sub> = *I**T*7(*a*<sub>*w*</sub>)/2, as used for the
backlash.

**Case depth.** For carburized gears the effective case depth (CHD to
550 HV, ISO 2639) after grinding is chosen in proportion to the module:

*C**H**D* = max (0.3, 0.15 *m*) to max (0.45, 0.2 *m*) mm.

That depth is deep enough to carry the subsurface shear stress under the
contact, and shallow enough that the tooth tip does not through-harden.
Specify the depth before grinding as this plus the grinding stock (about
0.05–0.1 mm per flank). For nitrided gears, the nitriding hardness depth
(NHD, core + 50 HV) is 0.3–0.5 mm with a compound layer of at most 10
µm.

**Surfaces and edges.** The tip edges get a chamfer or round of 0.1 *m*
to 0.15 *m*. Roughness by finish:

<table>
<thead>
<tr>
<th>Finish</th>
<th>Flanks</th>
<th>Root</th>
</tr>
</thead>
<tbody>
<tr>
<td>ground</td>
<td>Ra ≤ 0.4 µm (Rz ≤ 3)</td>
<td>Ra ≤ 3.2 µm, no grinding notch</td>
</tr>
<tr>
<td>hobbed or shaped</td>
<td>Ra ≤ 1.6 µm</td>
<td>Ra ≤ 3.2 µm</td>
</tr>
</tbody>
</table>

**Process route.** Turn the blank with bore and faces as datum, then cut
(hob an external gear; shape or power-skive an internal one), then:

<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<thead>
<tr>
<th>Material</th>
<th>Route after cutting</th>
</tr>
</thead>
<tbody>
<tr>
<td>case carburized</td>
<td>carburize, harden, temper → grind bore and faces → grind flanks (or
hone or lap if not ground)</td>
</tr>
<tr>
<td>nitrided</td>
<td>gas nitride after finish cutting (no grinding after)</td>
</tr>
<tr>
<td>through hardened</td>
<td>grind flanks if the finish is “ground”</td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

### gear_data_sheet

``` python
def gear_data_sheet(
    g:GearGeometry, mate:GearGeometry, a_w:float, allowance:ThicknessAllowance, A:int, mat:GearMaterial, finish:str,
    n_mate_label:str='', d_active:float | None=None
)->list[DataRow]:
```

*ISO 1340 / DIN 3966-1 data table rows for gear g meshing with `mate` at
centre distance a_w.*

finish: ‘ground’, ‘hobbed’ or ‘shaped’ (sets roughness text and process
route). d_active: start of active profile (from
`gears.involute.mesh_check`) for the form-diameter requirement.

------------------------------------------------------------------------

### DataRow

``` python
def DataRow(
    item:str, symbol:str, value:str
)->None:
```

*One row of a gear data table.*

------------------------------------------------------------------------

### case_depth

``` python
def case_depth(
    g:GearGeometry, mat:GearMaterial
)->str:
```

*Recommended hardening depth text for the drawing.*

### Example

Data sheets of the 18/27/72 set, flank class 6:

``` python
from emachines.gears.layout import PlanetarySet
from emachines.gears.rating import MATERIALS
from emachines.gears.involute import mesh_check
```

``` python
ps = PlanetarySet.build(18, 27, 72, m=1.5, n_planets=3, b=20)
bl = backlash_allowances(ps, 6)
print({k: (round(v.A_sne, 3), round(v.A_sni, 3)) for k, v in bl["allowances"].items()},
      {k: tuple(round(x, 3) for x in v) for k, v in bl["backlash_n"].items()}, f"j_bn,min = {bl['j_bn_min_required']:.3f}")
sheet = gear_data_sheet(ps.sun, ps.planet, ps.a_w, bl["allowances"]["sun"], 6, MATERIALS["case_carburized"], "ground",
                        d_active=ps.sun_planet.d_Nf1)
for r in sheet:
    print(f"{r.item:34s} {r.symbol:20s} {r.value}")
for mesh, (jmin, jmax) in bl["backlash_n"].items():
    assert jmin >= bl["j_bn_min_required"] - 1e-9 and jmax > jmin
```

    {'sun': (-0.05, -0.08), 'planet': (-0.05, -0.085), 'ring': (-0.05, -0.085)} {'sun–planet': (0.085, 0.164), 'planet–ring': (0.085, 0.168)} j_bn,min = 0.081
    Gear                                                    sun
    Type                                                    spur, external
    Number of teeth                    z                    18
    Normal module                      m_n                  1.5 mm
    Pressure angle                     α_n                  20°
    Helix angle                        β                    0°
    Basic rack profile                                      ISO 53 profile A: h_aP = 1 m, h_fP = 1.25 m, ρ_fP = 0.38 m
    Profile shift coefficient          x                    +0.2400
    Reference diameter                 d                    27.0000 mm
    Base diameter                      d_b                  25.3717 mm
    Tip diameter                       d_a                  30.720 mm h11 (0/-0.160)
    Root diameter                      d_f                  23.970 mm (max)
    Root form diameter                 d_Ff                 ≤ 25.501 mm (active profile starts at 25.619 mm)
    Face width                         b                    20 mm ±0.1
    Tooth thickness on d (arc)         s                    2.6183 mm, allowances -0.050/-0.080 mm
    Span measurement                   W_k (k = 3)          11.6479 / 11.6197 mm
    Dimension over balls               M_d (D_M = 2.56 mm)  30.9287 / 30.8654 mm
    Flank tolerance class                                   ISO 1328-1:2013 class 6
    Single pitch tolerance             f_pT                 8 µm
    Total cumulative pitch tolerance   F_pT                 23 µm
    Total profile tolerance            F_αT                 8 µm
    Profile slope tolerance            f_HαT                ±5 µm
    Total helix tolerance              F_βT                 9 µm
    Helix slope tolerance              f_HβT                ±8 µm
    Radial runout tolerance            F_rT                 20 µm
    Mating gear                                             planet, z = 27
    Centre distance                    a_w                  33.7500 mm ±12 µm
    Material                                                20MnCr5 (1.7147) or 18CrNiMo7-6 (1.6587)
    Heat treatment                                          case carburized, hardened and tempered
    Hardness                                                58–62 HRC surface, core 30–42 HRC
    Hardening depth                                         CHD 550 HV1 = 0.30–0.45 mm after grinding (ISO 2639)
    Flank roughness                                         Ra ≤ 0.4 µm (Rz ≤ 3)
    Root roughness                                          Ra ≤ 3.2 µm, no grinding notch in the root
    Tip edge                                                chamfer or round 0.1–0.15 m (0.15–0.22 mm)
    Process route                                           turn blank (bore and faces as datum) → hob → carburize, harden, temper → grind bore and faces → grind flanks

``` python
ring_sheet = gear_data_sheet(ps.ring, ps.planet, ps.a_w, bl["allowances"]["ring"], 7, MATERIALS["qt_nitrided"], "shaped",
                             d_active=ps.planet_ring.d_Nf2)
for r in ring_sheet[10:17]:
    print(f"{r.item:34s} {r.symbol:20s} {r.value}")
```

    Tip diameter                       d_a                  104.880 mm H11 (+0.220/0)
    Root diameter                      d_f                  111.030 mm (min)
    Root form diameter                 d_Ff                 ≥ 110.458 mm (active profile starts at 110.075 mm)
    Face width                         b                    20 mm ±0.1
    Tooth thickness on d (arc)         s                    2.6183 mm, allowances -0.050/-0.085 mm
    Dimension between balls            M_d (D_M = 2.33 mm)  104.8186 / 104.7156 mm
    Flank tolerance class                                   ISO 1328-1:2013 class 7

## Tooth Outline for Prototypes: Theory

`gear_outline` returns the closed outline of the whole gear as points.
On an external gear the flanks are exact involutes from the tip down to
the root form circle, and the root fillet below them is generated the
way a hob makes it: as the envelope of the ISO 53 rack’s tip radius
rolling on the reference circle. On an internal gear the fillet depends
on the shaper cutter, so the outline runs straight from the form circle
to the root circle. The outline is right for wire EDM or laser-cut
prototypes, test fixtures and drawings; production gears are generated
by the hob or shaper from the data sheet. A thickness change *Δ**s* can
be applied (for example the mean of the two allowance limits).
`write_dxf` writes the outline as an R12 DXF polyline, in mm.

![](05_manufacturing_files/figure-commonmark/cell-21-output-1.png)

**Flanks.** A point of the involute at radius *r* lies at the polar
angle inv *α*<sub>*r*</sub> from where the involute leaves the base
circle, with cos *α*<sub>*r*</sub> = *r*<sub>*b*</sub>/*r*. Measured
from the tooth centre line, the flank is therefore at the half tooth
angle

$$\psi(r) = \frac{s + \Delta s}{d} + \mathrm{inv}\\\alpha - \mathrm{inv}\\\alpha_r\\\\\text{(external)},\qquad \psi(r) = \frac{s + \Delta s}{d} - \mathrm{inv}\\\alpha + \mathrm{inv}\\\alpha_r\\\\\text{(internal: the tooth widens outward)},$$

for *r* from the root form radius
*r*<sub>*F**f*</sub> = max (*d*<sub>*F**f*</sub>/2, *r*<sub>*b*</sub>)
to the tip radius *r*<sub>*a*</sub> (internal: from *r*<sub>*a*</sub>
out to min (*d*<sub>*F**f*</sub>/2, *r*<sub>*f*</sub>)). The tip is an
arc of *r*<sub>*a*</sub> between the two flanks.

**Root fillet (external gears).** In rack coordinates (*u* along the
rolling line from the space centre, *y* radial) the tool reference line
is shifted by *x* *m* and its tip line is the root circle:

*y*<sub>*r**e**f*</sub> = *r* + *x* *m*,   *y*<sub>*t**i**p*</sub> = *y*<sub>*r**e**f*</sub> − *h*<sub>*f**P*</sub><sup>\*</sup> *m* = *r*<sub>*f*</sub>,   *y*<sub>*c*</sub> = *y*<sub>*t**i**p*</sub> + *ρ*<sub>*f**P*</sub>,

and the centre of the tool tip radius *ρ*<sub>*f**P*</sub> (half tool
tooth width *π**m*/4 − *Δ**s*/2 on the reference line) is at

$$u_c = \frac{\pi m}{4} - \frac{\Delta s}{2} - (y\_{ref} - y_c)\tan\alpha - \frac{\rho\_{fP}}{\cos\alpha}.$$

As the gear turns by *φ* the rack moves by *r**φ* (the reference circle
rolls without slip on the tool reference line), so a tool point
(*u*, *y*) lands in gear coordinates at

*X* = *u* − *r**φ*,   *x*<sub>*g*</sub> = *X*cos *φ* + *y*sin *φ*,   *y*<sub>*g*</sub> = −*X*sin *φ* + *y*cos *φ*.

Sweeping *φ* over ±3*π*/*z* and taking, in each angular bin of the space
below the form circle, the smallest radius reached by the tool gives the
fillet: the envelope of the tool tip positions. It joins the flanks at
the form circle, where the space half angle is
*π*/*z* − *ψ*(*r*<sub>*F**f*</sub>).

------------------------------------------------------------------------

### write_dxf

``` python
def write_dxf(
    path:str, outlines:list[np.ndarray], circles:tuple | list=()
)->None:
```

*Write closed polylines (and circles: (x, y, r)) to an R12 ASCII DXF
file, units mm.*

------------------------------------------------------------------------

### gear_outline

``` python
def gear_outline(
    g:GearGeometry, ds:float | None=None, n_flank:int=24, n_arc:int=6
)->np.ndarray:
```

*Closed outline (N×2 array, mm) of gear g, centred on the origin, one
tooth on the +x axis.*

External gears: exact involute flanks from the root form circle to the
tip, and the root fillet generated by the ISO 53 rack (tool tip radius
ρ_fP) below it. Internal gears: involute flanks and a straight run from
the form circle to the root circle (the real fillet depends on the
shaper cutter). ds: thickness change on the reference circle \[mm\]
(negative: thinner; default 0).

``` python
import matplotlib.pyplot as plt
```

``` python
fig, ax = plt.subplots(figsize=(6, 6))
P = gear_outline(ps.ring, -0.05)
ax.plot(*P.T, lw=0.8, label="ring")
rho = np.pi * ps.planet.z / ps.ring.z                     # ring phase so its teeth mesh with planet 1
P = P @ np.array([[np.cos(rho), np.sin(rho)], [-np.sin(rho), np.cos(rho)]])
ax.lines[0].set_data(*P.T)
for k in range(3):
    th = 2 * np.pi * k / 3
    psi = th * (1 + ps.sun.z / ps.planet.z) + np.pi - np.pi / ps.planet.z   # planet phase that meshes with the sun
    R_ = np.array([[np.cos(psi), np.sin(psi)], [-np.sin(psi), np.cos(psi)]])
    Pp = gear_outline(ps.planet, -0.05) @ R_ + ps.a_w * np.array([np.cos(th), np.sin(th)])
    ax.plot(*Pp.T, lw=0.8, color="C1")
Ps = gear_outline(ps.sun, -0.05)
ax.plot(*Ps.T, lw=0.8, color="C2")
ax.set_aspect("equal"); ax.set_axis_off()
plt.tight_layout()
```

![](05_manufacturing_files/figure-commonmark/cell-25-output-1.png)

Checks on the outline: every point lies between the root and tip
circles, and the tooth thickness on the reference circle matches *s*:

``` python
for g in (ps.sun, ps.planet, ps.ring):
    P = gear_outline(g)
    rr = np.hypot(P[:, 0], P[:, 1])
    lo, hi = min(g.da, g.df) / 2, max(g.da, g.df) / 2
    assert rr.min() >= lo - 1e-6 and rr.max() <= hi + 1e-6, g.name
    # tooth thickness on the reference circle, interpolated on the first tooth's two flanks
    th = np.arctan2(P[:, 1], P[:, 0])
    flank = (np.abs(th) < np.pi / g.z) & (rr > lo + 1e-6) & (rr < hi - 1e-6)
    sides = []
    for sgn in (-1, 1):
        sel = flank & (np.sign(th) == sgn)
        order = np.argsort(rr[sel])
        sides.append(np.interp(g.d / 2, rr[sel][order], th[sel][order]))
    s_meas = (sides[1] - sides[0]) * g.d / 2
    print(f"{g.name:6s} thickness on d from the outline {s_meas:.4f} mm, nominal s = {g.s:.4f} mm")
    assert abs(s_meas - g.s) < 1e-3, g.name
```

    sun    thickness on d from the outline 2.6176 mm, nominal s = 2.6183 mm
    planet thickness on d from the outline 2.0938 mm, nominal s = 2.0941 mm
    ring   thickness on d from the outline 2.6183 mm, nominal s = 2.6183 mm

------------------------------------------------------------------------

## Tests

## References

- ISO 1328-1:2013 — *Cylindrical gears — ISO system of flank tolerance
  classification — Part 1*.
- ISO/TR 10064-2:1996 — *Code of inspection practice — Radial composite
  deviations, runout, tooth thickness and backlash*.
- ISO 1340:1976 and DIN 3966-1:1978 — *Information to be given on
  drawings of involute gears*.
- DIN 3967:1978 — *Backlash, tooth thickness allowances, tooth thickness
  tolerances*.
- ISO 286-2:2010 — *Tables of standard tolerance classes and limit
  deviations for holes and shafts*.
- ISO 2639:2002 — *Steels — Determination and verification of the depth
  of carburized and hardened cases*.
