"""Thick film chip resistor, Vishay D/CRCW e3 sizes 0402 to 2512. Centred on the origin, lying on the XY plane with its length along X: the alumina body, the overcoat on top between the terminations, and a wrap-around termination at each end (each its own solid). Dimensions from Vishay's data sheet; see the README.""" from steve import Model size = "0603" # case size, inch code # size: (length L, width W, height H, bottom termination T1, top termination T2, mass in mg), nominal values in mm. # Vishay, "D/CRCW e3, Standard Thick Film Chip Resistors", document 20035, revision 14-Apr-2026 # (https://www.vishay.com/docs/20035/dcrcwe3.pdf), page 11, "DIMENSIONS AND MASS" table. # 0603's L is 1.55 +0.10/-0.05; the others' are the stated nominal. SIZES = { "0402": (1.0, 0.5, 0.35, 0.25, 0.2, 0.65), "0603": (1.55, 0.85, 0.45, 0.3, 0.3, 2.0), "0805": (2.0, 1.25, 0.5, 0.3, 0.3, 5.5), "1206": (3.2, 1.6, 0.55, 0.45, 0.4, 10.0), "1210": (3.2, 2.5, 0.55, 0.45, 0.4, 16.0), "1218": (3.2, 4.6, 0.55, 0.45, 0.4, 29.5), "2010": (5.0, 2.5, 0.6, 0.6, 0.6, 25.5), "2512": (6.3, 3.15, 0.6, 0.6, 0.6, 40.5), } # Proportion, for looks: the terminations' and the overcoat's thickness, 0.1 x H (the data sheet doesn't dimension it). SKIN = 0.1 L, W, H, T1, T2, _mass = SIZES[size] t = SKIN * H model = Model() # The alumina body inside the terminations and under the overcoat. model.box("body", L - 2 * t, W, H - 2 * t, at=(0, 0, H / 2), op="new", body="body_body", name="Body") # The overcoat on top between the terminations' top bands. model.box("overcoat", L - 2 * T2, W, t, at=(0, 0, H - t / 2), op="new", body="overcoat_body", name="Overcoat") # Each termination: its section in the XZ plane (bottom band T1 long, the end face, the top band T2 long), extruded across the width. for tag, side in (("left", -1), ("right", 1)): x_end = side * L / 2 section = [(x_end, 0.0), (x_end - side * T1, 0.0), (x_end - side * T1, t), (x_end - side * t, t), (x_end - side * t, H - t), (x_end - side * T2, H - t), (x_end - side * T2, H), (x_end, H)] # The XZ plane's normal is -Y: offset -W/2 puts it on the +Y face, and the extrusion runs across the width to -Y. model.plane(f"{tag}_plane", on="XZ", offset=-W / 2, name="Terminations") with model.sketch(f"{tag}_sketch", on=f"{tag}_plane", name="Terminations") as sk: sk.polyline(f"{tag}_section", section, closed=True) model.extrude(f"{tag}_term", f"{tag}_sketch", distance=W, op="new", body=f"{tag}_body", name="Terminations") # Materials, for looks and a rough mass: the substrate is alumina; the overcoat is glass and epoxy, ptfe (2.07) the nearest in the material # list; the terminations are nickel barrier under matte tin (the "e3" finish), shown as tin. model.material("alumina", bodies=["body_body"], color="#f2efe6") model.material("ptfe", bodies=["overcoat_body"], color="#1f2124") model.material("tin", bodies=["left_body", "right_body"], color="#c9ccd1") result = model.result()