"""Samtec HPM power header: a single row of 1.14 mm square posts at 5.08 mm pitch in a 6.35 mm wide insulator, straight through-hole. Position 1 is at the origin and the row runs along +X. The insulator's underside is the XY plane, the mating posts point up (+Z) and the tails go down through the board. The insulator and every post are separate solids. Dimensions from Samtec's HPM print and catalogue page; see the README.""" from steve import Model positions = 5 # Positions, 1 to 20 lead_style = "01" # Samtec lead style: 01, 02, 04 or 05 # Samtec print HPM-XX-XX-XX-X-XX-X ".200 HIGH POWER BLOCK, ASM", revision Y, sheet 1: insulator length "No OF POS X .20[5.1]", # pin row "(No OF POS-1) X .200[5.08]", first pin .100 [2.54] REF from the insulator's end, insulator .250 [6.35] REF wide # (.125 [3.18] REF each side of the pin row) and .100 [2.54] REF high, post .045 [1.14] SQ REF. BODY = {"pitch": 5.08, "end": 2.54, "width": 6.35, "height": 2.54, "post": 1.14} # The same print, TABLE 1, and Samtec's catalogue page "Power headers, stackers & sockets, (5.08 mm) .200 in pitch, HPM, HPW, HPF # series" (F-226 supplement), lead style chart: "A" the tail below the insulator, "B" the post above it. LEAD_STYLES = { "01": {"tail": 4.57, "post": 11.94}, "02": {"tail": 4.57, "post": 13.21}, "04": {"tail": 4.09, "post": 21.06}, "05": {"tail": 4.57, "post": 3.81}, } # Proportions, for looks (the print draws the V notches between positions but doesn't dimension them; README): each notch's # width at the insulator's side and its depth toward the pin row. PROPORTIONS = {"notch_w": 1.1, "notch_d": 2.1} if lead_style not in LEAD_STYLES: raise ValueError(f"no lead style {lead_style!r}: {', '.join(LEAD_STYLES)}") if not 1 <= positions <= 20: raise ValueError("HPM comes with 1 to 20 positions") L = LEAD_STYLES[lead_style] pitch, width, height, post = BODY["pitch"], BODY["width"], BODY["height"], BODY["post"] x0 = -BODY["end"] length = positions * pitch half_notch, notch_d = PROPORTIONS["notch_w"] / 2, PROPORTIONS["notch_d"] # The insulator's outline: a rectangle with a V notch in both long sides between every two positions. outline = [(x0, -width / 2)] for i in range(1, positions): x = x0 + i * pitch outline += [(x - half_notch, -width / 2), (x, -width / 2 + notch_d), (x + half_notch, -width / 2)] outline += [(x0 + length, -width / 2), (x0 + length, width / 2)] for i in range(positions - 1, 0, -1): x = x0 + i * pitch outline += [(x + half_notch, width / 2), (x, width / 2 - notch_d), (x - half_notch, width / 2)] outline += [(x0, width / 2)] model = Model() with model.sketch("insulator_sketch", on="XY", name="Insulator") as sk: sk.polyline("insulator_outline", outline, closed=True) model.extrude("insulator", "insulator_sketch", distance=height, op="new", body="insulator_body", name="Insulator") with model.sketch("hole_sketch", on="XY", name="Post holes") as sk: for i in range(positions): sk.rect(f"hole_{i + 1}", (i * pitch - post / 2, -post / 2), (i * pitch + post / 2, post / 2)) model.extrude("holes", "hole_sketch", distance=height, op="cut", body="insulator_body", name="Post holes") # Each post: one square bar from the tail's end to the post's top. run = L["tail"] + height + L["post"] posts = [] for i in range(positions): n = i + 1 model.box(f"post_{n}", post, post, run, at=(i * pitch, 0, -L["tail"] + run / 2), op="new", body=f"post_{n}_body", name=f"Post {n}") posts.append(f"post_{n}_body") # Materials. Print, TABLE 2: through-hole body "BLACK, PBT, UL 94 VO" (the catalogue page: "Glass Filled Polyester"), shown # as pet, the thermoplastic polyester listed here. Print: "TERMINAL: CDA7025" and plating "-T: MATTE TIN CONTACT AND TAIL" # (the catalogue page: "Copper Alloy", "Sn over 50 u-in (1.27 um) Ni"), shown as copper in a tin colour. model.material("pet", bodies=["insulator_body"], color="#1c1c1e") model.material("copper", bodies=posts, color="#c9ccd1") result = model.result()