"""Plastic dual-in-line package (PDIP), 300 mil rows, 14 to 20 pins. Pin 1 is at the origin, pins 1 to n/2 along +X, the other row at +Y by 7.62; the seating plane is the XY plane, the body above it, the leads down through the board. Dimensions from TI's N package drawing in the README.""" from steve import Model pins = 16 # Pins detail = "full" # full: body, pin-1 notch and leads; simple: the body only # TI Mechanical Data MPDI002A, N (R-PDIP-T**), January 1995, revised October 1995 (drawing 4040049/C 08/95), in inches (mm): pitch 0.100 (2.54); A (body length) # 0.745 to 0.775 (18.92 to 19.69) for 14 and 16 pins, 0.850 to 0.920 (21.59 to 23.37) for 18, 0.940 to 0.975 (23.88 to 24.77) for 20; body width 0.240 to 0.260 # (6.10 to 6.60); rows 0.290 to 0.310 (7.37 to 7.87) outside the leads, on 0.300 (7.62) centres; seating plane to top 0.200 (5.08) max; seating plane to body # 0.020 (0.51) min; leads below the seating plane 0.125 (3.18) min, 0.015 to 0.021 (0.38 to 0.53) wide, 0.010 (0.25) thick. LENGTH = {14: (18.92, 19.69), 16: (18.92, 19.69), 18: (21.59, 23.37), 20: (23.88, 24.77)} PITCH, ROWS, WIDTH, TOP, STANDOFF, TAIL, LEAD_W, LEAD_T = 2.54, 7.62, (6.10 + 6.60) / 2, 5.08, 0.51, 3.18, (0.38 + 0.53) / 2, 0.25 SHOULDER = 1.5 # the lead's wide shoulder above the seating plane and where it leaves the body are proportions, for looks if pins not in LENGTH: raise ValueError("This drawing covers 14, 16, 18 and 20 pins.") per_row = pins // 2 length = sum(LENGTH[pins]) / 2 cx, cy = (per_row - 1) * PITCH / 2, ROWS / 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", (cx - length / 2, cy - WIDTH / 2), (cx + length / 2, cy + 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("notch_sketch", on="top_plane", name="Pin-1 notch") as sk: sk.circle("notch_circle", (cx - length / 2, cy), 0.75) model.extrude("notch", "notch_sketch", distance=-0.5, op="cut", name="Pin-1 notch") for row, y in ((0, 0.0), (1, ROWS)): model.plane(f"tail_plane_{row}", on="XY", offset=-TAIL, name="Leads") with model.sketch(f"tails_{row}", on=f"tail_plane_{row}", name="Leads") as sk: for i in range(per_row): sk.rect(f"tail_{row}_{i}", (i * PITCH - LEAD_W / 2, y - LEAD_T / 2), (i * PITCH + LEAD_W / 2, y + LEAD_T / 2)) model.extrude(f"tails_{row}_body", f"tails_{row}", distance=TAIL + SHOULDER + 0.5, name="Leads") edge = cy - WIDTH / 2 if row == 0 else cy + WIDTH / 2 model.plane(f"arm_plane_{row}", on="XY", offset=SHOULDER, name="Leads") with model.sketch(f"arms_{row}", on=f"arm_plane_{row}", name="Leads") as sk: for i in range(per_row): sk.rect(f"arm_{row}_{i}", (i * PITCH - SHOULDER / 2, min(y, edge) - LEAD_T / 2), (i * PITCH + SHOULDER / 2, max(y, edge) + LEAD_T / 2)) model.extrude(f"arms_{row}_body", f"arms_{row}", distance=0.5, name="Leads") model.material("pla", color="#26282b") result = model.result()