"""Board-mounted DC/DC converter module, as its maker draws it: RECOM R-78 (SIP3, SIP4, R-78HB-0.5L with bent pins) and R-5xxxPA (SIP12) switching regulators, TRACO POWER TSR 1, TMR 1 (SIP) and TEN 10 / TEN 20 (2" x 1" metal case), and XP Power IA, IH and IT (SIP). Pin 1 is at the origin, the case on the board (XY plane) above it, the pins down through the board. Dimensions from each maker's data sheet in the README.""" from steve import Model model_name = "R-78E-0.5" # Series (maker's name) detail = "full" # full: case and pins; simple: the case only # model: (case length along X, case depth along Y, top above the board, case bottom above the board, pin section ("rect", along X, along Y) or ("round", diameter), # pin length below the board, pins as (number, x from the case's -X face, y from its -Y face), case (or potting) material, colour, metal shell material), mm. # Materials from the sheets' physical specifications: RECOM and TRACO SIP cases are plastic (potted with silicone, R-78S epoxy), modelled as one plastic # block, ptfe; TEN 10 is a chrome-nickel plated steel case potted with epoxy (steel-generic shell, ptfe inside), TEN 20 a nickel-plated copper case # potted with silicone rubber (copper shell, silicone-rubber inside). # RECOM, https://recom-power.com/pdf/Innoline/.pdf, Dimension Drawing: R-78E-0.5 (REV.: 9/2025, p. 3), R-78B-2.0 (REV.: 5/2021, p. 5), # R-78HB-0.5 (REV.: 5/2019, p. 5), R-78S (REV.: 5/2018, p. 4): pin 1 3.21 (R-78S 2.00) from the case's end, 2.54 pitch, the row 2.00 (R-78B 1.2) from one # long face, case 0.51 above the board, pins 4.10 below it. # TRACO POWER, https://www.tracopower.com/products/.pdf, Outline Dimensions: tsr1 (Rev. April 15, 2026, p. 4): 11.7 x 7.5 x 10.1, 0.5 above the # board, pin 3 3.3 from the end, the row 5.5 from one face (2.0 from the other), pins 0.50 x 0.25, 4.1; tmr1 (Rev. April 15, 2026, p. 4): 17.0 x 7.62 x 11.0, # 0.5 above the board, pin 1 2.15 from the end, pins 1, 2, 4, 5, 6 at 0, 2.54, 7.62, 10.16, 12.7, the row 2.5 from one face, pins 0.5 x 0.25, 3.2; ten10 # (p. 3) and ten20 (Rev. September 16, 2025, p. 3): 50.8 x 25.4 x 10.2 on an insulated baseplate, pins 1.0 dia., 6.0, placed from the bottom view # (mirrored here into a top view: x = 50.8 - the drawing's x). # RECOM R-5xxxPA_DA (REV.: 5/2019, p. 7, Dimension Drawing, R-5xxxPA): 32.2 x 9.1 x 15.0, 12 pins 0.70 x 0.25, 4.10 below, pin 1 2.1 from the end, # 11 x 2.54, the row 0.8 from one face; no standoff drawn (the case from the board). Plastic case potted with epoxy (ptfe). # XP Power, https://www.xppower.com/portals/0/pdfs/SF_.pdf, Mechanical details: IA (23 May 2025, p. 4, SIP package): 19.3 x 6.0 x 10.1, 0.5 above # the board, pins 0.51 x 0.2, 3.0 below, the row 1.4 from one face, 2.54 pitch, pin 1 to pin 6 12.7, pin 6 4.5 from the end (so pin 1 2.1 from the other), # no pins 3 and 7; IH (16 May 2025, p. 3, SIP package, 1kVDC versions): 19.5 x 7.2 x 10.16 max, 0.38 above the board, pins 0.50 x 0.25 max, 3.05 min # below, pin 1 (+Vin) 2.29 from the end, the row 1.25 from one face, 2.54 pitch, +Vin to +Vout 12.7; IT (17 December 2025, p. 3): 26.0 x 9.20 x 12.5, # pins 0.50 x 0.3, 4.0 below, pin 1 1.8 from the end, pins 1-3 2 x 2.54, then 7.62 to pin 6, pins 6-9 3 x 2.54, the row 2.75 from one face. XP's cases are # plastic (IA: black plastic potted with epoxy), ptfe. The IH drawing numbers no pins: they are named here by their place on the 2.54 grid from +Vin. MODELS = { "R-78E-0.5": (11.6, 8.5, 10.4, 0.51, ("rect", 0.50, 0.25), 4.10, ((1, 3.21, 6.5), (2, 5.75, 6.5), (3, 8.29, 6.5)), "ptfe", "#1d1f22", None), "R-78B-2.0": (11.5, 8.5, 17.5, 0.51, ("rect", 0.64, 0.64), 4.10, ((1, 3.21, 7.3), (2, 5.75, 7.3), (3, 8.29, 7.3)), "ptfe", "#1d1f22", None), "R-78HB-0.5": (11.5, 8.5, 17.5, 0.51, ("rect", 0.70, 0.25), 4.10, ((1, 3.21, 6.5), (2, 5.75, 6.5), (3, 8.29, 6.5)), "ptfe", "#1d1f22", None), "R-78S-0.1": (11.6, 8.5, 10.4, 0.51, ("rect", 0.70, 0.25), 4.10, ((1, 2.00, 6.5), (2, 4.54, 6.5), (3, 7.08, 6.5), (4, 9.62, 6.5)), "ptfe", "#1d1f22", None), "R-5xxxPA": (32.2, 9.1, 15.0, 0.0, ("rect", 0.70, 0.25), 4.10, ((1, 2.1, 0.8), (2, 4.64, 0.8), (3, 7.18, 0.8), (4, 9.72, 0.8), (5, 12.26, 0.8), (6, 14.8, 0.8), (7, 17.34, 0.8), (8, 19.88, 0.8), (9, 22.42, 0.8), (10, 24.96, 0.8), (11, 27.5, 0.8), (12, 30.04, 0.8)), "ptfe", "#1d1f22", None), "IA SIP": (19.3, 6.0, 10.1, 0.5, ("rect", 0.51, 0.2), 3.0, ((1, 2.1, 1.4), (2, 4.64, 1.4), (4, 9.72, 1.4), (5, 12.26, 1.4), (6, 14.8, 1.4)), "ptfe", "#1d1f22", None), "IH SIP 1 kV": (19.5, 7.2, 10.16, 0.38, ("rect", 0.50, 0.25), 3.05, ((1, 2.29, 1.25), (2, 4.83, 1.25), (4, 9.91, 1.25), (5, 12.45, 1.25), (6, 14.99, 1.25)), "ptfe", "#1d1f22", None), "IT": (26.0, 9.2, 12.5, 0.0, ("rect", 0.50, 0.3), 4.0, ((1, 1.8, 2.75), (2, 4.34, 2.75), (3, 6.88, 2.75), (6, 14.5, 2.75), (7, 17.04, 2.75), (8, 19.58, 2.75), (9, 22.12, 2.75)), "ptfe", "#1d1f22", None), "TSR 1": (11.7, 7.5, 10.1, 0.5, ("rect", 0.50, 0.25), 4.1, ((1, 3.32, 5.5), (2, 5.86, 5.5), (3, 8.4, 5.5)), "ptfe", "#1d1f22", None), "TMR 1 single": (17.0, 7.62, 11.0, 0.5, ("rect", 0.5, 0.25), 3.2, ((1, 2.15, 5.12), (2, 4.69, 5.12), (4, 9.77, 5.12), (6, 14.85, 5.12)), "ptfe", "#1d1f22", None), "TMR 1 dual": (17.0, 7.62, 11.0, 0.5, ("rect", 0.5, 0.25), 3.2, ((1, 2.15, 5.12), (2, 4.69, 5.12), (4, 9.77, 5.12), (5, 12.31, 5.12), (6, 14.85, 5.12)), "ptfe", "#1d1f22", None), "TEN 10 single": (50.8, 25.4, 10.2, 0.0, ("round", 1.0), 6.0, ((1, 35.6, 15.28), (2, 35.6, 10.2), (3, 15.28, 22.82), (5, 15.28, 2.5)), "ptfe", "#b9bcbf", "steel-generic"), "TEN 10 dual": (50.8, 25.4, 10.2, 0.0, ("round", 1.0), 6.0, ((1, 35.6, 15.28), (2, 35.6, 10.2), (3, 15.28, 22.82), (4, 15.28, 12.66), (5, 15.28, 2.5)), "ptfe", "#b9bcbf", "steel-generic"), "TEN 20 single": (50.8, 25.4, 10.2, 0.0, ("round", 1.0), 6.0, ((1, 35.52, 15.24), (2, 35.52, 10.16), (6, 35.52, 2.54), (3, 15.2, 22.86), (5, 15.2, 2.54)), "silicone-rubber", "#b9bcbf", "copper"), "TEN 20 dual": (50.8, 25.4, 10.2, 0.0, ("round", 1.0), 6.0, ((1, 35.52, 15.24), (2, 35.52, 10.16), (6, 35.52, 2.54), (3, 15.2, 22.86), (4, 15.2, 12.7), (5, 15.2, 2.54)), "silicone-rubber", "#b9bcbf", "copper"), } # Bent-pin versions lying on the face their pins bend towards: (the straight model, the bent pin's outer face beyond the case's end, the pin's run from the # row's centre to its tip). RECOM R-78HB-0.5 (REV.: 5/2019, p. 5), "with suffix L bent pins": 19.0 overall against the case's 17.5, so 1.50; the bottom # view's 2.00 (row to face) + 4.10 (face to tip) = the side view's 6.10; the bend 90-93 degrees, drawn at 90; the pin 0.70 x 0.25. BENT = {"R-78HB-0.5L": ("R-78HB-0.5", 1.50, 6.10)} SHELL = 0.3 # the metal case's wall, a proportion (the sheets don't dimension it); its open bottom is the insulated baseplate, part of the potting here L, W, top, standoff, section, pin_length, pins, case_material, colour, shell_material = MODELS[BENT[model_name][0] if model_name in BENT else model_name] x1, y1 = pins[0][1], pins[0][2] model = Model() model.plane("case_plane", on="XY", offset=standoff, name="Case bottom") if model_name in BENT: # The case lies on the face its pins bend towards (the +Y face of the straight model), its end towards -Y; the pins leave the end at the row's height # above the board, bend down at pin 1's place and run through the board. _, out, run = BENT[model_name] rise = W - y1 # the row's centre above the face on the board end = out - section[2] / 2 # the case's end (its feet) from the bent pins' centre line model.box("case", L, top - standoff, W, at=(L / 2 - x1, end + standoff + (top - standoff) / 2, W / 2), op="new", body="case_body", name="Case") elif shell_material: # A metal shell (top and four sides) round the potting, which fills it down to the board. with model.sketch("case_sketch", on="case_plane", name="Potting") as sk: sk.rect("case_rect", (-x1 + SHELL, -y1 + SHELL), (L - x1 - SHELL, W - y1 - SHELL)) model.extrude("case", "case_sketch", distance=top - standoff - SHELL, op="new", body="case_body", name="Potting") model.box("shell", L, W, top - standoff, at=(L / 2 - x1, W / 2 - y1, standoff + (top - standoff) / 2), op="new", body="shell_body", name="Metal case") model.box("shell_room", L - 2 * SHELL, W - 2 * SHELL, top - standoff - SHELL, at=(L / 2 - x1, W / 2 - y1, standoff + (top - standoff - SHELL) / 2), op="cut", body="shell_body", name="Metal case inside") else: with model.sketch("case_sketch", on="case_plane", name="Case") as sk: sk.rect("case_rect", (-x1, -y1), (L - x1, W - y1)) model.extrude("case", "case_sketch", distance=top - standoff, op="new", body="case_body", name="Case") leads = [] if detail == "full": # Each pin is its own copper solid, from its end below the board up to the case's bottom face. if model_name not in BENT: run = pin_length + standoff for n, x, y in pins: cx, cy = x - x1, y - y1 if model_name in BENT: # Each pin one L-shaped solid: the leg out of the case's end, then the leg down through the board. model.box(f"pin_{n}", section[1], end + standoff + section[2] / 2, section[2], at=(cx, (end + standoff - section[2] / 2) / 2, rise), op="new", body=f"pin_{n}_body", name=f"Pin {n}") model.box(f"pin_{n}_down", section[1], section[2], run + section[2] / 2, at=(cx, 0.0, rise + section[2] / 2 - (run + section[2] / 2) / 2), op="join", body=f"pin_{n}_body", name=f"Pin {n} bent leg") elif section[0] == "rect": model.box(f"pin_{n}", section[1], section[2], run, at=(cx, cy, standoff - run / 2), op="new", body=f"pin_{n}_body", name=f"Pin {n}") else: model.plane(f"pin_{n}_plane", on="XY", offset=-pin_length, name=f"Pin {n}") with model.sketch(f"pin_{n}_sketch", on=f"pin_{n}_plane", name=f"Pin {n}") as sk: sk.circle(f"pin_{n}_circle", (cx, cy), section[1] / 2) model.extrude(f"pin_{n}", f"pin_{n}_sketch", distance=run, op="new", body=f"pin_{n}_body", name=f"Pin {n}") leads.append(f"pin_{n}_body") # Materials as the sheets name them (above); the mass against the sheets' weights is in the README. Pins: tinned copper. model.material(case_material, bodies=["case_body"], color="#26282b" if shell_material else colour) if shell_material: model.material(shell_material, bodies=["shell_body"], color=colour) if leads: model.material("copper", bodies=leads, color="#c9ccd1") result = model.result()