main
John Lauer Component page: symbol, footprint, Fusion library, viewers, provenance, models c08725d 3d ago
"""AI-created STEP model of the Hirose U.FL-R-SMT-1(80) coaxial receptacle (simplified).

Dimensions from Hirose drawing EDC3-302540-86 and the U.FL series catalog p.12: housing 2.6 x 2.6 x 0.35,
mating shell dia 2.0 to 1.25 high, outer-contact tabs 3.0 overall, centre-contact tab 0.6 wide.
No Hirose CAD geometry is used (the Hirose 3D model licence forbids redistribution and modification).

Frame: millimetres, Z-up, seating plane / PCB top z = 0, X/Y = the KiCad footprint frame with Y mirrored
(KiCad footprints are Y-down, KiCad 3D models Y-up), so the footprint's (model) block needs no offset or rotation.
usage: python make_ufl_step.py out.step   (CadQuery 2.8)
"""
import sys
import cadquery as cq

OUT = sys.argv[1]

BLACK = cq.Color(0.10, 0.10, 0.10)
TIN = cq.Color(0.80, 0.80, 0.82)
SILVER = cq.Color(0.85, 0.86, 0.88)
GOLD = cq.Color(0.86, 0.70, 0.25)
LCP = cq.Color(0.90, 0.85, 0.72)
PTFE = cq.Color(0.96, 0.96, 0.94)
GREY = cq.Color(0.35, 0.35, 0.35)


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))


def kbox(x0, x1, ky0, ky1, z0, z1):
    """Box given in KiCad footprint coordinates (Y down) -> model (Y up)."""
    return box(x0, x1, -ky1, -ky0, z0, z1)


def cyl_y(d, y0, y1, z, x=0.0):
    """Cylinder along +Y from y0 to y1, axis at (x, z)."""
    return (cq.Workplane("XZ").center(x, z).circle(d / 2).extrude(-(y1 - y0)).translate((0, y0, 0)))


# ---------------------------------------------------------------- Hirose U.FL-R-SMT-1(80)
def ufl():
    # Origin = mating axis = centre of the GND pad pair.
    base = (cq.Workplane("XY").rect(2.6, 2.6).extrude(0.35).edges("|Z").fillet(0.3))      # LCP housing 2.6 sq, 0.35
    shell = (cq.Workplane("XY").circle(1.0).extrude(1.25 - 0.35).translate((0, 0, 0.35)))  # outer contact dia 2, H 1.25
    groove = (cq.Workplane("XY").circle(1.0).circle(0.88).extrude(0.15).translate((0, 0, 0.75)))
    bore = cq.Workplane("XY").circle(0.80).extrude(0.75).translate((0, 0, 0.55))
    shell = shell.cut(groove).cut(bore)
    ins = cq.Workplane("XY").circle(0.80).extrude(0.25).translate((0, 0, 0.35))            # insulator floor in bore
    pin = cq.Workplane("XY").circle(0.22).extrude(0.65).translate((0, 0, 0.35))            # centre contact
    # Outer-contact solder tabs: 3.0 overall width, 1.8 long (p.12 bottom view)
    gnd = kbox(1.3, 1.5, -0.9, 0.9, 0, 0.15).union(kbox(-1.5, -1.3, -0.9, 0.9, 0, 0.15))
    rear = kbox(-0.3, 0.3, -1.55, -1.3, 0, 0.10)                                            # shell tab, not soldered
    sig = kbox(-0.3, 0.3, 1.3, 1.55, 0, 0.10).union(kbox(-0.15, 0.15, 0.0, 1.3, 0, 0.08))  # 0.6 wide, (3.1) overall
    a = cq.Assembly(name="U.FL-R-SMT-1(80)")
    a.add(base, name="housing", color=LCP)
    a.add(shell.union(gnd).union(rear), name="outer_contact", color=SILVER)
    a.add(ins, name="insulator", color=LCP)
    a.add(pin.union(sig), name="centre_contact", color=GOLD)
    return a



ufl().export(OUT)
print("wrote", OUT)