"""Small-outline IC package (SOIC, SSOP, TSSOP) by TI package outline. Centred on the origin with the seating plane on the XY plane, pins 1 to n/2 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 = "D0014A" # TI package outline detail = "full" # full: body, pin-1 mark and gull-wing leads; simple: the body only # outline: (kind, pins, pitch, body length, body width, lead tip to tip, height max, standoff, lead width, foot length), ranges as (min, max), all in mm. # TI package outlines, https://www.ti.com/lit/pdf/: D0014A mpds177 (4220718/A 09/2016), D0016A mpds43 (4214828/B 08/2021), DW0020A mpds173 (4220724/A # 05/2016), DB0016A mpds507 (4220763/A 05/2022), DB0020A mpds508 (4214851/B 08/2019), DB0028A mpds510 (4214853/B 03/2018), PW0008A mpds568 (4221848/A 02/2015), # DGG0048A mpds583 (4214859/B 11/2020), DGG0056A mpds570 (4222167/A 07/2015). SSOP standoff: 0.05 min; its upper end is the height budget, taken as 0.25. OUTLINES = { "D0014A": ("SOIC", 14, 1.27, (8.55, 8.75), (3.8, 4.0), (5.8, 6.2), 1.75, (0.10, 0.25), (0.31, 0.51), (0.40, 1.27)), "D0016A": ("SOIC", 16, 1.27, (9.8, 10.0), (3.8, 4.0), (5.8, 6.2), 1.75, (0.10, 0.25), (0.31, 0.51), (0.40, 1.27)), "DW0020A": ("SOIC", 20, 1.27, (12.6, 13.0), (7.4, 7.6), (9.97, 10.63), 2.65, (0.10, 0.30), (0.31, 0.51), (0.40, 1.27)), "DB0016A": ("SSOP", 16, 0.65, (5.9, 6.5), (5.0, 5.6), (7.4, 8.2), 2.0, (0.05, 0.25), (0.22, 0.38), (0.55, 0.95)), "DB0020A": ("SSOP", 20, 0.65, (6.9, 7.5), (5.0, 5.6), (7.4, 8.2), 2.0, (0.05, 0.25), (0.22, 0.38), (0.55, 0.95)), "DB0028A": ("SSOP", 28, 0.65, (9.9, 10.5), (5.0, 5.6), (7.4, 8.2), 2.0, (0.05, 0.25), (0.22, 0.38), (0.55, 0.95)), "PW0008A": ("TSSOP", 8, 0.65, (2.9, 3.1), (4.3, 4.5), (6.2, 6.6), 1.2, (0.05, 0.15), (0.19, 0.30), (0.50, 0.75)), "DGG0048A": ("TSSOP", 48, 0.5, (12.4, 12.6), (6.0, 6.2), (7.9, 8.3), 1.2, (0.05, 0.15), (0.17, 0.27), (0.50, 0.75)), "DGG0056A": ("TSSOP", 56, 0.5, (13.9, 14.1), (6.0, 6.2), (7.9, 8.3), 1.2, (0.05, 0.15), (0.17, 0.27), (0.50, 0.75)), } LEAD_T = 0.15 # lead thickness, the outlines' (0.15) reference; the gull wing's bend heights and the pin-1 mark are proportions, for looks def mid(pair): return (pair[0] + pair[1]) / 2 kind, pins, pitch, L, W, span, top, standoff, lead_w, foot = OUTLINES[package] length, width, span, standoff, lead_w, foot = mid(L), mid(W), mid(span), mid(standoff), mid(lead_w), mid(foot) per_row = pins // 2 first = -(per_row - 1) * pitch / 2 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.06 * width) model.extrude("mark", "mark_sketch", distance=-0.05, op="cut", name="Pin-1 mark") arm_z = (top + standoff) / 2 for tag, side in (("low", -1), ("high", 1)): y_out, y_body, y_bend = side * span / 2, side * width / 2, side * (span / 2 - foot) with model.sketch(f"feet_{tag}", on="XY", name="Leads") as sk: for i in range(per_row): x = first + i * pitch sk.rect(f"foot_{tag}_{i}", (x - lead_w / 2, min(y_bend, y_out)), (x + lead_w / 2, max(y_bend, y_out))) model.extrude(f"feet_{tag}_body", f"feet_{tag}", distance=LEAD_T, name="Leads") 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 in range(per_row): x = first + i * 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 in range(per_row): x = first + i * 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()