"""Trimming potentiometer, Bourns 3266 (1/4 inch square), 3296 and 3299 (3/8 inch square, multiturn) in the pin styles P, W and Y, 3339 (5/16 inch round, top adjust) in styles H and P, and 3386 (3/8 inch square, single turn) in style W (side adjust). The board is the XY plane and the three pins point down (-Z); the body is centred on the origin in X and Y. 3266, 3296, 3299: the adjustment screw points along +X in style P (side adjust, the body lying flat) and along +Z in styles W and Y (top adjust). 3339: the slotted rotor is in the top face. 3386W: the body stands on a narrow face and the slotted rotor is in the face towards -Y. The body, the adjustment screw (3266, 3296, 3299) and every pin are separate solids. Dimensions in the README.""" import math from steve import Model series = "3296" # Series: Bourns 3266, 3296, 3299, 3339 or 3386 style = "W" # Pin style: H, P, W or Y (each series has its own) # Body and adjustment screw, from each sheet's "Common Dimensions" drawing (page 1). L: from the seating plane of # styles W and Y to the face with the adjustment screw (the standoff is inside it); L_P (3266 only): the same side as # the sheet gives it for style P, lying flat; H: the other side of the square; T: thickness; screw_out: how far the # screw head stands out of its face; screw_d, slot_w, slot_deep: "ADJ. SLOT" diameter x wide x deep; screw_h: screw # centre from the nearer narrow face; screw_t: screw centre from the nearer large face; pin_d, pin_l: pin diameter and # length below the seating plane; pin1_h (3266 only): pin 1 from the narrow face the screw is near. # Bourns data sheets "3266 - 1/4 inch Square Trimpot Trimming Potentiometer" (REV. 07/24), "3296 - 3/8 inch Square # Trimpot Trimming Potentiometer" and "3299 - 3/8 inch Square Trimpot Trimming Potentiometer" (files dated 2026-05-17), # page 1. SERIES = { "3266": {"L": 7.24, "L_P": 6.78, "H": 6.71, "T": 4.50, "screw_out": 1.02, "screw_d": 1.78, "slot_w": 0.51, "slot_deep": 0.64, "screw_h": 1.22, "screw_t": 1.27, "pin_d": 0.46, "pin_l": 4.88, "pin1_h": 0.76}, "3296": {"L": 10.03, "H": 9.53, "T": 4.83, "screw_out": 1.52, "screw_d": 2.19, "slot_w": 0.56, "slot_deep": 0.76, "screw_h": 1.27, "screw_t": 1.27, "pin_d": 0.51, "pin_l": 6.40}, "3299": {"L": 10.03, "H": 9.53, "T": 6.10, "screw_out": 1.52, "screw_d": 2.29, "slot_w": 0.56, "slot_deep": 0.64, "screw_h": 1.12, "screw_t": 1.09, "pin_d": 0.51, "pin_l": 6.22}, } PITCH = 2.54 # between neighbouring pins, every style of every series # Pin fields, from each style's drawing on page 1. "row" is the distance of the first row from the face named by # "face"; "first" says which pins that row holds ("ends": pins 1 and 3, "pin2": pin 2); the other pins stand "step" # further from that face (0: the three pins in line). Styles W and Y: "far" is the large face away from the screw, # "near" the large face the screw is near. Style P: "opposite" is the narrow face opposite the screw's, "screw" the # face with the screw. PINS = { "3266": {"P": {"face": "screw", "first": "pin2", "row": 0.76, "step": 2.54}, "W": {"face": "near", "first": "pin2", "row": 1.02, "step": 2.54}, "Y": {"face": "near", "first": "ends", "row": 2.16, "step": 0}}, "3296": {"P": {"face": "opposite", "first": "ends", "row": 5.23, "step": 2.54}, "W": {"face": "far", "first": "ends", "row": 2.41, "step": 0}, "Y": {"face": "far", "first": "ends", "row": 1.14, "step": 2.54}}, "3299": {"P": {"face": "opposite", "first": "ends", "row": 5.23, "step": 2.54}, "W": {"face": "far", "first": "ends", "row": 1.91, "step": 0}, "Y": {"face": "far", "first": "ends", "row": 1.91, "step": 2.54}}, } # Proportions, for looks only: the 3296 and 3299 drawings show the pin field in the middle of the body without a # dimension from the body's edges across the row, so it is centred there (the 3266 sheet gives pin 1 from the edge); # the screw slot is drawn across the body's thickness. # 3339, 5/16 inch round, top adjust: from the data sheet "3339 - 5/16 inch Round Trimpot Trimming Potentiometer" # (REV. 06/24), page 1, "3339H Common Dimensions (Top Adjust)" and "3339P". D: body diameter; H: from the seating # plane to the top face (the 0.51 standoff is inside it); pin_d, pin_l: pin diameter and length below the seating # plane (4.78 MIN.); slot_l, slot_w, slot_deep: "ADJ. CROSS SLOT" long x wide x deep, 2 places. ROUND = { "3339": {"D": 7.62, "H": 6.35, "pin_d": 0.43, "pin_l": 4.78, "slot_l": 2.54, "slot_w": 0.64, "slot_deep": 0.76}, } # Pin fields, from the bottom views. Style H: pin 2 0.38 from the body's axis; pins 1 and 3 each 2.54 from pin 2, # 90 degrees apart, on the other side of the axis. Style P: pins 1 and 3 2.54 either side of the axis on one line, pin 2 # 2.54 from the axis on the perpendicular line. ROUND_PINS = { "3339": {"H": {"pin2": 0.38, "arm": 2.54, "angle": 90}, "P": {"grid": 2.54}}, } # 3386, 3/8 inch square, single turn, side adjust (standing): from the data sheet "3386 - 3/8 inch Square Trimpot # Trimming Potentiometer" (REV. 12/24), page 1, "Common Dimensions Side Adjust Models H,S,W" and "3386W". W: body width; # H: from the seating plane to the top (the 0.38 standoff is inside it); T: body thickness, 4.83 in the "3386B" and # the top adjust drawings (the W drawing shows the same body without the figure); rotor_h: rotor centre above the # seating plane; slot_w, slot_deep, slot_l: "ADJ. SLOT" wide x deep x long; pin_d, pin_l: pin diameter and length # below the seating plane; row: the pin row from the face away from the rotor; pitch: between neighbouring pins. SIDE = { "3386": {"W": 9.53, "H": 9.53, "T": 4.83, "rotor_h": 5.64, "slot_w": 0.76, "slot_deep": 0.76, "slot_l": 3.15, "pin_d": 0.51, "pin_l": 5.97, "row": 2.44, "pitch": 2.54}, } SIDE_STYLES = {"3386": ("W",)} # Proportions, for looks only (3339, 3386): the rotors' diameters are not given, so they are not separate solids; the # slots are cut into the body at the rotor's place, the 3339's in the middle of the top face, the 3386's in the middle # of the 9.53 width (the drawing gives the rotor's height only); the 3386's pin 2 is in the middle of the width. STYLES = {**{k: tuple(v) for k, v in PINS.items()}, **{k: tuple(v) for k, v in ROUND_PINS.items()}, **SIDE_STYLES} if series not in STYLES: raise ValueError(f"no series {series!r}: {', '.join(STYLES)}") if style not in STYLES[series]: raise ValueError(f"no style {style!r} for series {series}: {', '.join(STYLES[series])}") def place(l: float, h: float, t: float) -> tuple: """Body coordinates (l towards the screw face, h away from the narrow face the screw is near, t towards the large face the screw is near, from the body's centre) to the mounted part.""" if style == "P": return (l, h, t + T / 2) return (h, t, l + L / 2) def turn(l: float, h: float, t: float) -> tuple: if style == "P": return (l, h, t) return (h, t, l) def size(l: float, h: float, t: float) -> tuple: return tuple(abs(v) for v in turn(l, h, t)) model = Model() if series in SERIES: B = SERIES[series] F = PINS[series][style] L, H, T = (B.get("L_P", B["L"]) if style == "P" else B["L"]), B["H"], B["T"] screw_h = -H / 2 + B["screw_h"] screw_t = T / 2 - B["screw_t"] h1 = -H / 2 + B["pin1_h"] if "pin1_h" in B else -PITCH # pin 1 across the row, from the body's centre first = F["row"] other = F["row"] + F["step"] ends, mid = (first, other) if F["first"] == "ends" else (other, first) if style == "P": sign, edge = (1, -L / 2) if F["face"] == "opposite" else (-1, L / 2) pins = [(edge + sign * ends, h1, -T / 2), (edge + sign * mid, h1 + PITCH, -T / 2), (edge + sign * ends, h1 + 2 * PITCH, -T / 2)] down = (0, 0, -1) else: sign, edge = (1, -T / 2) if F["face"] == "far" else (-1, T / 2) pins = [(-L / 2, h1, edge + sign * ends), (-L / 2, h1 + PITCH, edge + sign * mid), (-L / 2, h1 + 2 * PITCH, edge + sign * ends)] down = (-1, 0, 0) model.box("body", *size(L, H, T), at=place(0, 0, 0), op="new", body="body_body", name="Body") model.cylinder("screw", B["screw_d"] / 2, B["screw_out"], at=place(L / 2, screw_h, screw_t), direction=turn(1, 0, 0), op="new", body="screw_body", name="Adjustment screw") model.box("slot", *size(B["slot_deep"], B["slot_w"], B["screw_d"] + 1), at=place(L / 2 + B["screw_out"] - B["slot_deep"] / 2, screw_h, screw_t), op="cut", body="screw_body", name="Screw slot") for number, at in enumerate(pins, start=1): model.cylinder(f"pin_{number}", B["pin_d"] / 2, B["pin_l"], at=place(*at), direction=turn(*down), op="new", body=f"pin_{number}_body", name=f"Pin {number}") elif series in ROUND: R = ROUND[series] F = ROUND_PINS[series][style] if "arm" in F: half = math.radians(F["angle"] / 2) dx, dy = F["arm"] * math.sin(half), F["arm"] * math.cos(half) pins = [(-dx, F["pin2"] - dy), (0.0, F["pin2"]), (dx, F["pin2"] - dy)] else: pins = [(-F["grid"], 0.0), (0.0, F["grid"]), (F["grid"], 0.0)] model.cylinder("body", R["D"] / 2, R["H"], at=(0, 0, 0), direction=(0, 0, 1), op="new", body="body_body", name="Body") model.box("slot_x", R["slot_l"], R["slot_w"], R["slot_deep"] + 1, at=(0, 0, R["H"] - R["slot_deep"] + (R["slot_deep"] + 1) / 2), op="cut", body="body_body", name="Cross slot") model.box("slot_y", R["slot_w"], R["slot_l"], R["slot_deep"] + 1, at=(0, 0, R["H"] - R["slot_deep"] + (R["slot_deep"] + 1) / 2), op="cut", body="body_body", name="Cross slot, second bar") for number, (x, y) in enumerate(pins, start=1): model.cylinder(f"pin_{number}", R["pin_d"] / 2, R["pin_l"], at=(x, y, 0), direction=(0, 0, -1), op="new", body=f"pin_{number}_body", name=f"Pin {number}") else: S = SIDE[series] model.box("body", S["W"], S["T"], S["H"], at=(0, 0, S["H"] / 2), op="new", body="body_body", name="Body") model.box("slot", S["slot_l"], S["slot_deep"] + 1, S["slot_w"], at=(0, -S["T"] / 2 + S["slot_deep"] - (S["slot_deep"] + 1) / 2, S["rotor_h"]), op="cut", body="body_body", name="Rotor slot") for number in (1, 2, 3): model.cylinder(f"pin_{number}", S["pin_d"] / 2, S["pin_l"], at=((number - 2) * S["pitch"], S["T"] / 2 - S["row"], 0), direction=(0, 0, -1), op="new", body=f"pin_{number}_body", name=f"Pin {number}") result = model.result()