"""Board-mounted AC/DC converter module, as its maker draws it: Mean Well IRM-02, IRM-03, IRM-20 and IRM-60 (PCB mounting style), RECOM RAC04-GA, Hi-Link HLK-PM, HLK-2M, HLK-5M and HLK-10M, Murata BAC05, Vigortronix VTX-214-010 and TRACO POWER TMLM 04, TMLM 05, TMLM 10 / TMLM 20 and TPP 15-D. 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 = "IRM-03" # 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, pin length below the board, pins as (number, x from the case's -X face, # y from the case's -Y face, diameter), case material, colour), mm. The makers draw bottom views; x is the drawing's distance from its left edge and # y the distance down from its top edge, which seen from above is a right-handed layout with no mirroring. # Mean Well, https://www.meanwell.com/Upload/PDF//-SPEC.PDF, Mechanical Specification, PCB mounting style: # IRM-02 (file IRM-02-SPEC 2025-11-21, p. 4, case IRM02, tolerance +/-0.5): 33.7 x 22.2 x 15, pins 0.6 +/-0.1, 6 +/-1 long, the two pin columns 28 # apart and 2.85 from the end, AC/N 3.5 from the side and AC/L 15.2 on, -V and +V 7.6 apart (+V on the centre line, 11.1, so -V 3.5 from the side). # IRM-03 (file IRM-03-SPEC 2025-08-08, p. 4, case IRM03, +/-0.5): 37 x 24 x 15, pin diameter 0.6 +/-0.1, 3.5 +/-1 long, AC/L 3.26 from the end, AC/N # 5.08 on, NC 25.4 further, that row 3.11 from the side, the other row 17.78 away with -V 3.26 from the far end and +V 5.08 before it. # IRM-20 (file IRM-20-SPEC 2025-11-21, p. 3, case 219A, +/-0.5): 52.4 x 27.2 x 24, pin diameter 1.0, 3.5 +/-1 long, AC column 3.4 from the end, the # output column 45 on, AC/N and -V 3.2 from the side, AC/L 20.8 from AC/N, +V 8 from -V. # IRM-60 (file IRM-60-SPEC 2025-11-21, p. 4, case IRM60, +/-1): 87 x 52 x 29.5, AC pins 1 dia., output pins 2 dia., 3.5 +/-1 long, output column 5.7 # from the end, AC column 76 on, AC/L 5 from the side, AC/N 6.75 on, -V 40.75 from the side, +V 5.5 on. # The Mean Well PCB style drawings number no pins: here 1 AC/L, 2 AC/N, then the outputs (IRM-03 as RECOM numbers the same layout: 3 NC, 4 -V, 5 +V). # Mean Well: "phenolic case" (IRM-02, IRM-03) or "94V-0 flame retardant plastic case" (IRM-20, IRM-60), "potted with silicone": one block, silicone-rubber. # RECOM RAC04-GA, https://recom-power.com/pdf/Powerline_AC-DC/RAC04-GA.pdf, REV.: 7/2023, p. 6, Dimension Drawing: 37.0 x 24.0 x 15.0, pins 0.60 +/-0.1, # 3.5 +/-0.5 long, pin 1 3.26 from the end, pin 2 5.08 on, pin 3 10 x 2.54 = 25.40 further, that row 3.11 from the side, the other row 7 x 2.54 = 17.78 # away with pin 4 under pin 3 and pin 5 5.08 before it. P. 5: case black plastic (UL94V-0), 20 g typ. The filling isn't named: one plastic block, ptfe. # TRACO POWER TMLM, https://www.tracopower.com/products/tmlm.pdf, Rev. March 30, 2026, Outline Dimensions (+/-0.5, pin pitch +/-0.3), "fully # encapsulated plastic case" (one plastic block, ptfe): # TMLM 04 (p. 4): 27.0 x 36.5 x 17.1, pin diameter 0.5, 4.0 long, primary column (pins 5, 6, 7) 3.0 from the edge, secondary column (4, 3, 2, 1) # 21.0 on, pins 7 and 1 3.75 from the end, pin 2 21.5 from pin 1, pins 3 and 4 2 x 3.75 further; pins 5 and 6 are drawn level with pins 4 and 2. # TMLM 05 (p. 4): 25.4 x 50.8 x 15.16, pin diameter 1.0, 8.0 long, AC (L) 2.6 from the edge, AC (N) 20.32 on, the output pins 45.72 from the AC # pins and 2.54 from the end, 10.16 apart; +Vout is drawn in line with AC (N). # TMLM 10 and TMLM 20 (p. 4 and p. 5, the same outline; TMLM 20 has AC (N) and AC (L) the other way round): 27.2 x 52.4 x 23.5, pin diameter 1.0, # 8 long, one AC pin 3.5 from the edge, the other 20.32 on, the output pins 45.72 from the AC pins and 3.4 from the end, 10.16 apart; +Vout is # drawn in line with the second AC pin. The M3 thread in the bottom isn't modelled. # The TMLM 05, 10 and 20 drawings number no pins: here 1 and 2 the AC pins, 3 -Vout, 4 +Vout. # TRACO POWER TPP 15-D, https://www.tracopower.com/products/tpp15-d.pdf, Rev. April 16, 2026, p. 5, Outline Dimensions (x.x +/-0.50, x.xx +/-0.25): # 42.0 x 28.9 x 21.5, pin diameter 1.0, 3.8 long, pins 3, 4, 5 3.5 from one end, pins 1, 2 35.05 from them, pin 1 17.3 from the side, pin 2 5.59 # on, pin 3 14.00 before pin 1's line, pin 4 2.24 and pin 5 8.36 after it. P. 4 and 5: plastic case, potting silicone, pins copper, 43 g: one # block, silicone-rubber. # Vigortronix VTX-214-010, 10 Watt AC-DC Converters, D0034 Issue 10, p. 3 (https://www.farnell.com/datasheets/2580855.pdf): case 56.0 MAX x 36.0 MAX # (the block is that size), 25.5 high, pins 1.0 dia, 3.0 long; about the case's centre lines in the pin view: pins 1 and 2 on one side and pins 3 # and 4 on the other, 24.0 from the centre line each (48.0 +/-0.5 apart), pins 1 and 2 6.0 either side of the other centre line (12.0 +/-0.5 # apart), pin 4 on it and pin 3 5.0 +/-0.5 from pin 4, on pin 1's side. P. 1: "Encapsulated Design", "Materials: UL94-V0", no plastic named # (one plastic block, ptfe); p. 2: 85 g. # Murata Power Solutions BAC05 Series, KAC_BAC05C.A01.D08, p. 9, Mechanical Dimensions (https://www.farnell.com/datasheets/3166548.pdf): 25.40 # +/-0.50 square, 16.30 +/-0.50 high, 5 pins 0.55 +/-0.05 (drawn round), 4.10 +/-0.25 long, pin 1 2.54 +/-0.50 from each of two edges, pin 2 5.08 # from pin 1, pin 5 20.32 from pin 1 along the other edge, pins 4 and 3 10.16 and 2 x 10.16 from pin 5 (pins within +/-0.30 of true position); # 18 g. The feet under the case ((0.40)) aren't modelled and no case material is named (one plastic block, ptfe). # Shenzhen Hi-Link Electronic "Ultra small series power module" sheets, section 11, Dimensions and weight (copies at datasheet.lcsc.com); length, width, # height and pin pitch +/-8 % (HLK-10M: +/-1 mm), pin length +/-1 mm, pin diameter +/-0.2 mm; "waterproof plastic potting", no plastic named (one # plastic block, ptfe): # HLK-PM (3W, PM03/PM01/PM09/PM12/PM15/PM24, V2.5, Oct.12th.2019, p. 13 of 13): 34 x 20 x 15, pins dia. 0.8 x 4, 5 long, pins 1 and 2 (AC) 2.3 from one end # and 12.5 and 7.5 from one side, pins 3 (-Vo) and 4 (+Vo) 31.7 from that end and 17.7 and 2.3 from that side; 20 +/-2 g. # HLK-2M (2W, V2.2, Jan.15th.2020, p. 13 of 13): 30 x 16 x 19, pins dia. 0.8 x 4, 5 long, one row 8 from the side, 3, 8, 24.5 and 27 from the end; 18 +/-1 g. # HLK-5M (5W, V2.3, Oct.15th.2019, p. 12): 38 x 23 x 18, pins dia. 0.8 x 4, 5 long, pins 1 and 2 2.2 from one end and 14.5 and 8.5 from one side, pins # 3 and 4 35.8 from that end and 20.5 and 2.5 from that side; 32 +/-1 g. # HLK-10M (10W, V2.0, 2025-06-12, p. 10 of 10, in Chinese): 47.5 x 28.5 x 22, pin diameter 0.8 (hole 1.1), 5 long, the two pin columns 42.5 apart, the AC # pins 7.8 apart and the output pins 22.6 apart, each drawn across the case's centre lines (so the columns are 2.5 from the ends); 40 +/-2 g. The # drawing numbers no pins: 1 and 2 AC, 3 -Vo, 4 +Vo as its table and the other series' drawings have them. MODELS = { "HLK-10M": (47.5, 28.5, 22.0, 5.0, ((1, 2.5, 18.15, 0.8), (2, 2.5, 10.35, 0.8), (3, 45.0, 25.55, 0.8), (4, 45.0, 2.95, 0.8)), "ptfe", "#1d1f22"), "HLK-2M": (30.0, 16.0, 19.0, 5.0, ((1, 3.0, 8.0, 0.8), (2, 8.0, 8.0, 0.8), (3, 24.5, 8.0, 0.8), (4, 27.0, 8.0, 0.8)), "ptfe", "#1d1f22"), "HLK-5M": (38.0, 23.0, 18.0, 5.0, ((1, 2.2, 14.5, 0.8), (2, 2.2, 8.5, 0.8), (3, 35.8, 20.5, 0.8), (4, 35.8, 2.5, 0.8)), "ptfe", "#1d1f22"), "HLK-PM": (34.0, 20.0, 15.0, 5.0, ((1, 2.3, 12.5, 0.8), (2, 2.3, 7.5, 0.8), (3, 31.7, 17.7, 0.8), (4, 31.7, 2.3, 0.8)), "ptfe", "#1d1f22"), "BAC05": (25.4, 25.4, 16.3, 4.1, ((1, 2.54, 22.86, 0.55), (2, 2.54, 17.78, 0.55), (3, 22.86, 2.54, 0.55), (4, 22.86, 12.7, 0.55), (5, 22.86, 22.86, 0.55)), "ptfe", "#1d1f22"), "IRM-02": (33.7, 22.2, 15.0, 6.0, ((1, 30.85, 18.7, 0.6), (2, 30.85, 3.5, 0.6), (3, 2.85, 3.5, 0.6), (4, 2.85, 11.1, 0.6)), "silicone-rubber", "#1d1f22"), "IRM-03": (37.0, 24.0, 15.0, 3.5, ((1, 3.26, 3.11, 0.6), (2, 8.34, 3.11, 0.6), (3, 33.74, 3.11, 0.6), (4, 33.74, 20.89, 0.6), (5, 28.66, 20.89, 0.6)), "silicone-rubber", "#1d1f22"), "IRM-20": (52.4, 27.2, 24.0, 3.5, ((1, 3.4, 24.0, 1.0), (2, 3.4, 3.2, 1.0), (3, 48.4, 3.2, 1.0), (4, 48.4, 11.2, 1.0)), "silicone-rubber", "#1d1f22"), "IRM-60": (87.0, 52.0, 29.5, 3.5, ((1, 81.7, 5.0, 1.0), (2, 81.7, 11.75, 1.0), (3, 5.7, 40.75, 2.0), (4, 5.7, 46.25, 2.0)), "silicone-rubber", "#1d1f22"), "RAC04-GA": (37.0, 24.0, 15.0, 3.5, ((1, 3.26, 3.11, 0.6), (2, 8.34, 3.11, 0.6), (3, 33.74, 3.11, 0.6), (4, 33.74, 20.89, 0.6), (5, 28.66, 20.89, 0.6)), "ptfe", "#1d1f22"), "TMLM 04": (27.0, 36.5, 17.1, 4.0, ((1, 24.0, 32.75, 0.5), (2, 24.0, 11.25, 0.5), (3, 24.0, 7.5, 0.5), (4, 24.0, 3.75, 0.5), (5, 3.0, 3.75, 0.5), (6, 3.0, 11.25, 0.5), (7, 3.0, 32.75, 0.5)), "ptfe", "#1d1f22"), "TMLM 05": (25.4, 50.8, 15.16, 8.0, ((1, 2.6, 48.26, 1.0), (2, 22.92, 48.26, 1.0), (3, 12.76, 2.54, 1.0), (4, 22.92, 2.54, 1.0)), "ptfe", "#1d1f22"), "TMLM 10/20": (27.2, 52.4, 23.5, 8.0, ((1, 3.5, 49.12, 1.0), (2, 23.82, 49.12, 1.0), (3, 13.66, 3.4, 1.0), (4, 23.82, 3.4, 1.0)), "ptfe", "#1d1f22"), "TPP 15-D": (42.0, 28.9, 21.5, 3.8, ((1, 3.45, 17.3, 1.0), (2, 3.45, 22.89, 1.0), (3, 38.5, 3.3, 1.0), (4, 38.5, 19.54, 1.0), (5, 38.5, 25.66, 1.0)), "silicone-rubber", "#1d1f22"), "VTX-214-010": (56.0, 36.0, 25.5, 3.0, ((1, 4.0, 12.0, 1.0), (2, 4.0, 24.0, 1.0), (3, 52.0, 13.0, 1.0), (4, 52.0, 18.0, 1.0)), "ptfe", "#1d1f22"), } L, W, top, pin_length, pins, case_material, colour = MODELS[model_name] x1, y1 = pins[0][1], pins[0][2] model = Model() with model.sketch("case_sketch", on="XY", name="Case") as sk: sk.rect("case_rect", (-x1, -y1), (L - x1, W - y1)) model.extrude("case", "case_sketch", distance=top, 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. for n, x, y, dia in pins: 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", (x - x1, y - y1), dia / 2) model.extrude(f"pin_{n}", f"pin_{n}_sketch", distance=pin_length, 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: copper (TPP 15-D: "Pin Material: Copper"), tinned. model.material(case_material, bodies=["case_body"], color=colour) if leads: model.material("copper", bodies=leads, color="#c9ccd1") result = model.result()