"""Encapsulated mains transformer for printed circuit boards, Breve Tufvassons TEZ series, 0.5 to 16 VA: a cast resin block on two rows of 0.8 mm pins. The block's underside is the XY plane and the pins point down (-Z). The block is centred on the origin; the pin rows run along X, the primary row at +Y with pin 1 at its -X end, the secondary row at -Y. The block and every pin are separate solids. Dimensions in the README.""" from steve import Model size = "28x33x24" # Size: block depth x width x height (the sheet's A x B x C) # size: A depth across the pin rows, B width along them, C height, a1 between the two rows, the pin positions along a row # measured from its first pin, and the primary row's positions that have no pin (1 = pin 1's place). Breve Tufvassons # data sheet "TEZ Transformers for PCB" (PDF dated 2020-07-20): table on page 1, pin spacing drawings on page 2. SIZES = { "22x24x19": {"A": 22, "B": 24, "C": 19, "a1": 15, "at": [0, 5, 10, 15], "no_pin": [3]}, # TEZ 0,5/D "28x33x22": {"A": 28, "B": 33, "C": 22, "a1": 20, "at": [0, 5, 10, 15, 20], "no_pin": [3]}, # TEZ 1,5/D, 1,8/D "28x33x24": {"A": 28, "B": 33, "C": 24, "a1": 20, "at": [0, 5, 10, 15, 20], "no_pin": [3]}, # TEZ 1,5/X, 2,0/D, 2,3/D "28x33x27": {"A": 28, "B": 33, "C": 27, "a1": 20, "at": [0, 5, 10, 15, 20], "no_pin": [3]}, # TEZ 2,1/D, 2,5/D, 2,6/D (40 °C) "28x33x30": {"A": 28, "B": 33, "C": 30, "a1": 20, "at": [0, 5, 10, 15, 20], "no_pin": [3]}, # TEZ 2,6/D (60 °C), 3,0/D "35x42x29": {"A": 35, "B": 42, "C": 29, "a1": 25, "at": [0, 5, 10, 15, 20], "no_pin": [3]}, # TEZ 4,0/D, 4,5/D "38x45x32": {"A": 38, "B": 45, "C": 32, "a1": 25, "at": [0, 5, 12.5, 20, 25], "no_pin": [3]}, # TEZ 6,0/D "44x52x35": {"A": 44, "B": 52, "C": 35, "a1": 27.5, "at": [0, 5, 10, 15, 20, 25], "no_pin": [3, 4]}, # TEZ 10,0/D "44x52x41.5": {"A": 44, "B": 52, "C": 41.5, "a1": 27.5, "at": [0, 5, 10, 15, 20, 25], "no_pin": [3, 4]}, # TEZ 15,0/D "47x57x39": {"A": 47, "B": 57, "C": 39, "a1": 30, "at": [0, 5, 10, 15, 20, 25, 30], "no_pin": [4]}, # TEZ 16,0/D } PIN_DIAMETER = 0.8 # page 2: "ø 0.8" # Proportions, for looks only: the sheet draws the pins below the block without a length. PIN_LENGTH = 4.0 if size not in SIZES: raise ValueError(f"no size {size!r}: {', '.join(SIZES)}") T = SIZES[size] span = T["at"][-1] model = Model() model.box("block", T["B"], T["A"], T["C"], at=(0, 0, T["C"] / 2), op="new", body="block_body", name="Block") number = 0 for row, y in (("primary", T["a1"] / 2), ("secondary", -T["a1"] / 2)): places = T["at"] if row == "primary" else list(reversed(T["at"])) # numbered round the block, as the sheet does for place, x in enumerate(places, start=1): number += 1 if row == "primary" and place in T["no_pin"]: continue model.cylinder(f"pin_{number}", PIN_DIAMETER / 2, PIN_LENGTH, direction=(0, 0, -1), at=(x - span / 2, y, 0), op="new", body=f"pin_{number}_body", name=f"Pin {number}") result = model.result()