main
Caleb Publish 0.1.1 6d0dee9 1d ago
#!/usr/bin/env python3
"""Adom-built 3D model of Amphenol RF 925-126J-51P (SMPM jack, full detent, edge mount), CC-BY-SA-4.0.

Source: Amphenol RF customer outline drawing 925-126J-51P Rev A (03-Jun-16, ECO 00941), sheet 2 of 2,
https://www.amphenolrf.com/en-us/assets/file/4065789372/ . Amphenol's own STEP is behind a login, so this model
is built from the drawing. Built directly in the footprint frame (identity binding): Z-up, z = 0 = PCB top surface
(the mounting plane the side tabs and the centre contact sit on), x = 0 = board edge = the connector's mating face,
the connector runs into the board along +x, y = 0 on the connector axis.

Printed dimensions used as printed (all REF on the drawing):
  7.95 overall (mating face to the end of the side tabs), 5.03 body (front part), 2.92 tabs behind the body,
  4.47 width, 3.51 height, 2.11 from the mounting plane to the body top, 2.77 top / bottom flats,
  3.4 width of the part below the board (sits in the 3.6 board slot), 0.36 mounting plane to the axis,
  0.58 tab thickness, contact diameter 0.71 +-0.03.
Measured off the drawing (front view 199.5 px/mm, top / side views 127.6 px/mm at 400 dpi render, every printed
dimension checked to measure true within 0.02 mm):
  body above the board = circle r 2.235 about the axis (passes through the 2.77 top-flat corners and the 4.47
  sides), bottom corner chamfers 0.32 x 45 deg, tab inner edge 1.32 from the axis, contact end 8.11 from the
  mating face (0.16 past the tabs), mating-face circles 2.44 / 2.10 / 0.71.
Not dimensioned anywhere on the drawing (display assumptions, kept small and stated in provenance):
  bore depth 1.00 behind the mating face with a 0.17 x 45 deg entrance chamfer (the 2.44 / 2.10 circle pair),
  contact pin tip 0.50 behind the mating face, PTFE insulator filling the bore from 1.00 to the body rear.
usage: build_925-126j-51p.py <out.step>
"""
import sys, math
import cadquery as cq

OUT = sys.argv[1]
AX_Z = 0.36            # axis height above the mounting plane (0.36 REF)
R_BODY = 4.47 / 2      # 2.235
Z_TOP = 2.11           # 2.11 REF
Z_BOT = Z_TOP - 3.51   # -1.40
L_BODY = 5.03
L_TAB = 7.95
L_CONTACT = 8.11
W_LOWER = 3.40
CH = 0.32
TAB_T = 0.58
TAB_IN = 1.32
D_CONTACT = 0.71
D_BORE, D_CHAMF = 2.10, 2.44
BORE_DEPTH = 1.00
PIN_TIP = 0.50

# Body cross-section in the YZ plane (workplane "YZ": local x = Y, local y = Z), extruded along +X.
yz = cq.Workplane('YZ')
upper = (yz.center(0, AX_Z).circle(R_BODY).extrude(L_BODY)
         .intersect(cq.Workplane('XY').box(L_BODY, 2 * R_BODY + 1, Z_TOP, centered=(False, True, False))))
tabzone = cq.Workplane('XY').box(L_BODY, 2 * R_BODY, TAB_T, centered=(False, True, False))
lower_pts = [(-W_LOWER / 2, 0), (W_LOWER / 2, 0), (W_LOWER / 2, Z_BOT + CH), (W_LOWER / 2 - CH, Z_BOT),
             (-W_LOWER / 2 + CH, Z_BOT), (-W_LOWER / 2, Z_BOT + CH)]
lower = cq.Workplane('YZ').polyline(lower_pts).close().extrude(L_BODY)
body = upper.union(tabzone).union(lower)
# side tabs behind the body
for s in (1, -1):
    w = R_BODY - TAB_IN
    tab = cq.Workplane('XY').box(L_TAB - L_BODY, w, TAB_T, centered=False).translate((L_BODY, TAB_IN if s > 0 else -R_BODY, 0))
    body = body.union(tab)
# bore along the axis, through the body, with an entrance chamfer at the mating face
bore = cq.Workplane('YZ').center(0, AX_Z).circle(D_BORE / 2).extrude(L_BODY)
cham = cq.Solid.makeCone(D_CHAMF / 2, D_BORE / 2, (D_CHAMF - D_BORE) / 2, cq.Vector(0, 0, AX_Z), cq.Vector(1, 0, 0))
body = body.cut(bore).cut(cq.Workplane().add(cham))

insul = (cq.Workplane('YZ').workplane(offset=BORE_DEPTH).center(0, AX_Z).circle(D_BORE / 2)
         .circle(D_CONTACT / 2).extrude(L_BODY - BORE_DEPTH))
contact = cq.Workplane('YZ').workplane(offset=PIN_TIP).center(0, AX_Z).circle(D_CONTACT / 2).extrude(L_CONTACT - PIN_TIP)

gold = cq.Color(0.83, 0.69, 0.22)
ptfe = cq.Color(0.94, 0.94, 0.92)
asm = cq.Assembly(name='925-126J-51P')
asm.add(body, name='body', color=gold)
asm.add(insul, name='insulator', color=ptfe)
asm.add(contact, name='contact', color=gold)
asm.save(OUT, 'STEP')
hdr = ('/* 925-126J-51P 3D model (Amphenol RF SMPM jack, edge mount), Adom-built from Amphenol RF customer outline\n'
       ' * drawing 925-126J-51P Rev A. Copyright (C) 2026 Adom, Inc. Licensed CC-BY-SA-4.0\n'
       ' * (https://creativecommons.org/licenses/by-sa/4.0/). Builder: provenance/tools/build_925-126j-51p.py */\n')
s = open(OUT).read().replace('HEADER;\n', 'HEADER;\n' + hdr, 1)
open(OUT, 'w').write(s)
bb = cq.Compound.makeCompound([body.val(), insul.val(), contact.val()]).BoundingBox()
print(f'{OUT}: x {bb.xmin:.3f}..{bb.xmax:.3f}  y {bb.ymin:.3f}..{bb.ymax:.3f}  z {bb.zmin:.3f}..{bb.zmax:.3f}')