"""Kingbright through-hole 7-segment LED numeric displays: the 0.56 inch four-digit CA56-12 and CC56-12, the 0.56 inch two-digit DA56-11, the 0.4 inch two-digit DA04-11 and the 1.75 inch single-digit SBC18-11. The part number gives the package and the emitting colour. The display lies on the board (the XY plane) on the rim of its back, centred on the origin, the digits along X and upright along +Y, the face up (+Z) and the pins down through the board. The housing is one solid, each segment and decimal point its own solid on the face, and each pin its own solid. Dimensions from Kingbright's data sheets; see the README.""" import math from steve import Model part_number = "CA56-12EWA" # Kingbright part number # package: (length along X, height along Y, depth from the face to the rim of the back, rim depth, digits, digit pitch, digit height, # digit width, segment width, slant (degrees), decimal point diameter, pins per row, row spacing, pin pitch, pin diameter, pin length # below the rim), mm. Kingbright data sheets, "PACKAGE DIMENSIONS" (page 1); tolerance +/-0.25 unless noted: # CA56-12, CC56-12: CA56-12EWA DSAP8253 V.1A 02/26/2020: 50.3 x 19, 8.1 deep, 4 digits at 12.7, digit 14.2 high and 8.0 wide, # segment 1.5, 8 deg, DP 1.5, 12 pins in rows 15.24 apart at 2.54, pin 0.5 +0.25/-0.1, 4 +/-0.5 long. The rim depth isn't given. # DA56-11: DA56-11SURKWA DSAM8343 V.3A 02/27/2020: 25 x 19.05, 8.0 deep and 6.8 to the back's recess (rim 1.2), 2 digits at 12.7, # digit 14.22 high and 8 wide, segment 1.3, 8 deg, DP 1.68, 18 pins in rows 15.24 apart at 2.54, the end pins 2.34 from the ends. # DA04-11: DA04-11SURKWA DSAM8338 V.4A 02/27/2020: 20.2 x 16, 7 deep, 2 digits at 10.16, digit 10 high and 5.976 wide, segment # 1.0, 8 deg, DP 1.3 at 3.4 from its digit's centre, 16 pins in rows 12.7 apart at 2.54, the end pins 1.21 from the ends. The rim # depth isn't given. # SBC18-11: SBC18-11SURKCGKWA DSAK2749 V.6A JUN/25/2016: 38 x 56, 11 deep and 10 to the back's recess (rim 1.0), 1 digit 44.5 high # and 26.1 wide, segment 4.15, 10 deg, DP 4.5, 10 pins in rows 48.26 apart at 2.54, the end pins 13.92 from the ends, the rim's # ends 3 wide. PACKAGES = { "CA56-12": (50.3, 19.0, 8.1, 1.75, 4, 12.7, 14.2, 8.0, 1.5, 8.0, 1.5, 6, 15.24, 2.54, 0.5, 4.0), "DA56-11": (25.0, 19.05, 8.0, 1.2, 2, 12.7, 14.22, 8.0, 1.3, 8.0, 1.68, 9, 15.24, 2.54, 0.5, 4.0), "DA04-11": (20.2, 16.0, 7.0, 1.2, 2, 10.16, 10.0, 5.976, 1.0, 8.0, 1.3, 8, 12.7, 2.54, 0.5, 4.0), "SBC18-11": (38.0, 56.0, 11.0, 1.0, 1, 0.0, 44.5, 26.1, 4.15, 10.0, 4.5, 5, 48.26, 2.54, 0.5, 4.0), } # Part number: (package, emitting colour, data sheet), from each part's own Kingbright data sheet (README). CC56-12 is the common # cathode CA56-12 in the same package. PARTS = { "CA56-12CGKWA": ("CA56-12", "green", "DSAD2557 V.10A 10/16/2017"), "CA56-12EWA": ("CA56-12", "high efficiency red", "DSAP8253 V.1A 02/26/2020"), "CA56-12SEKWA": ("CA56-12", "super bright orange", "DSAK2823 V.8A 03/26/2018"), "CA56-12SRWA": ("CA56-12", "super bright red", "DSAP8254 V.1A 02/26/2020"), "CA56-12SURKWA": ("CA56-12", "hyper red", "DSAK2828 V.9A 03/26/2018"), "CA56-12SYKWA": ("CA56-12", "super bright yellow", "DSAK2832 V.7A 03/26/2018"), "CC56-12GWA": ("CA56-12", "green", "DSAP4627 V.2A 02/26/2020"), "CC56-12YWA": ("CA56-12", "yellow", "DSAD2374 V.7 MAR/28/2011"), "DA04-11CGKWA": ("DA04-11", "green", "DSAM8337 V.3A 02/27/2020"), "DA04-11SEKWA": ("DA04-11", "super bright orange", "DSAG8078 V.11A 04/26/2019"), "DA04-11SURKWA": ("DA04-11", "hyper red", "DSAM8338 V.4A 02/27/2020"), "DA04-11SYKWA": ("DA04-11", "super bright yellow", "DSAM8339 V.3A 02/27/2020"), "DA56-11CGKWA": ("DA56-11", "green", "DSAM8549 V.3A 02/27/2020"), "DA56-11SEKWA": ("DA56-11", "super bright orange", "DSAC9421 V.10A 03/15/2018"), "DA56-11SURKWA": ("DA56-11", "hyper red", "DSAM8343 V.3A 02/27/2020"), "DA56-11SYKWA": ("DA56-11", "super bright yellow", "DSAM8550 V.3A 02/27/2020"), "SBC18-11SURKCGKWA": ("SBC18-11", "hyper red and green", "DSAK2749 V.6A JUN/25/2016"), } # Proportions, for looks (the drawings show these but don't dimension them; README): the back is a rim around a shallow recess the pins # leave from; the rim's flat is 0.8 wide on the long sides and at the ends (CA56-12's ends 1.3, SBC18-11's 3, dimensioned), and its inner # wall slopes in over another 0.8. The rim depths of CA56-12 (1.75) and DA04-11 (1.2) are measured off their side views. The digits and # the pin rows are centred on the body; segments have a gap of a quarter of their width at each joint; a digit's decimal point sits at # its foot, its centre 0.569 x the digit width right of the digit's centre (DA04-11's dimensioned 3.4 / 5.976). CA56-12's colon dots # (DP5, DP6) are the decimal point's size, midway between digits 2 and 3, at 0.79 and 0.46 of the digit height. RIM = {"CA56-12": (1.3, 0.8, 0.8), "DA56-11": (0.8, 0.8, 0.8), "DA04-11": (0.8, 0.8, 0.8), "SBC18-11": (3.0, 0.8, 0.8)} DP_OFFSET = 0.569 COLON = (0.79, 0.46) PROUD = 0.03 # segments stand this far proud of the face so the renderer draws their edges SEGMENT_COLOURS = {"green": "#7fd36a", "high efficiency red": "#f05040", "super bright orange": "#ff9040", "super bright red": "#ff4038", "hyper red": "#ff3a3a", "super bright yellow": "#ffd640", "yellow": "#ffe060", "hyper red and green": "#ffb080"} if part_number not in PARTS: raise ValueError(f"no part {part_number!r}: {', '.join(PARTS)}") package, emitting, _sheet = PARTS[part_number] L, Hb, D, rim, digits, pitch, H, W, t, slant, dp_d, per_row, rows, pin_pitch, pin_d, pin_len = PACKAGES[package] end_flat, side_flat, slope = RIM[package] shear = math.tan(math.radians(slant)) model = Model() # Housing: a block from the rim (z = 0) to the face (z = D), with the recess in its back cut as a ruled loft. model.box("housing", L, Hb, D, at=(0, 0, D / 2), op="new", body="housing_body", name="Housing") with model.sketch("recess_open", on="XY", name="Recess") as sk: sk.rect("recess_open_rect", (-L / 2 + end_flat, -Hb / 2 + side_flat), (L / 2 - end_flat, Hb / 2 - side_flat)) model.plane("recess_plane", on="XY", offset=rim, name="Recess") with model.sketch("recess_floor", on="recess_plane", name="Recess") as sk: sk.rect("recess_floor_rect", (-L / 2 + end_flat + slope, -Hb / 2 + side_flat + slope), (L / 2 - end_flat - slope, Hb / 2 - side_flat - slope)) model.loft("recess", ["recess_open", "recess_floor"], ruled=True, op="cut", body="housing_body", name="Recess") def sheared(points, cx, y0): """Digit-local points (x across, y up from the digit's foot) on the face, slanted about the digit's mid-height.""" return [(cx + x + (y - H / 2) * shear, y0 + y) for x, y in points] def horizontal(y, g): x1, x2 = -W / 2 + t / 2 + g, W / 2 - t / 2 - g return [(x1, y), (x1 + t / 2, y + t / 2), (x2 - t / 2, y + t / 2), (x2, y), (x2 - t / 2, y - t / 2), (x1 + t / 2, y - t / 2)] def vertical(x, y1, y2): return [(x, y1), (x + t / 2, y1 + t / 2), (x + t / 2, y2 - t / 2), (x, y2), (x - t / 2, y2 - t / 2), (x - t / 2, y1 + t / 2)] # Segments a to g and the decimal point of each digit, each its own solid, on a plane at the face. g = t / 4 y0 = -H / 2 xv = W / 2 - t / 2 segments = { "a": horizontal(H - t / 2, g), "g": horizontal(H / 2, g), "d": horizontal(t / 2, g), "f": vertical(-xv, H / 2 + g, H - t / 2 - g), "b": vertical(xv, H / 2 + g, H - t / 2 - g), "e": vertical(-xv, t / 2 + g, H / 2 - g), "c": vertical(xv, t / 2 + g, H / 2 - g), } model.plane("face_plane", on="XY", offset=D, name="Face") lit = [] for i in range(digits): cx = (i - (digits - 1) / 2) * pitch for s, points in segments.items(): with model.sketch(f"seg{i + 1}{s}_sketch", on="face_plane", name=f"Digit {i + 1} segment {s}") as sk: sk.polyline(f"seg{i + 1}{s}_outline", sheared(points, cx, y0), closed=True) model.extrude(f"seg{i + 1}{s}", f"seg{i + 1}{s}_sketch", distance=PROUD, op="new", body=f"seg{i + 1}{s}_body", name=f"Digit {i + 1} segment {s}") lit.append(f"seg{i + 1}{s}_body") dots = [(cx + DP_OFFSET * W, y0 + dp_d / 2)] if package == "CA56-12" and i == 1: dots += [(cx + pitch / 2 + (f - 0.5) * H * shear, y0 + f * H) for f in COLON] for k, (x, y) in enumerate(dots): with model.sketch(f"dp{i + 1}_{k}_sketch", on="face_plane", name=f"Digit {i + 1} dot") as sk: sk.circle(f"dp{i + 1}_{k}_circle", (x, y), dp_d / 2) model.extrude(f"dp{i + 1}_{k}", f"dp{i + 1}_{k}_sketch", distance=PROUD, op="new", body=f"dp{i + 1}_{k}_body", name=f"Digit {i + 1} dot") lit.append(f"dp{i + 1}_{k}_body") # Pins: round, from the recess floor down to their length below the rim, two rows of per_row, each its own solid. model.plane("pin_plane", on="XY", offset=-pin_len, name="Pins") pins = [] for r, y in enumerate((-rows / 2, rows / 2)): for j in range(per_row): x = (j - (per_row - 1) / 2) * pin_pitch with model.sketch(f"pin{r}_{j}_sketch", on="pin_plane", name="Pin") as sk: sk.circle(f"pin{r}_{j}_circle", (x, y), pin_d / 2) model.extrude(f"pin{r}_{j}", f"pin{r}_{j}_sketch", distance=pin_len + rim, op="new", body=f"pin{r}_{j}_body", name="Pin") pins.append(f"pin{r}_{j}_body") # Materials (the sheets name no materials and give no weight): the housing plastic shown as pc, grey face; the segments are the # epoxy-filled diffusers ("Do not apply stress to the epoxy resin", page 4), shown as pmma (1.18, epoxy about 1.2), white diffused and # tinted with the emitting colour; the pins are metal (the sheets don't say which), shown as copper. model.material("pc", bodies=["housing_body"], color="#5b5d60") model.material("pmma", bodies=lit, color=SEGMENT_COLOURS[emitting]) model.material("copper", bodies=pins, color="#c9ccd1") result = model.result()