"""Straight through-hole pin socket, 2.54 mm pitch, one or two rows. Pin 1 is at the origin, the row along +X, the second row along +Y; the insulator's underside is on the XY plane, the openings up, the tails down through the board. Dimensions in the README.""" from steve import Model rows = 1 # Rows pins = 8 # Pins per row detail = "full" # full: contact openings and tails; simple: a plain block # Samtec SSW/SSQ catalogue page (F-226): height 8.51, width 2.43 (one row) and 4.95 (two rows), length 2.54 x positions + 0.51, tail A 4.93 (lead # style -02), insertion depth up to 6.35. PITCH = 2.54 HEIGHT = 8.51 WIDTHS = {1: 2.43, 2: 4.95} LENGTH_EXTRA = 0.51 TAIL = 4.93 DEPTH = 6.35 OPENING = 0.4 * PITCH # the opening's and the tail's sizes are proportions, for looks; the page doesn't print them TAIL_SIZE = 0.2 * PITCH width = WIDTHS[rows] length = PITCH * pins + LENGTH_EXTRA x0 = -PITCH / 2 - LENGTH_EXTRA / 2 y0 = (rows - 1) * PITCH / 2 - width / 2 model = Model() with model.sketch("body_sketch", on="XY", name="Insulator") as sk: sk.rect("body_outline", (x0, y0), (x0 + length, y0 + width)) model.extrude("body", "body_sketch", distance=HEIGHT, name="Insulator") if detail == "full": model.plane("top_plane", on="XY", offset=HEIGHT, name="Top") model.plane("tail_plane", on="XY", offset=-TAIL, name="Tail end") with model.sketch("openings_sketch", on="top_plane", name="Contact openings") as sk: for row in range(rows): for i in range(pins): x, y = i * PITCH, row * PITCH sk.rect(f"opening_{row}_{i}", (x - OPENING / 2, y - OPENING / 2), (x + OPENING / 2, y + OPENING / 2)) model.extrude("openings", "openings_sketch", distance=-DEPTH, op="cut", name="Contact openings") with model.sketch("tails_sketch", on="tail_plane", name="Tails") as sk: for row in range(rows): for i in range(pins): x, y = i * PITCH, row * PITCH sk.rect(f"tail_{row}_{i}", (x - TAIL_SIZE / 2, y - TAIL_SIZE / 2), (x + TAIL_SIZE / 2, y + TAIL_SIZE / 2)) model.extrude("tails", "tails_sketch", distance=TAIL, name="Tails") model.material("steel-generic", color="#2b2b2d") result = model.result()