main
John Lauer Component page: symbol, footprint, Fusion library, viewers, provenance, models 9bd3c07 3d ago
"""AI-created STEP model of the TE Connectivity 1-2199230-6 M.2 (NGFF) Key M socket, 4.2 mm height.

Built from TE customer drawing C-2199230 rev B4 (sheet 1 views and section, sheet 2 key table,
sheet 3 recommended PCB layout). No manufacturer CAD geometry is used.

Frame: millimetres, Z-up, PCB top surface z = 0. X = KiCad footprint X, Y = -KiCad Y (KiCad 3D
convention), origin = connector centre on the locating-hole line (datum X-Y), so the footprint's
(model) block needs no offset or rotation. The card enters from -Y (KiCad +Y).

Dimensions used (drawing values, REF values marked):
  housing width 21.9 (x +-10.95), slot width 20.15, max height 4.2 (modelled 4.15),
  front tails end 2.85 REF ahead of the hole line, rear tails end 5.85 REF behind it,
  card underside 2.48 REF above the PCB, card stop 1.75 behind the hole line,
  locating bosses at x = +-10 (dia 0.8 REF / 1.45 REF), protruding 0.6 below the PCB top,
  contact tails 0.15 wide; odd pins x = -9.25 + 0.25 (n - 1) (rear row), even pins x = -9.0 + 0.25 (n - 2) (front row),
  key M centre at x = +6.125 (pins 59-66 absent), solder pegs at x = +-10.35 (pads 1.2 x 2.75).
Heights and depths not dimensioned on the drawing were scaled off the sheet 1 section (94.4 px/mm, checked
on the 2.85 / 5.85 / 1.75 / 2.48 dimensions).

usage: python make_m2_socket_step.py out.step   (CadQuery 2.8)
"""
import sys
import cadquery as cq

OUT = sys.argv[1]
BLACK = cq.Color(0.08, 0.08, 0.09)
GOLD = cq.Color(0.86, 0.70, 0.25)
STEEL = cq.Color(0.78, 0.79, 0.81)


def box(x0, x1, y0, y1, z0, z1):
    return cq.Workplane("XY").box(x1 - x0, y1 - y0, z1 - z0, centered=False).translate((x0, y0, z0))


W = 10.95          # half housing width (21.9)
SW = 20.15 / 2     # half slot width
Z0 = 0.29          # housing underside standoff (section)
ZC = 2.48          # card underside (REF)
ZS = 3.38          # slot ceiling (section)
H = 4.15           # housing top (4.2 MAX)
YF = -2.25         # lower front face (section)
YN = -1.24         # upper nose front (section)
YS = 1.75          # card stop behind the hole line
YR = 5.10          # rear face (section)
KX = 6.125         # key M centre

lower = box(-W, W, YF, YR, Z0, ZC)
upper = box(-W, W, YN, YR, ZC, H).edges("|X and <Y and >Z").fillet(0.9)
slot = box(-SW, SW, YN - 0.01, YS, ZC, ZS)
key = box(KX - 0.5, KX + 0.5, YN, YS, ZC, ZS)
housing = lower.union(upper).cut(slot).union(key)
# locating bosses (left dia 0.8 REF into the dia 1.1 hole, right dia 1.45 REF into the dia 1.6 hole)
for x, d in ((-10.0, 0.8), (10.0, 1.45)):
    housing = housing.union(cq.Workplane("XY").center(x, 0).circle(d / 2).extrude(Z0 + 0.6).translate((0, 0, -0.6)))
# pin-1 triangle on the top surface, rear-left (drawing sheet 1 top view)
tri = (cq.Workplane("XY").polyline([(-9.25, 4.35), (-9.0, 4.75), (-9.5, 4.75)]).close()
       .extrude(0.05).translate((0, 0, H - 0.05)))
housing = housing.cut(tri)

ODD = [n for n in range(1, 76, 2) if not 59 <= n <= 66]
EVEN = [n for n in range(2, 75, 2) if not 59 <= n <= 66]
assert len(ODD) == 34 and len(EVEN) == 33
contacts = None
T = 0.12
for n in ODD:      # rear row, tails out to 5.85
    x = -9.25 + 0.25 * (n - 1)
    c = box(x - 0.075, x + 0.075, 4.70, 5.85, 0, T).union(box(x - 0.075, x + 0.075, YR, YR + 0.12, 0, 1.0))
    c = c.union(box(x - 0.075, x + 0.075, 0.6, YS, ZS - 0.12, ZS))          # upper spring finger in the slot
    contacts = c if contacts is None else contacts.union(c)
for n in EVEN:     # front row, tails out to -2.85
    x = -9.0 + 0.25 * (n - 2)
    c = box(x - 0.075, x + 0.075, -2.85, YF, 0, T).union(box(x - 0.075, x + 0.075, YF - 0.12, YF, 0, 1.0))
    c = c.union(box(x - 0.075, x + 0.075, 0.6, YS, ZC, ZC + 0.12))          # lower spring finger in the slot
    contacts = contacts.union(c)

pegs = None
for sx in (-1, 1):
    x = sx * 10.35
    p = box(x - 0.5, x + 0.5, 3.45, 5.85, 0, 0.15).union(box(x - 0.5, x + 0.5, 4.0, 4.15, 0, 1.6))
    pegs = p if pegs is None else pegs.union(p)

a = cq.Assembly(name="1-2199230-6")
a.add(housing, name="housing", color=BLACK)
a.add(contacts, name="contacts", color=GOLD)
a.add(pegs, name="solder_pegs", color=STEEL)
a.export(OUT)
print("wrote", OUT)