component
SMP-MSCM-PCS12T
Public Made by Adomby adom
Amphenol RF RF Coaxial Connectors (SMP jack), SMP_MSCM_PCS12T. KiCad symbol, footprint and 3D as used on Adom boards.
main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
#!/usr/bin/env python3
"""Rewrite the SMP_MSCM_PCS12T footprint's pads from Amphenol RF's RECOMMENDED PCB LAYOUT (drawing
SMP-MSCM-PCS12T Rev A, sheet 2): ground land 6.5 square centred on the connector axis with a 4.24 dia clearance
centred on the axis and a 2.73 wide slot from the clearance to the land edge facing the centre pad; centre pad
0.63 wide, 2.03 long, starting 2.6 from the axis.
The board's own footprint (coax:SMP_MSCM_PCS12T on rf-molecules boards) carries pad 2 with a +90 deg pad rotation
relative to the footprint (absolute angle minus footprint angle on every placement); the page lost it. Pad 2 is
redrawn here as one polygon in the footprint frame (pad angle 0), anchor = the 6.5 x 1.13 bar above the clearance.
Everything outside the pads (properties, courtyard, model) is copied from the page's original footprint.
usage: mkfp.py <original.kicad_mod> <out.kicad_mod>"""
import sys, math, re, uuid
src, out = sys.argv[1], sys.argv[2]
t = open(src).read()
SQ, D_HOLE, SLOT, C_W, C_L, C_GAP = 6.5, 4.24, 2.73, 0.63, 2.03, 2.6
h, r, s = SQ / 2, D_HOLE / 2, SLOT / 2
ys = math.sqrt(r * r - s * s) # where the slot edges meet the clearance circle
a0 = math.degrees(math.atan2(ys, -s)) # (-s, ys): ~130 deg (KiCad y down: +y toward the centre pad)
a1 = math.degrees(math.atan2(ys, s)) + 360 # (s, ys): ~410 deg, going round through the top (-90 / 270 deg)
n = 120
arc = [(r * math.cos(math.radians(a0 + (a1 - a0) * k / n)), r * math.sin(math.radians(a0 + (a1 - a0) * k / n))) for k in range(n + 1)]
poly = [(s, h), (h, h), (h, -h), (-h, -h), (-h, h), (-s, h)] + arc # closes from (s, ys) back to (s, h)
ANCH_Y0, ANCH_Y1 = -h, -r # 6.5 x 1.13 bar above the clearance
ay = (ANCH_Y0 + ANCH_Y1) / 2
pts = ' '.join(f'(xy {x:.4f} {y - ay:.4f})' for x, y in poly)
pad2 = (f'\t(pad "2" smd custom\n\t\t(at 0 {ay:.4f})\n\t\t(size {SQ} {ANCH_Y1 - ANCH_Y0:.4f})\n'
f'\t\t(layers "F.Cu" "F.Mask" "F.Paste")\n\t\t(options (clearance outline) (anchor rect))\n'
f'\t\t(primitives\n\t\t\t(gr_poly\n\t\t\t\t(pts {pts})\n\t\t\t\t(width 0)\n\t\t\t\t(fill yes)\n\t\t\t)\n\t\t)\n'
f'\t\t(uuid "{uuid.uuid4()}")\n\t)\n')
cy = C_GAP + C_L / 2
pad1 = (f'\t(pad "1" smd roundrect\n\t\t(at 0 {cy:.4f})\n\t\t(size {C_W} {C_L})\n\t\t(layers "F.Cu" "F.Mask" "F.Paste")\n'
f'\t\t(roundrect_rratio 0.15)\n\t\t(uuid "{uuid.uuid4()}")\n\t)\n')
def blocks(text, head):
res = []
for m in re.finditer(r'\n\t\(' + head + r'\s', text):
i, d, j = m.start() + 1, 0, m.start() + 1
while j < len(text):
if text[j] == '(': d += 1
elif text[j] == ')':
d -= 1
if d == 0: res.append((i, j + 1)); break
j += 1
return res
for a, b in reversed(blocks(t, 'pad')):
t = t[:a] + t[b:].lstrip('\n')
t = re.sub(r'\n\t\(embedded_fonts', '\n' + pad1 + pad2 + '\t(embedded_fonts', t, count=1)
# F.Fab outline (6.0 square base, chamfers on the 8 circle) and silk corner marks clear of the copper
c = math.sqrt(16 - 9)
oct_pts = [(3, -c), (3, c), (c, 3), (-c, 3), (-3, c), (-3, -c), (-c, -3), (c, -3)]
fab = ('\t(fp_poly\n\t\t(pts ' + ' '.join(f'(xy {x:.3f} {y:.3f})' for x, y in oct_pts) + ')\n'
'\t\t(stroke (width 0.1) (type default))\n\t\t(fill no)\n\t\t(layer "F.Fab")\n'
f'\t\t(uuid "{uuid.uuid4()}")\n\t)\n')
fab += ('\t(fp_text user "${REFERENCE}"\n\t\t(at 0 -2.685 0)\n\t\t(unlocked yes)\n\t\t(layer "F.Fab")\n'
f'\t\t(uuid "{uuid.uuid4()}")\n\t\t(effects\n\t\t\t(font (size 0.6 0.6) (thickness 0.09))\n\t\t)\n\t)\n')
silk = ''
for (x0, y0, x1, y1) in [(-3.45, -3.45, -2.2, -3.45), (-3.45, -3.45, -3.45, -2.2), (3.45, -3.45, 2.2, -3.45), (3.45, -3.45, 3.45, -2.2),
(-3.45, 3.45, -1.0, 3.45), (-3.45, 3.45, -3.45, 2.2), (3.45, 3.45, 1.0, 3.45), (3.45, 3.45, 3.45, 2.2)]:
silk += (f'\t(fp_line\n\t\t(start {x0} {y0})\n\t\t(end {x1} {y1})\n\t\t(stroke (width 0.12) (type default))\n'
f'\t\t(layer "F.SilkS")\n\t\t(uuid "{uuid.uuid4()}")\n\t)\n')
t = t.replace('\t(fp_poly\n', fab + silk + '\t(fp_poly\n', 1)
t = t.replace('(descr ', '(descr ', 1)
open(out, 'w').write(t)
print('wrote', out, 'pad1 y', cy, 'pad2 anchor y', ay, 'slot meets circle at y', round(ys, 4))