Sign in with STEVE

steve/to-package

Through-hole TO packages standing on the board: TO-220AB, TO-220AC, TO-220F, TO-262, TO-247AC, TO-126, TO-92 and the TO-18, TO-39 and TO-46 metal cans, from the makers' drawings.

v1.2.0 STEVE MIT 0
Isometric
part.py 278 lines · Python · STEVE runtime · checked
Download
1"""Through-hole transistor packages standing on the board: TO-220AB (3 leads), TO-220AC (2 leads), TO-247AC (3 leads) and TO-92 (straight
2leads). Lead 1 is at the origin, the leads run along +X, the moulded front faces -Y (TO-92: the flat face) and the metal tab or pad is at the
3back (+Y). The board is the XY plane: the leads' shoulders (TO-92: the seating plane) rest on it and the leads go down through it.
4Dimensions from the makers' package drawings, listed in the README."""
5from steve import Model
6import math
7
8package = "TO-220AB" # TO-220AB, TO-220AC, TO-220F, TO-220F-2, TO-262, TO-247AC, TO-126, TO-92, TO-18, TO-18-2, TO-39 or TO-46
9detail = "full" # full: body, tab and leads; simple: the body and tab only
10
11# Vishay Siliconix, "TO-220AB (High Voltage)", Package Information, document 92506, revision 30-Sep-2024 (DWG 6031), page 2 table; and
12# Vishay Semiconductors, "TO-220AC", Outline Dimensions, document 95221, revision 16-Jan-2026, table: (min, max) in mm, the model uses the
13# middle of each. A body+tab thickness, A1 tab thickness, A2 lead's back face to the tab's back, b lead width, b2 shoulder width,
14# c lead thickness, D overall height, D1 moulded body height, D2 metal on the back (from the top), E width, E1 back metal width, E2 tab notch
15# depth, e1 lead 1 to the last lead, H1 tab above the body, L lead length, L1 shoulder length, P hole diameter, Q hole centre below the top.
16TO220AB = dict(A=(4.25, 4.65), A1=(1.20, 1.34), A2=(2.563, 2.92), b=(0.71, 0.91), b2=(1.14, 1.78), c=(0.46, 0.61), D=(14.32, 15.86),
17 D1=(8.39, 8.79), D2=(12.20, 12.80), E=(9.96, 10.36), E1=(8.14, 8.74), E2=(0.59, 0.69), e1=(5.08, 5.08), H1=(6.30, 6.70),
18 L=(13.40, 14.40), L1=(3.65, 4.05), P=(3.60, 3.80), Q=(2.54, 2.94))
19TO220AC = dict(A=(4.25, 4.65), A1=(1.14, 1.40), A2=(2.56, 2.92), b=(0.69, 1.01), b2=(1.20, 1.73), c=(0.36, 0.61), D=(14.85, 15.25),
20 D1=(8.38, 9.02), D2=(11.68, 12.88), E=(10.11, 10.51), E1=(6.86, 8.89), E2=(0.76, 0.76), e1=(4.88, 5.28), H1=(5.84, 6.86),
21 L=(13.52, 14.02), L1=(3.32, 3.82), P=(3.54, 3.73), Q=(2.60, 3.00))
22# Vishay Siliconix, "TO-247AC (High Voltage)", Package Information, document 91360, revision 07-Sep-2026, version 1 (facility code 9),
23# table (nominal) in mm: A body thickness, A1 back face to the leads' back face, A2 exposed copper (drawn at the back face), b lead width,
24# b2 outer shoulders, b4 middle shoulder, c lead thickness, D height, D1 x E1 the exposed copper, D2 its top below the top, E width, E2 side
25# slot width, e pitch, L lead length, L1 shoulder length, P hole diameter, P1 copper ring round the hole (ref), Q hole and slots below the top.
26TO247AC = dict(A=5.02, A1=2.41, A2=1.27, b=1.20, b2=2.00, b4=3.00, c=0.50, D=20.55, D1=16.76, D2=0.66, E=15.70, E1=14.02, E2=4.91,
27 e=5.46, L=15.15, L1=4.06, P=3.61, P1=7.19, Q=5.50)
28# Texas Instruments, LP0003A "TO-92 - 5.34 mm max height", drawing 4215214/C 04/2025 (ti.com/lit/pdf/msot002), straight lead option:
29# (min, max) in mm, the model uses the middle: W body width, H body height, T body depth (round back to flat face), K round back to the leads'
30# centre line, F flat face width (min), b lead width, c lead thickness, e pitch (1.27 +/-0.13), L lead length (12.7 min), S the seating plane
31# below the body ((1.5) typical, reference).
32TO92 = dict(W=(4.44, 5.21), H=(4.32, 5.34), T=(3.17, 4.19), K=(2.03, 2.67), F=(3.43, 3.43), b=(0.38, 0.55), c=(0.35, 0.43), e=(1.27, 1.27),
33 L=(12.7, 12.7), S=(1.5, 1.5))
34# Central Semiconductor, "Package Details - TO-18" (REV: R1; R0 21-June 2004) and "TO-18 2-Lead Case" (REV: R0; 13-March 2013), table
35# (min, max) in mm, the model uses the middle (C: its max, the only value; E: 12.70 min): A flange Ø, B can Ø, C flange thickness, D height,
36# E lead length, F lead Ø, G lead circle Ø (3 leads) or lead spacing (2 leads), H lead 2 off the line of leads 1 and 3, I tab width,
37# J tab length (read as beyond the flange's edge); the tab is at 45 deg, beside lead 1.
38TO18 = dict(A=(5.31, 5.84), B=(4.52, 4.95), C=(0.76, 0.76), D=(4.32, 5.33), E=(12.70, 12.70), F=(0.41, 0.48), G=(2.54, 2.54), H=(1.27, 1.27),
39 I=(0.91, 1.17), J=(0.71, 1.22))
40# Proportions, for looks (README): the TO-220 tab's side notches are 1.4 high, from 1.4 to 2.8 below the top (as drawn); the TO-220AC's cut-off middle lead isn't
41# modelled; the TO-247's side slots are half-round (Ø E2) and the copper ring P1 isn't modelled; the TO-92's flat face is cut from a round body
42# W across; every lead's shoulder narrows to the lead in one step.
43NOTCH = (1.4, 2.8)
44# Central Semiconductor, "Package Details - TO-39" (REV R1, R0 21-June 2004) and "Package Details - TO-46" (REV R2, R0 17-July 2008), tables
45# (min, max) in mm, the letters as TO18's (C: the max, the only value; E: 12.70 min). TO-46's sheet names the tab width J and its length K;
46# here they are I and J, as on the TO-18 and TO-39 sheets.
47TO39 = dict(A=(8.51, 9.40), B=(8.00, 8.51), C=(1.02, 1.02), D=(6.10, 6.60), E=(12.70, 12.70), F=(0.41, 0.53), G=(5.08, 5.08), H=(2.54, 2.54),
48 I=(0.71, 0.86), J=(0.74, 1.14))
49TO46 = dict(A=(5.31, 5.84), B=(4.52, 4.95), C=(1.02, 1.02), D=(1.65, 2.16), E=(12.70, 12.70), F=(0.41, 0.53), G=(2.54, 2.54), H=(1.27, 1.27),
50 I=(0.91, 1.17), J=(0.71, 1.22))
51CANS = {"TO-18": TO18, "TO-18-2": TO18, "TO-39": TO39, "TO-46": TO46}
52# Central Semiconductor, "Package Details - TO-126" (REV R3, R0 21-June 2004), table (min, max) in mm, the middle (single values as given):
53# A body thickness, B the leads' centre plane from the back, C lead thickness, D width, E hole centre below the top, F hole diameter,
54# G body height, H lead length below the body (shoulder included), J lead width, K pitch, L lead 1 to lead 3, M shoulder width, N shoulder
55# length. The back carries the mounting plate ("Mounting Plate Common to Pin 2").
56TO126 = dict(A=(2.40, 2.80), B=(1.27, 1.27), C=(0.38, 0.75), D=(7.40, 8.50), E=(3.75, 3.75), F=(3.00, 3.40), G=(10.50, 12.00),
57 H=(15.70, 15.70), J=(0.62, 0.90), K=(2.25, 2.25), L=(4.50, 4.50), M=(1.14, 1.40), N=(2.10, 2.10))
58# Central Semiconductor, "Package Details - TO-220FP Case" (REV R5, R2 06-June 2023) and "TO-220FP-2 Case" (REV R2, R0 28-January 2015),
59# tables (min, max) in mm; where a sheet gives only a maximum the model uses it. A body thickness, B the thinner top part's thickness,
60# C the leads' centre plane from the back, D lead thickness, E width, F the thin top part's height, G body height, H shoulder length,
61# J lead length below the body, K lead width, L pitch (TO-220FP-2: each lead's offset from the centre line), M hole centre below the top,
62# N hole diameter, P shoulder width. The fully moulded body has no exposed metal.
63TO220F = dict(A=(4.20, 5.12), B=(2.30, 3.30), C=(2.50, 3.10), D=(0.80, 0.80), E=(9.70, 10.63), F=(6.06, 7.00), G=(14.80, 16.25),
64 H=(4.50, 4.50), J=(12.78, 13.80), K=(0.50, 0.90), L=(2.54, 2.54), M=(2.55, 3.55), N=(2.95, 3.40), P=(1.00, 1.47))
65TO220F2 = dict(A=(4.80, 4.80), B=(3.12, 3.12), C=(2.50, 2.90), D=(0.81, 0.81), E=(10.31, 10.31), F=(6.30, 6.90), G=(14.80, 15.40),
66 H=(4.10, 4.10), J=(13.00, 13.80), K=(0.90, 0.90), L=(2.55, 2.55), M=(2.55, 2.85), N=(3.00, 3.40), P=(1.40, 1.40))
67# Proportions, for looks: the TO-126's mounting plate on the back is 0.3 thick, set in 0.08 x the width from the sides and the top and
68# ending 0.1 x the height above the bottom (drawn dashed in the front view, not dimensioned); the TO-220FP-2's cut-off middle lead stub
69# (O, P, Q on its sheet) isn't modelled.
70PLATE_T = 0.3
71# Vishay Siliconix, "I2PAK (TO-262) (High Voltage)", Package Information, document 91367, revision 27-Oct-08 (DWG 5977), table (min, max)
72# in mm, the middle (a single value where the table gives only a min or a max: D1, E1 min; L1 max). A body thickness, A1 the leads' back face
73# to the back, b lead width, b2 shoulder width, c lead thickness, c2 tab thickness, D body height, D1 x E1 the thermal pad on the back,
74# E width, e pitch, L lead length below the body, L1 the tab above the body, L2 shoulder length.
75TO262 = dict(A=(4.06, 4.83), A1=(2.03, 3.02), b=(0.51, 0.99), b2=(1.14, 1.78), c=(0.38, 0.74), c2=(1.14, 1.65), D=(8.38, 9.65), D1=(6.86, 6.86),
76 E=(9.65, 10.67), E1=(6.22, 6.22), e=(2.54, 2.54), L=(13.46, 14.10), L1=(1.65, 1.65), L2=(3.56, 3.71))
77# Proportions, for looks: the TO-262 tab above the body is the body's width with its top corners chamfered 0.04 x the width (drawn, not
78# dimensioned), and the thermal pad on the back is flush, from the body's top down.
79
80PACKAGES = ("TO-220AB", "TO-220AC", "TO-220F", "TO-220F-2", "TO-262", "TO-247AC", "TO-126", "TO-92", "TO-18", "TO-18-2", "TO-39", "TO-46")
81if package not in PACKAGES:
82 raise ValueError("package: " + ", ".join(PACKAGES))
83
84
85def mid(table):
86 return {k: (v[0] + v[1]) / 2 if isinstance(v, tuple) else v for k, v in table.items()}
87
88
89model = Model()
90
91
92def box(fid, x0, x1, y0, y1, z0, z1, body, op, name):
93 model.plane(f"{fid}_plane", on="XY", offset=z0, name=name)
94 with model.sketch(f"{fid}_sketch", on=f"{fid}_plane", name=name) as sk:
95 sk.rect(f"{fid}_rect", (x0, y0), (x1, y1))
96 model.extrude(fid, f"{fid}_sketch", distance=z1 - z0, op=op, body=body, name=name)
97
98
99def through_y(fid, profile, y0, y1, body, op, name):
100 """A prism of `profile` (x, z points, or a circle (x, z, r)) from y0 to y1 (y0 > y1: an XZ plane at y0 extrudes along -Y)."""
101 model.plane(f"{fid}_plane", on="XZ", offset=-y0, name=name)
102 with model.sketch(f"{fid}_sketch", on=f"{fid}_plane", name=name) as sk:
103 if len(profile) == 3 and not isinstance(profile[0], tuple):
104 sk.circle(f"{fid}_circle", (profile[0], profile[1]), profile[2])
105 else:
106 sk.polyline(f"{fid}_outline", profile, closed=True)
107 model.extrude(fid, f"{fid}_sketch", distance=y0 - y1, op=op, body=body, name=name)
108
109
110def leads(xs, b, c, L, shoulder, widths, top):
111 """Each lead: its shoulder (width from `widths`) from the body's underside `top` down `shoulder`, then the lead (b x c) to L below it."""
112 model.plane("leads_plane", on="XY", offset=top - L, name="Leads")
113 with model.sketch("leads_sketch", on="leads_plane", name="Leads") as sk:
114 for i, x in enumerate(xs):
115 sk.rect(f"lead_{i}", (x - b / 2, -c / 2), (x + b / 2, c / 2))
116 model.extrude("leads", "leads_sketch", distance=L - shoulder, op="new", body="leads_body", name="Leads")
117 model.plane("shoulders_plane", on="XY", offset=top - shoulder, name="Lead shoulders")
118 with model.sketch("shoulders_sketch", on="shoulders_plane", name="Lead shoulders") as sk:
119 for i, (x, w) in enumerate(zip(xs, widths)):
120 sk.rect(f"shoulder_{i}", (x - w / 2, -c / 2), (x + w / 2, c / 2))
121 model.extrude("shoulders", "shoulders_sketch", distance=shoulder, op="join", body="leads_body", name="Lead shoulders")
122
123
124bodies = {}
125if package in ("TO-220AB", "TO-220AC"):
126 t = mid(TO220AB if package == "TO-220AB" else TO220AC)
127 xs = [0.0, t["e1"] / 2, t["e1"]] if package == "TO-220AB" else [0.0, t["e1"]]
128 cx = t["e1"] / 2
129 back = t["c"] / 2 + t["A2"]
130 front = back - t["A"]
131 z0 = t["L1"] # the shoulders rest on the board
132 top = z0 + t["D"]
133 E, E1 = t["E"], t["E1"]
134 # Moulded body, with the back recessed where the metal shows (E1 wide, from the body's top down to D2 below the package's top).
135 box("body", cx - E / 2, cx + E / 2, front, back, z0, z0 + t["D1"], "body_body", "new", "Body")
136 box("back_recess", cx - E1 / 2, cx + E1 / 2, back - t["A1"], back, top - t["D2"], z0 + t["D1"], "body_body", "cut", "Back metal recess")
137 # Metal tab: E wide above the body, E1 wide down the back; side notches E2 deep at the hole; the hole P at Q below the top.
138 box("tab", cx - E / 2, cx + E / 2, back - t["A1"], back, z0 + t["D1"], top, "tab_body", "new", "Tab")
139 box("tab_back", cx - E1 / 2, cx + E1 / 2, back - t["A1"], back, top - t["D2"], z0 + t["D1"], "tab_body", "join", "Tab")
140 zq = top - t["Q"]
141 for side, x0 in (("left", cx - E / 2), ("right", cx + E / 2 - t["E2"])):
142 box(f"notch_{side}", x0, x0 + t["E2"], back - t["A1"], back, top - NOTCH[1], top - NOTCH[0], "tab_body", "cut", "Tab notch")
143 through_y("tab_hole", (cx, zq, t["P"] / 2), back + 0.1, back - t["A1"] - 0.1, "tab_body", "cut", "Mounting hole")
144 bodies = {"body_body": ("pa6", "#1c1c1e"), "tab_body": ("copper", "#c8ccd0")}
145 if detail == "full":
146 leads(xs, t["b"], t["c"], t["L"], t["L1"], [t["b2"]] * len(xs), z0)
147elif package == "TO-262":
148 # Moulded body with the metal tab: c2 thick, flush with the back, showing as the pad D1 x E1 from the body's top down and rising L1 above it.
149 t = mid(TO262)
150 xs = [0.0, t["e"], 2 * t["e"]]
151 cx = t["e"]
152 back = t["c"] / 2 + t["A1"]
153 front = back - t["A"]
154 z0 = t["L2"] # the shoulders rest on the board
155 top = z0 + t["D"]
156 E, k = t["E"], 0.04 * t["E"]
157 box("body", cx - E / 2, cx + E / 2, front, back, z0, top, "body_body", "new", "Body")
158 box("pad_recess", cx - t["E1"] / 2, cx + t["E1"] / 2, back - t["c2"], back, top - t["D1"], top, "body_body", "cut", "Thermal pad recess")
159 box("pad", cx - t["E1"] / 2, cx + t["E1"] / 2, back - t["c2"], back, top - t["D1"], top, "tab_body", "new", "Thermal pad")
160 through_y("tab_top", [(cx - E / 2, top), (cx + E / 2, top), (cx + E / 2, top + t["L1"] - k), (cx + E / 2 - k, top + t["L1"]),
161 (cx - E / 2 + k, top + t["L1"]), (cx - E / 2, top + t["L1"] - k)], back, back - t["c2"], "tab_body", "join", "Tab")
162 bodies = {"body_body": ("pa6", "#1c1c1e"), "tab_body": ("copper", "#c8ccd0")}
163 if detail == "full":
164 leads(xs, t["b"], t["c"], t["L"], t["L2"], [t["b2"]] * 3, z0)
165elif package in ("TO-220F", "TO-220F-2"):
166 # Fully moulded (no exposed metal): the full thickness A up to F below the top, then the thinner top part B thick, its back face flush.
167 t = mid(TO220F if package == "TO-220F" else TO220F2)
168 xs = [0.0, t["L"], 2 * t["L"]] if package == "TO-220F" else [0.0, 2 * t["L"]]
169 cx = xs[-1] / 2
170 back = t["C"]
171 front = back - t["A"]
172 z0 = t["H"] # the shoulders rest on the board
173 top = z0 + t["G"]
174 E = t["E"]
175 box("body", cx - E / 2, cx + E / 2, front, back, z0, top - t["F"], "body_body", "new", "Body")
176 box("body_top", cx - E / 2, cx + E / 2, back - t["B"], back, top - t["F"], top, "body_body", "join", "Body")
177 through_y("hole", (cx, top - t["M"], t["N"] / 2), back + 0.1, back - t["B"] - 0.1, "body_body", "cut", "Mounting hole")
178 bodies = {"body_body": ("pa6", "#1c1c1e")}
179 if detail == "full":
180 leads(xs, t["K"], t["D"], t["J"], t["H"], [t["P"]] * len(xs), z0)
181elif package == "TO-126":
182 # Moulded body with the mounting plate on its back and the hole through both; leads at pitch K, their centre plane B in front of the back.
183 t = mid(TO126)
184 xs = [0.0, t["K"], 2 * t["K"]]
185 cx = t["K"]
186 back = t["B"]
187 front = back - t["A"]
188 z0 = t["N"]
189 top = z0 + t["G"]
190 W = t["D"]
191 box("body", cx - W / 2, cx + W / 2, front, back, z0, top, "body_body", "new", "Body")
192 m = 0.08 * W
193 box("plate_recess", cx - W / 2 + m, cx + W / 2 - m, back - PLATE_T, back, z0 + 0.1 * t["G"], top - m, "body_body", "cut", "Plate recess")
194 box("plate", cx - W / 2 + m, cx + W / 2 - m, back - PLATE_T, back, z0 + 0.1 * t["G"], top - m, "plate_body", "new", "Mounting plate")
195 through_y("hole", (cx, top - t["E"], t["F"] / 2), back + 0.1, front - 0.1, "body_body", "cut", "Mounting hole")
196 through_y("plate_hole", (cx, top - t["E"], t["F"] / 2), back + 0.1, front - 0.1, "plate_body", "cut", "Mounting hole")
197 bodies = {"body_body": ("pa6", "#1c1c1e"), "plate_body": ("copper", "#c8ccd0")}
198 if detail == "full":
199 leads(xs, t["J"], t["C"], t["H"], t["N"], [t["M"]] * 3, z0)
200elif package == "TO-247AC":
201 t = TO247AC
202 xs = [0.0, t["e"], 2 * t["e"]]
203 cx = t["e"]
204 back = t["c"] / 2 + t["A1"]
205 front = back - t["A"]
206 z0 = t["L1"]
207 top = z0 + t["D"]
208 E = t["E"]
209 box("body", cx - E / 2, cx + E / 2, front, back, z0, top, "body_body", "new", "Body")
210 zq = top - t["Q"]
211 for side, x in (("left", cx - E / 2), ("right", cx + E / 2)):
212 through_y(f"slot_{side}", (x, zq, t["E2"] / 2), back + 0.1, front - 0.1, "body_body", "cut", "Side slot")
213 # Exposed copper on the back, flush: D1 x E1 from D2 below the top, A2 thick, with the hole through it.
214 box("pad_recess", cx - t["E1"] / 2, cx + t["E1"] / 2, back - t["A2"], back, top - t["D2"] - t["D1"], top - t["D2"], "body_body", "cut", "Copper recess")
215 box("pad", cx - t["E1"] / 2, cx + t["E1"] / 2, back - t["A2"], back, top - t["D2"] - t["D1"], top - t["D2"], "pad_body", "new", "Exposed copper")
216 through_y("hole", (cx, zq, t["P"] / 2), back + 0.1, front - 0.1, "body_body", "cut", "Mounting hole")
217 through_y("pad_hole", (cx, zq, t["P"] / 2), back + 0.1, front - 0.1, "pad_body", "cut", "Mounting hole")
218 for side, x in (("left", cx - E / 2), ("right", cx + E / 2)):
219 through_y(f"pad_slot_{side}", (x, zq, t["E2"] / 2), back + 0.1, front - 0.1, "pad_body", "cut", "Side slot")
220 bodies = {"body_body": ("pa6", "#1c1c1e"), "pad_body": ("copper", "#c8ccd0")}
221 if detail == "full":
222 leads(xs, t["b"], t["c"], t["L"], t["L1"], [t["b2"], t["b4"], t["b2"]], z0)
223elif package in CANS:
224 # Metal can: the flange (header) on the board, the can on it; leads on a circle round the axis (lead 1 at the origin, lead 3 or lead 2
225 # at +X by G, the 3-lead part's lead 2 H off that line along -Y); the tab at 45 deg toward -X +Y, beside lead 1.
226 t = mid(CANS[package])
227 cx = t["G"] / 2
228 xs = [(0.0, 0.0), (t["G"], 0.0)] if package == "TO-18-2" else [(0.0, 0.0), (cx, -t["H"]), (t["G"], 0.0)]
229 model.plane("flange_plane", on="XY", offset=0.0, name="Flange")
230 with model.sketch("flange_sketch", on="flange_plane", name="Flange") as sk:
231 sk.circle("flange_round", (cx, 0.0), t["A"] / 2)
232 u = (-math.sqrt(0.5), math.sqrt(0.5))
233 v = (u[1], -u[0])
234 r0, r1, w = t["A"] / 2 - 0.3, t["A"] / 2 + t["J"], t["I"] / 2
235 sk.polyline("tab_outline", [(cx + u[0] * r + v[0] * s, u[1] * r + v[1] * s) for r, s in ((r0, -w), (r1, -w), (r1, w), (r0, w))], closed=True)
236 model.extrude("flange", "flange_sketch", distance=t["C"], op="new", body="header_body", name="Flange and tab")
237 model.plane("can_plane", on="XY", offset=t["C"], name="Can")
238 with model.sketch("can_sketch", on="can_plane", name="Can") as sk:
239 sk.circle("can_round", (cx, 0.0), t["B"] / 2)
240 model.extrude("can", "can_sketch", distance=t["D"] - t["C"], op="new", body="can_body", name="Can")
241 bodies = {"header_body": ("nickel", "#c9ccd1"), "can_body": ("steel-dc01", "#d5d8dc")}
242 if detail == "full":
243 model.plane("leads_plane", on="XY", offset=-t["E"], name="Leads")
244 with model.sketch("leads_sketch", on="leads_plane", name="Leads") as sk:
245 for i, (x, y) in enumerate(xs):
246 sk.circle(f"lead_{i}", (x, y), t["F"] / 2)
247 model.extrude("leads", "leads_sketch", distance=t["E"], op="new", body="leads_body", name="Leads")
248else:
249 t = mid(TO92)
250 xs = [0.0, t["e"], 2 * t["e"]]
251 cx = t["e"]
252 R = t["W"] / 2
253 yc = t["K"] - R # the round body's axis: K from the round back to the leads, so the back is at +K
254 flat = t["K"] - t["T"] # the flat face (-Y)
255 z0 = t["S"]
256 n = 24
257 a0 = math.asin(max(-1.0, min(1.0, (flat - yc) / R)))
258 pts = [(cx + R * math.cos(a), yc + R * math.sin(a)) for a in (a0 + (math.pi - 2 * a0) * k / n for k in range(n + 1))]
259 model.plane("body_plane", on="XY", offset=z0, name="Body")
260 with model.sketch("body_sketch", on="body_plane", name="Body") as sk:
261 sk.polyline("body_outline", [(cx + R * math.cos(a0), flat)] + pts[1:-1] + [(cx - R * math.cos(a0), flat)], closed=True)
262 model.extrude("body", "body_sketch", distance=t["H"], op="new", body="body_body", name="Body")
263 bodies = {"body_body": ("pa6", "#1c1c1e")}
264 if detail == "full":
265 model.plane("leads_plane", on="XY", offset=z0 - t["L"], name="Leads")
266 with model.sketch("leads_sketch", on="leads_plane", name="Leads") as sk:
267 for i, x in enumerate(xs):
268 sk.rect(f"lead_{i}", (x - t["b"] / 2, -t["c"] / 2), (x + t["b"] / 2, t["c"] / 2))
269 model.extrude("leads", "leads_sketch", distance=t["L"], op="new", body="leads_body", name="Leads")
270if detail == "full":
271 bodies["leads_body"] = ("nickel", "#d8c58a") if package in CANS else ("copper", "#c9ccd1")
272# Materials, for looks and a rough mass: the moulding is epoxy (nylon, PA6, the nearest in the list), the tab and pad copper (nickel or tin
273# plated), the leads tinned copper. TO-18 (Central's material sheets): the header and leads Kovar (density 8.36; nickel, 8.9, is the nearest
274# in the list), the can a nickel-plated iron alloy (steel).
275for body, (material, colour) in bodies.items():
276 model.material(material, bodies=[body], color=colour)
277result = model.result()
278

A through-hole transistor, regulator or diode package standing on the board, from the maker's package drawing: TO-220AB (3 leads) and TO-220AC (2 leads) with the metal tab and its hole, TO-247AC with its exposed copper and side slots, TO-92 with straight leads, TO-126 with its mounting plate, the fully moulded TO-220F with 3 or 2 leads, TO-262 (I2PAK) with its tab, and the TO-18 (2 or 3 leads), TO-39 and TO-46 metal cans. Lead 1 at the origin, the leads along +X, the moulded front toward -Y. See the README.

TO package (through-hole)

A through-hole transistor, regulator or diode package standing on the board, built from the maker's package drawing. These are the JEDEC outlines that every maker builds:

package Leads Body (W x thickness x height) Source
TO-220AB 3, 2.54 pitch 10.16 x 4.45 x 15.09 (tab included) Vishay Siliconix 92506
TO-220AC 2, 5.08 apart 10.31 x 4.45 x 15.05 (tab included) Vishay Semiconductors 95221
TO-220F 3, 2.54 pitch 10.17 x 4.66 x 15.53, fully moulded Central Semiconductor TO-220FP
TO-220F-2 2, 5.10 apart 10.31 x 4.80 x 15.10, fully moulded Central Semiconductor TO-220FP-2
TO-262 3, 2.54 pitch 10.16 x 4.45 x 10.67 (tab included) Vishay Siliconix 91367
TO-247AC 3, 5.46 pitch 15.70 x 5.02 x 20.55 Vishay Siliconix 91360
TO-126 3, 2.25 pitch 7.95 x 2.60 x 11.25 Central Semiconductor TO-126
TO-92 3 straight, 1.27 pitch 4.83 x 3.68 x 4.83 TI LP0003A
TO-18 3, on a Ø 2.54 circle flange Ø 5.58, can Ø 4.74, 4.83 high Central Semiconductor TO-18
TO-18-2 2, 2.54 apart as TO-18 Central Semiconductor TO-18 2-Lead
TO-39 3, on a Ø 5.08 circle flange Ø 8.96, can Ø 8.26, 6.35 high Central Semiconductor TO-39
TO-46 3, on a Ø 2.54 circle flange Ø 5.58, can Ø 4.74, 1.91 high Central Semiconductor TO-46

Lead 1 is at the origin and the leads run along +X. The moulded front faces -Y (on the TO-92, the flat face), and the metal tab, exposed copper or mounting plate is at the back (+Y).

  • TO-220, TO-220F, TO-262, TO-247 and TO-126. The leads' shoulders rest on the board (the XY plane), and the leads continue their full length down through it.
  • TO-92. The body sits 1.5 above the board (TI's reference seating plane).
  • TO-18, TO-39 and TO-46. The flange sits on the board. Leads 1 and 3 are G apart along +X (2.54, or 5.08 on the TO-39), and lead 2 is H off that line along -Y (1.27, or 2.54). The tab is at 45°, beside lead 1.

detail = "simple" leaves out the leads.

Source

Each table gives a minimum and a maximum. The part uses the middle of the two, except where noted. part.py holds every table as read.

  • Vishay Siliconix, "TO-220AB (High Voltage)", Package Information, document 92506, revision 30-Sep-2024 (DWG 6031), from vishay.com.
    • Page 1, drawing: front, side and back views and section F-F.
    • Page 2, table (mm): A 4.25–4.65, A1 1.20–1.34, A2 2.563–2.92, b 0.71–0.91, b2 1.14–1.78, c 0.46–0.61, D 14.32–15.86, D1 8.39–8.79, D2 12.20–12.80, E 9.96–10.36, E1 8.14–8.74, E2 0.59–0.69, e 2.54, e1 5.08, H1 6.30–6.70, L 13.40–14.40, L1 3.65–4.05, ØP 3.60–3.80, Q 2.54–2.94.
  • Vishay Semiconductors, "TO-220AC", Outline Dimensions, document 95221, revision 16-Jan-2026, from vishay.com. The drawing and table use the same letters. Here e1 is 4.88–5.28, the spacing of the two leads, and E2 is 0.76 max. The outline conforms to JEDEC TO-220AC.
  • Vishay Siliconix, "I2PAK (TO-262) (High Voltage)", Package Information, document 91367, revision 27-Oct-08 (DWG 5977), from vishay.com. Table (mm): A 4.06–4.83, A1 2.03–3.02, b 0.51–0.99, b2 1.14–1.78, c 0.38–0.74, c2 1.14–1.65, D 8.38–9.65, D1 6.86 min, E 9.65–10.67, E1 6.22 min, e 2.54, L 13.46–14.10, L1 1.65 max, L2 3.56–3.71. Where the table gives only a minimum or a maximum, the part uses it.
  • Vishay Siliconix, "TO-247AC (High Voltage)", Package Information, document 91360, revision 07-Sep-2026, from vishay.com. The part uses version 1 (facility code 9) with its nominal values:
    • A 5.02, A1 2.41, A2 1.27, b 1.20, b2 2.00, b4 3.00, c 0.50, D 20.55, D1 16.76, D2 0.66, E 15.70, E1 14.02, E2 4.91, e 5.46, L 15.15, L1 4.06, ØP 3.61, ØP1 7.19 (ref), Q 5.50.
    • The package reference is JEDEC TO-247, variation AC.
  • Texas Instruments, LP0003A "TO-92 - 5.34 mm max height", drawing 4215214/C 04/2025 (ti.com/lit/pdf/msot002), straight lead option, page 1:
    • body 4.44–5.21 wide, 4.32–5.34 high and 3.17–4.19 deep;
    • the round back 2.03–2.67 from the leads, and the flat face at least 3.43 wide;
    • leads 0.38–0.55 x 0.35–0.43, at 1.27 ±0.13 pitch, 12.7 min long;
    • the seating plane (1.5) typical below the body;
    • reference JEDEC TO-226, variation AA.
  • Central Semiconductor, "Package Details - TO-18" (REV R1, R0 21-June 2004) and "TO-18 2-Lead Case" (REV R0, 13-March 2013), from centralsemi.com.
    • Table (mm): A flange Ø 5.31–5.84, B can Ø 4.52–4.95, C flange 0.76 max (used as is), D height 4.32–5.33, E lead length 12.70 min (used as is), F lead Ø 0.41–0.48, G 2.54 (the lead circle, or the 2-lead part's spacing), H 1.27 (3 leads), and tab width 0.91–1.17 and tab length 0.71–1.22 at 45° (I and J; on the 2-lead sheet, H and J).
    • Both sheets' material sheets give a Kovar header and leads and a nickel-plated iron-alloy can.
  • Central Semiconductor, "Package Details - TO-39" (REV R1, R0 21-June 2004) and "Package Details - TO-46" (REV R2, R0 17-July 2008), from centralsemi.com. The tables use the TO-18 sheet's letters:
    • TO-39 (mm): A flange Ø 8.51–9.40, B can Ø 8.00–8.51, C flange 1.02 max (used as is), D height 6.10–6.60, E lead length 12.70 min (used as is), F lead Ø 0.41–0.53, G 5.08 (the lead circle), H 2.54, I tab width 0.71–0.86, J tab length 0.74–1.14.
    • TO-46 (mm): A 5.31–5.84, B 4.52–4.95, C 1.02 max, D 1.65–2.16, E 12.70 min, F 0.41–0.53, G 2.54, H 1.27, and the tab width 0.91–1.17 and length 0.71–1.22 (its J and K).
  • Central Semiconductor, "Package Details - TO-126" (REV R3, R0 21-June 2004), from centralsemi.com. Table (mm): A thickness 2.40–2.80, B the leads' centre plane 1.27 from the back, C lead thickness 0.38–0.75, D width 7.40–8.50, E hole centre 3.75 below the top, F hole Ø 3.00–3.40, G body height 10.50–12.00, H lead length 15.70 below the body, J lead width 0.62–0.90, K pitch 2.25 (L 4.50 from lead 1 to lead 3), M shoulder width 1.14–1.40, N shoulder length 2.10. "Mounting Plate Common to Pin 2", on the back.
  • Central Semiconductor, "Package Details - TO-220FP Case" (REV R5, R2 06-June 2023) and "TO-220FP-2 Case" (REV R2, R0 28-January 2015), from centralsemi.com.
    • TO-220FP (mm): A thickness 4.20–5.12, B the top part's thickness 2.30–3.30, C the leads' centre plane 2.50–3.10 from the back, D lead thickness 0.80 max, E width 9.70–10.63, F the top part's height 6.06–7.00, G body height 14.80–16.25, H shoulder length 4.50 max, J lead length 12.78–13.80, K lead width 0.50–0.90, L pitch 2.54, M hole centre 2.55–3.55 below the top, N hole Ø 2.95–3.40, P shoulder width 1.00–1.47.
    • TO-220FP-2 (mm): A 4.80 max, B 3.12 max, C 2.50–2.90, D 0.81 max, E 10.31 max, F 6.30–6.90, G 14.80–15.40, H 4.10 max, J 13.00–13.80, K 0.90 max, L 2.55 (each lead from the centre line, so 5.10 apart), M 2.55–2.85, N 3.00–3.40, P 1.40 max. Where the sheets give only a maximum, the part uses it.

How the letters are read:

  • TO-220 and TO-247. A2 (TO-247: A1) runs from the leads' back face to the back of the package. The leads' shoulders (b2, b4) are L1 long. On the TO-220, the metal tab is A1 thick: E wide above the moulding (H1 = D - D1), and E1 wide down the back to D2 below the top. On the TO-247, the exposed copper (D1 x E1, from D2 below the top) is taken as A2 thick, the dimension drawn at the back face. The TO-247's side slots are Ø E2, at Q below the top, the same height as the hole.
  • TO-92. The body is a round of Ø W, cut flat at the depth T, with the leads K in front of the round back.
  • TO-18, TO-39 and TO-46. The tab length J is read as reaching beyond the flange's edge.
  • TO-262. A1 is read as on the TO-220: from the leads' back face to the back. The tab is c2 thick and flush with the back. It shows on the back as the thermal pad D1 x E1, from the body's top down (Section A-A), and rises L1 above the body. The shoulders (b2) are L2 long, and L is the lead's length from the body.
  • TO-220F. The side view draws the body A thick up to F below the top, and above that B thick with the back face flush, so the hole is in the thinner part. H is the shoulder's length below the body, J the lead's from the body.
  • TO-126. H is the lead's length from the body, shoulder included, and B runs from the back (the side the sheet marks "BACKSIDE") to the leads' centre plane.

Proportions, for looks only. The drawings show these but don't dimension them:

  • The TO-220 tab's side notches, E2 deep, are 1.4 high, from 1.4 to 2.8 below the top, as drawn.
  • The TO-262 tab above the body is the body's full width, with its top corners chamfered 0.04 x the width.
  • The TO-126's mounting plate on the back, drawn dashed in the front view, is 0.3 thick, set in 0.08 x the width from the sides and the top, and ends 0.1 x the height above the bottom.
  • Not modelled: the TO-220AC's and TO-220FP-2's cut-off middle lead, the TO-220's ejector dimple, the TO-247's copper ring ØP1, and the bodies' 5° draft and small radii.
  • Every lead's shoulder narrows to the lead in one step.
  • Materials are for looks and a rough mass:
    • The mouldings are epoxy. Nylon (PA6) is the nearest material in the list.
    • The TO-220 and TO-262 tabs, the TO-247 pad and the TO-126 plate are copper, and the leads are tinned copper.
    • The TO-18, TO-39 and TO-46 headers and leads are Kovar (8.36), so nickel (8.9), the nearest in the list. Their cans are steel.

Catalogue models

The reference models were measured against the drawings, and each falls inside the drawing's tolerances:

  • TO-220-3_Vertical. 10.26 wide, 4.46 thick and 15.07 high with the tab. Leads 0.86 x 0.53 with 1.46 shoulders at 2.54. The leads' back face is 2.90 from the back.
  • TO-220-2_Vertical. The same body, with leads at 0 and 5.08.
  • TO-247-3_Vertical. 15.90 wide (E max 15.87, so 0.03 over), 5.03 thick and 20.7 high. Leads 1.20 with shoulders 2.03 and 3.00 at 5.45.
  • TO-92 and TO-92_Inline. 4.83 wide, 3.75 deep. Leads at 1.27, with the flat face 1.33 in front of the leads and the round back 2.42 behind them.
  • TO-18-3. Flange Ø 5.84, can Ø 4.95 and leads Ø 0.48 (the drawing's maximums). Lead 2 is 1.27 off the line of leads 1 and 3, and the tab is at 45° beside lead 1.

Added in 1.1.0, measured the same way:

  • TO-39-3. Flange Ø 9.40 and can Ø 8.50 (the drawing's maximums), 6.5 high, leads Ø 0.48 on a Ø 5.08 circle with lead 2 2.54 off the line. The model has no tab; the drawing has one.
  • TO-46-3. Flange Ø 5.84 with the 45° tab, can Ø 4.80 tapering to 4.73, 2.2 high (D max 2.16, so 0.04 over), leads Ø 0.48 on a Ø 2.54 circle with lead 2 1.27 off the line.
  • TO-126-3_Vertical. 8.0 wide and 11.0 high, as drawn, but 3.25 thick where Central's drawing allows 2.40–2.80 (0.45 over). Leads 0.75 x 0.53 at 2.28 (Central 2.25, so 0.03 apart), their plane 1.25 from the back. Only the middle lead has a shoulder (1.6 wide), where Central draws one on every lead, 1.14–1.40 wide.
  • TO-220F-3_Vertical. 10.16 wide, 4.70 thick, with the top part 2.54 thick, and 15.6 high. Leads 0.80 x 0.53 with 1.36 shoulders at 2.54. The leads' plane is 3.29 from the back, where Central's drawing gives 2.50–3.10 (0.19 over).
  • TO-220F-2_Vertical. The same body, with leads at 0 and 5.08 (Central 5.10).

Added in 1.2.0:

  • TO-262-3_Vertical. 10.01 wide, 4.50 thick, the body 8.85 high, and the tab 1.37 above it, 1.27 thick. Leads 0.80 x 0.50 with 1.27 shoulders at 2.54. The leads' back face is 2.40 from the back. These are all within Vishay's drawing, except that the model's shoulders are about 3.15 long (L2 3.56–3.71) and its leads reach 10.5 below the body (L 13.46–14.10).

The names name the JEDEC package, so they map to the maker's drawing of it, with the pitch and lead order as named, and the differences are listed here.

The reference models stand their bodies at different heights above the board: the TO-92 at 2.5, and the TO-18, TO-39 and TO-46 at about 5. The drawings don't give these, so this part uses the drawings' own seating.

So these map: TO-220-3_Vertical (TO-220AB), TO-220-2_Vertical (TO-220AC), TO-247-3_Vertical (TO-247AC), TO-92 and TO-92_Inline (TO-92), TO-18-3 (TO-18), TO-18-2 (TO-18-2), TO-39-3 (TO-39), TO-46-3 (TO-46), TO-126-3_Vertical (TO-126), TO-220F-3_Vertical (TO-220F), TO-220F-2_Vertical (TO-220F-2) and TO-262-3_Vertical (TO-262).

These stay "no table read yet" (COVERAGE.md):

  • the TO-92 models with leads formed to 2.54 (_Wide). TI's formed leads are 2.4 to 2.9 apart, with a land pattern of 2.6.
  • the horizontal (bent-lead) models. The drawings give straight leads only.
  • the 2-lead TO-39, TO-46 and TO-126 models. Central's TO-39, TO-46 and TO-126 sheets draw 3 leads only.
  • the other packages in the family: TO-218, TO-220-4/5/11, TO-247-2/4/5, TO-251, TO-262-3-1EP and TO-262-5, TO-264, TO-3, TO-3P, TO-5, TO-8, TO-11 and TO-52, the TO-92 variants (L, S, Mini, Flat, 2-lead), and the windowed and lensed cans.
  1. 1.3.1 Latest Compare with 1.3.0
  2. 1.3.0 Compare with 1.2.0
  3. 1.2.0 Compare with 1.1.0
  4. 1.1.0 Compare with 1.0.0
  5. 1.0.0
More #to-220
STEVEMIT

steve/leaded-inductor

Axial leaded inductor, Fastron fixed choke coils (MICC, SMCC, MECC, HCCC, LACC, HBCC, VHBCC, XHBCC) and suppression coils (MISC, MESC, 77A), Vishay Dale molded IM-1 to IM-10, horizontal or vertical.

0 63 sizes 0 3 hours ago v1.1.0
STEVEMIT

steve/bridge-rectifier

Single-phase bridge rectifiers in Vishay's through-hole cases: GBL, GBU, KBL and KBU in-line, KBPC1 and KBPC6 square, from Vishay's data sheets.

0 7 sizes 0 1 hour ago v1.0.0
STEVEMIT

steve/axial-diode

Axial leaded diodes in Vishay's DO-35, DO-41, DO-15, DO-201AD and P600 packages, with the cathode band, horizontal or vertical.

0 30 sizes 0 1 hour ago v1.0.0
STEVEMIT

steve/qfp-package

LQFP and TQFP packages with gull-wing leads on four sides, by TI package outline.

0 12 sizes 0 52 minutes ago v1.0.0