"""Surface-mount diode in a DO-214 package (SMA, SMB, SMC), by Vishay's outline drawings. Centred on the origin with the seating plane on the XY plane and the length along X: the moulded body, the cathode band on top at the -X end, and a J-bend lead at each end that wraps under the body (each lead its own solid). Dimensions from Vishay's outline drawings; see the README.""" from steve import Model package = "SMA" # DO-214AC (SMA), DO-214AA (SMB) or DO-214AB (SMC) # package: (JEDEC outline, body length, body width, lead width, height, lead thickness, foot under the body, length over the leads, # standoff under the body), ranges (min, max) in mm. # Vishay Semiconductors outline drawings, "DIMENSIONS in inches (millimeters)", revision 09-Jul-10: # SMA document 95400 (https://www.vishay.com/docs/95400/sma.pdf), SMB 95401 (.../95401/smb.pdf), SMC 95402 (.../95402/smc.pdf). OUTLINES = { "SMA": ("DO-214AC", (3.99, 4.50), (2.54, 2.79), (1.25, 1.65), (1.98, 2.29), (0.152, 0.305), (0.76, 1.52), (4.93, 5.28), (0.0, 0.203)), "SMB": ("DO-214AA", (4.06, 4.57), (3.30, 3.94), (1.95, 2.20), (2.13, 2.44), (0.152, 0.305), (0.76, 1.52), (5.21, 5.59), (0.0, 0.2)), "SMC": ("DO-214AB", (6.60, 7.11), (5.59, 6.22), (2.90, 3.20), (2.06, 2.62), (0.152, 0.305), (0.76, 1.52), (7.75, 8.13), (0.0, 0.2)), } # Proportions, for looks (the drawings show these but don't dimension them): the lead leaves the body at half the height; the cathode band # is 0.12 of the body's length wide, 0.1 of it in from the -X end, and 0.03 proud of the top. ARM = 0.5 BAND_W = 0.12 BAND_IN = 0.1 BAND_T = 0.03 def mid(pair): return (pair[0] + pair[1]) / 2 jedec, BL, BW, LW, HT, LT, FOOT, SPAN, STAND = OUTLINES[package] body_l, body_w, lead_w, height, t, foot, span, standoff = (mid(v) for v in (BL, BW, LW, HT, LT, FOOT, SPAN, STAND)) model = Model() model.box("body", body_l, body_w, height - standoff, at=(0, 0, (height + standoff) / 2), op="new", body="body_body", name="Body") model.box("band", BAND_W * body_l, body_w, BAND_T, at=(-body_l / 2 + (BAND_IN + BAND_W / 2) * body_l, 0, height + BAND_T / 2), op="new", body="band_body", name="Cathode band") arm_z = ARM * height leads = [] for tag, side in (("cathode", -1), ("anode", 1)): inner, face, out = side * (body_l / 2 - 0.3), side * body_l / 2, side * span / 2 tip = out - side * foot # The lead's side section (x, z): out of the body's end at arm_z, down the outside, and under the body to the foot's inner end. section = [(inner, arm_z + t), (out, arm_z + t), (out, 0.0), (tip, 0.0), (tip, t), (out - side * t, t), (out - side * t, arm_z), (inner, arm_z)] # The XZ plane's normal is -Y: offset -lead_w / 2 puts it on the lead's +Y side, and the extrusion runs across the lead to -Y. model.plane(f"{tag}_plane", on="XZ", offset=-lead_w / 2, name="Leads") with model.sketch(f"{tag}_sketch", on=f"{tag}_plane", name="Leads") as sk: sk.polyline(f"{tag}_section", section, closed=True) model.extrude(f"{tag}_lead", f"{tag}_sketch", distance=lead_w, op="new", body=f"{tag}_body", name="Leads") leads.append(f"{tag}_body") # The leads run into the body by 0.3, and their feet tuck under it in a recess: cut that room out of the body, so that no solids overlap. with model.sketch("room_sketch", on="cathode_plane", name="Room for the leads") as sk: for tag, side in (("cathode", -1), ("anode", 1)): a, b = side * (body_l / 2 - 0.3), side * body_l / 2 sk.rect(f"room_{tag}", (min(a, b), arm_z), (max(a, b), arm_z + t)) c = side * (span / 2 - foot) sk.rect(f"recess_{tag}", (min(c, b), 0.0), (max(c, b), t)) model.extrude("room", "room_sketch", distance=lead_w, op="cut", body="body_body", name="Room for the leads") # Materials, for looks and a rough mass: the moulding is epoxy compound, mostly silica filler (density about 1.9 to 2.0), ptfe (2.07) the # nearest in the material list; the leads are tin-plated copper, copper; the band is marking ink, shown in ptfe. model.material("ptfe", bodies=["body_body"], color="#26282b") model.material("ptfe", bodies=["band_body"], color="#c8c8c4") model.material("copper", bodies=leads, color="#c9ccd1") result = model.result()