"""Small-outline transistor package (SOT-23, thin SOT-23, SC-70, SOT-563/553) by TI package outline. Centred on the origin with the seating plane on the XY plane; pins 1 to k on the -Y side running +X, the others on +Y running back. Dimensions from the TI outline named by `package`; see the README.""" from steve import Model package = "DBZ0003A" # TI package outline detail = "full" # full: body, pin-1 mark and leads; simple: the body only # outline: (label, lead form, pitch, pin slots on -Y, pin slots on +Y, body length along the pin rows, body width across them, lead tip to tip, height # max, standoff, lead width, foot length, lead thickness), ranges as (min, max), all in mm. Pin slots are pin positions in pitches from the centre. # TI package outlines, https://www.ti.com/lit/pdf/: DBZ0003A mpds108 (4214838/F 08/2024), DDC0005A mpds123 (4220752/C 08/2024), DDC0006A mpds124 # (4214841/E 08/2024), DDF0008A mpds569 (4222047/E 07/2024), DCK0003A mpds295 (4220745/F 11/2024), DCK0006A mpds114 (4214835/D 11/2024), DRL0005A mpds158 # (4220753/E 11/2024), DRL0006A mpds159 (4223266/F 11/2024). DDF0008A's tip to tip is given as typical. DRL leads are flat: the foot is the length on the # underside, and the standoff the drawn 0.00 to 0.05 gap. OUTLINES = { "DBZ0003A": ("SOT-23", "gull", 0.95, (-1, 1), (0,), (2.80, 3.04), (1.2, 1.4), (2.10, 2.64), 1.12, (0.01, 0.10), (0.3, 0.5), (0.2, 0.6), (0.08, 0.20)), "DDC0005A": ("SOT-23-5-thin", "gull", 0.95, (-1, 0, 1), (1, -1), (2.75, 3.05), (1.45, 1.75), (2.55, 3.05), 1.1, (0.0, 0.1), (0.3, 0.5), (0.3, 0.6), (0.12, 0.20)), "DDC0006A": ("SOT-23-6-thin", "gull", 0.95, (-1, 0, 1), (1, 0, -1), (2.75, 3.05), (1.45, 1.75), (2.55, 3.05), 1.1, (0.0, 0.1), (0.3, 0.5), (0.3, 0.6), (0.12, 0.20)), "DDF0008A": ("SOT-23-8-thin", "gull", 0.65, (-1.5, -0.5, 0.5, 1.5), (1.5, 0.5, -0.5, -1.5), (2.85, 2.95), (1.55, 1.65), (2.65, 2.95), 1.1, (0.0, 0.1), (0.22, 0.38), (0.3, 0.6), (0.08, 0.20)), "DCK0003A": ("SC-70-3", "gull", 0.65, (-1, 1), (0,), (1.85, 2.15), (1.1, 1.4), (1.8, 2.4), 1.1, (0.0, 0.1), (0.15, 0.30), (0.26, 0.46), (0.08, 0.22)), "DCK0006A": ("SC-70-6", "gull", 0.65, (-1, 0, 1), (1, 0, -1), (1.85, 2.15), (1.1, 1.4), (1.8, 2.4), 1.1, (0.0, 0.1), (0.15, 0.30), (0.26, 0.46), (0.08, 0.22)), "DRL0005A": ("SOT-553", "flat", 0.5, (-1, 0, 1), (1, -1), (1.5, 1.7), (1.1, 1.3), (1.5, 1.7), 0.6, (0.0, 0.05), (0.15, 0.27), (0.2, 0.4), (0.08, 0.18)), "DRL0006A": ("SOT-563", "flat", 0.5, (-1, 0, 1), (1, 0, -1), (1.5, 1.7), (1.1, 1.3), (1.5, 1.7), 0.6, (0.0, 0.05), (0.15, 0.27), (0.2, 0.4), (0.08, 0.18)), } # The gull wing's bend heights and the pin-1 mark are proportions, for looks. def mid(pair): return (pair[0] + pair[1]) / 2 label, form, pitch, low, high, L, W, span, top, standoff, lead_w, foot, lead_t = OUTLINES[package] length, width, span, standoff, lead_w, foot, lead_t = mid(L), mid(W), mid(span), mid(standoff), mid(lead_w), mid(foot), mid(lead_t) model = Model() model.plane("body_plane", on="XY", offset=standoff, name="Body") with model.sketch("body_sketch", on="body_plane", name="Body") as sk: sk.rect("body_rect", (-length / 2, -width / 2), (length / 2, width / 2)) model.extrude("body", "body_sketch", distance=top - standoff, name="Body") if detail == "full": model.plane("top_plane", on="XY", offset=top, name="Top") with model.sketch("mark_sketch", on="top_plane", name="Pin-1 mark") as sk: sk.circle("mark_circle", (-length / 2 + 0.2 * width, -width / 2 + 0.2 * width), 0.07 * width) model.extrude("mark", "mark_sketch", distance=-0.03, op="cut", name="Pin-1 mark") arm_z = (top + standoff) / 2 for tag, side, slots in (("low", -1, low), ("high", 1, high)): y_out, y_body = side * span / 2, side * width / 2 y_bend = side * (span / 2 - foot) if form == "gull" else y_body y_in = y_bend if form == "gull" else side * (span / 2 - foot) with model.sketch(f"feet_{tag}", on="XY", name="Leads") as sk: for i, slot in enumerate(slots): x = slot * pitch sk.rect(f"foot_{tag}_{i}", (x - lead_w / 2, min(y_in, y_out)), (x + lead_w / 2, max(y_in, y_out))) model.extrude(f"feet_{tag}_body", f"feet_{tag}", distance=lead_t, name="Leads") if form == "gull": model.plane(f"arm_plane_{tag}", on="XY", offset=arm_z, name="Leads") with model.sketch(f"arms_{tag}", on=f"arm_plane_{tag}", name="Leads") as sk: for i, slot in enumerate(slots): x = slot * pitch sk.rect(f"arm_{tag}_{i}", (x - lead_w / 2, min(y_body, y_bend) - lead_t / 2), (x + lead_w / 2, max(y_body, y_bend) + lead_t / 2)) model.extrude(f"arms_{tag}_body", f"arms_{tag}", distance=lead_t, name="Leads") with model.sketch(f"legs_{tag}", on="XY", name="Leads") as sk: for i, slot in enumerate(slots): x = slot * pitch sk.rect(f"leg_{tag}_{i}", (x - lead_w / 2, y_bend - lead_t / 2), (x + lead_w / 2, y_bend + lead_t / 2)) model.extrude(f"legs_{tag}_body", f"legs_{tag}", distance=arm_z + lead_t, name="Leads") model.material("pla", color="#26282b") result = model.result()