"""TSSOP package, 4.4 mm body, 0.65 mm pitch (TI PW package): 14, 16, 20 and 24 pins. 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 TI's package outlines in the README.""" from steve import Model pins = 16 # Pins detail = "full" # full: body, pin-1 mark and gull-wing leads; simple: the body only # TI package outlines PW0014A (4220202/B 12/2023), PW0016A (4220204/B 12/2023), PW0020A (4220206/A 02/2017), PW0024A (4220208/A 02/2017), https://www.ti.com/lit/pdf/ # mpds360 to mpds363; reference JEDEC MO-153. Body length (note 3) by pins: 14 and 16: 4.9 to 5.1, 20: 6.4 to 6.6, 24: 7.7 to 7.9. Body width 4.3 to 4.5 (note 4), # lead tip to tip 6.2 to 6.6, height 1.2 max, standoff 0.05 to 0.15, pitch 0.65, lead width 0.17 (0.19) to 0.30, foot 0.50 to 0.75, lead thickness (0.15). LENGTH = {14: (4.9, 5.1), 16: (4.9, 5.1), 20: (6.4, 6.6), 24: (7.7, 7.9)} PITCH, WIDTH, SPAN, TOP, STANDOFF, LEAD_W, FOOT, LEAD_T = 0.65, 4.4, 6.4, 1.2, 0.1, 0.24, 0.625, 0.15 if pins not in LENGTH: raise ValueError("These outlines cover 14, 16, 20 and 24 pins.") per_row = pins // 2 length = sum(LENGTH[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.6, -WIDTH / 2 + 0.6), 0.25) model.extrude("mark", "mark_sketch", distance=-0.05, op="cut", name="Pin-1 mark") arm_z = (TOP + STANDOFF) / 2 # the gull wing's bend heights are proportions, for looks; foot, span, width and pitch are the outline's for tag, side in (("low", -1), ("high", 1)): y_out = side * SPAN / 2 y_body = side * WIDTH / 2 y_bend = 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") model.plane(f"leg_plane_{tag}", on="XY", offset=0, name="Leads") with model.sketch(f"legs_{tag}", on=f"leg_plane_{tag}", 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()