"""Kingbright surface-mount chip LEDs: a laminate substrate with a terminal at each end and a clear moulded lens on top. Top-view packages APHHS1005 (EIA 0402), APT1608 (0603), APT2012 (0805) and APT3216 (1206), and the side-view APA1606, which lies with its lens facing +Y. The part is centred on the origin, its length along X, standing on the board (the XY plane) on its terminals. The substrate, the lens and each terminal are their own solids. Dimensions from Kingbright's data sheets; see the README.""" from steve import Model package = "APT1608" # Kingbright package # package: (length, width, height, substrate thickness, lens length at its foot, lens length at its top, terminal length underneath, # side view), mm. Kingbright data sheets, "PACKAGE DIMENSIONS" (page 1); length, width and height along the board for the top-view # packages; for the side-view APA1606 the 'width' is its depth along Y over the lens (1.2) and the 'height' its 0.6 thickness. # APHHS1005SURCK DSAD0911 V.18A 03/25/2021: 1 x 0.5 x 0.5, substrate 0.15, lens 0.8, terminals 0.4; +/-0.1. # APT1608SURCK DSAD0926 V.22A 04/08/2023: 1.6 x 0.8 x 0.75, substrate 0.25, lens 1.2 / 1.1, terminals 0.3; +/-0.1. # APT2012EC DSAD0943 V.13A 09/08/2021: 2 x 1.25 x 0.75, substrate 0.25, lens 1.3 / 1.2, terminals 0.4; +/-0.1. # APT3216SURCK DSAD0989 V.16A 03/17/2025: 3.2 x 1.6 x 0.75, substrate 0.25, lens 2 / 1.9, terminals 0.5; +/-0.2. # APA1606SURCK DSAF0543 V.20A 03/07/2025: 1.6 long, 0.6 thick, 1.2 over the lens, substrate 0.6, lens 1.2 / 1.1, terminals 0.25; # +/-0.1. PACKAGES = { "APHHS1005": (1.0, 0.5, 0.5, 0.15, 0.8, 0.8, 0.4, False), "APT1608": (1.6, 0.8, 0.75, 0.25, 1.2, 1.1, 0.3, False), "APT2012": (2.0, 1.25, 0.75, 0.25, 1.3, 1.2, 0.4, False), "APT3216": (3.2, 1.6, 0.75, 0.25, 2.0, 1.9, 0.5, False), "APA1606": (1.6, 1.2, 0.6, 0.6, 1.2, 1.1, 0.25, True), } # Proportions, for looks (the drawings show these but don't dimension them; README): a top-view part's terminal is a plating 0.03 thick # wrapped round the substrate's end, under it for the terminal length, up its end face and over its top to the lens's foot, the full # width; the side-view's terminals are end caps the terminal length long over its whole section, the substrate and lens between them # 0.03 inside it. The lens runs the full width of the part. PLATING = 0.03 if package not in PACKAGES: raise ValueError(f"no package {package!r}: {', '.join(PACKAGES)}") L, W, H, s, lens_foot, lens_top, pad, side = PACKAGES[package] P = PLATING model = Model() terminals = ["terminal1_body", "terminal2_body"] if side: # Side view: the substrate's back at y = -s / 2, the lens facing +Y to y = W - s / 2, standing on the board from z = 0 to H. model.box("substrate", L - 2 * pad, s - 2 * P, H - 2 * P, at=(0, 0, H / 2), op="new", body="substrate_body", name="Substrate") for k, sx in enumerate((-1, 1)): model.box(f"t{k + 1}_cap", pad, s, H, at=(sx * (L / 2 - pad / 2), 0, H / 2), op="new", body=terminals[k], name=f"Terminal {k + 1}") y0, y1 = s / 2 - P, W - s / 2 model.plane("lens_plane", on="XY", offset=P, name="Lens") with model.sketch("lens_sketch2", on="lens_plane", name="Lens") as sk: sk.polyline("lens_outline2", [(-lens_foot / 2, y0), (lens_foot / 2, y0), (lens_top / 2, y1), (-lens_top / 2, y1)], closed=True) model.extrude("lens", "lens_sketch2", distance=H - 2 * P, op="new", body="lens_body", name="Lens") else: # Top view: the substrate on the terminals' plating, the lens on the substrate up to H. model.box("substrate", L - 2 * P, W, s - P, at=(0, 0, (s + P) / 2), op="new", body="substrate_body", name="Substrate") over = (L - lens_foot) / 2 for k, sx in enumerate((-1, 1)): body = terminals[k] model.box(f"t{k + 1}_end", P, W, s + P, at=(sx * (L / 2 - P / 2), 0, (s + P) / 2), op="new", body=body, name=f"Terminal {k + 1}") model.box(f"t{k + 1}_under", pad - P, W, P, at=(sx * (L / 2 - P - (pad - P) / 2), 0, P / 2), op="join", body=body, name=f"Terminal {k + 1}") model.box(f"t{k + 1}_over", over - P, W, P, at=(sx * (L / 2 - P - (over - P) / 2), 0, s + P / 2), op="join", body=body, name=f"Terminal {k + 1}") model.plane("lens_plane", on="XZ", offset=-W / 2, name="Lens") with model.sketch("lens_sketch", on="lens_plane", name="Lens") as sk: sk.polyline("lens_outline", [(-lens_foot / 2, s), (lens_foot / 2, s), (lens_top / 2, H), (-lens_top / 2, H)], closed=True) model.extrude("lens", "lens_sketch", distance=W, op="new", body="lens_body", name="Lens") # Materials (the sheets name none and give no weight): the substrate a glass-epoxy laminate (about 1.9), shown as ptfe (2.2) as the # library's other moulded packages; the lens water-clear epoxy (about 1.2), shown as pmma (1.18); the terminals plated copper. model.material("ptfe", bodies=["substrate_body"], color="#f2efe6") model.material("pmma", bodies=["lens_body"], color="#f6f8fa") model.material("copper", bodies=terminals, color="#d4b25a") result = model.result()