main
John Lauer Component page: symbol, footprint, Fusion library, viewers, provenance, models cf95da0 3d ago
"""AI-created STEP model of the Texas Instruments LMQ61460AFSQRJRRQ1 (VQFN-HR-14, RJR0014A).

Dimensions from TI datasheet SNVSBP4D, RJR0014A package outline (p.56): body 4.0 x 3.5, height 0.90 nominal,
terminal outlines vector-extracted from the bottom view and mirrored to the top view; wettable-flank terminals flush
with the body edges; 0.4 mm pin-1 index dot (cosmetic).

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


# ---------------------------------------------------------------- LMQ61460 (RJR0014A)
def lmq():
    H = 0.90   # A = 0.8..1.0 (nominal 0.9), SNVSBP4D p.56
    T = 0.20   # terminal thickness, (0.2) TYP p.56 side view
    # Package terminals, top-view KiCad coords from the RJR0014A outline (p.56, bottom view mirrored in Y)
    rects = {
        "2": (-2.0, -1.5, -0.65, -0.40), "3": (-2.0, -1.5, -0.15, 0.15), "4": (-2.0, -1.5, 0.40, 0.65),
        "6": (-1.25, -1.0, 1.25, 1.75), "7": (-0.75, -0.5, 1.25, 1.75), "8": (0.25, 0.65, 0.95, 1.75),
        "10": (-0.20, 2.0, -0.20, 0.20), "12": (0.25, 0.65, -1.75, -0.95),
        "13": (-0.75, -0.5, -1.75, -1.25), "14": (-1.25, -1.0, -1.75, -1.25),
    }
    # Corner L terminals: bounding rect minus the outer notch
    ls = {
        "1": ((-2.0, -1.5, -1.75, -0.95), (-2.0, -1.85, -1.75, -1.35)),
        "5": ((-2.0, -1.5, 0.95, 1.75), (-2.0, -1.85, 1.35, 1.75)),
        "9": ((1.4, 2.0, 0.95, 1.75), (1.8, 2.0, 1.35, 1.75)),
        "11": ((1.4, 2.0, -1.75, -0.95), (1.8, 2.0, -1.75, -1.35)),
    }
    terms = []
    for n, (x0, x1, y0, y1) in rects.items():
        terms.append(kbox(x0, x1, y0, y1, 0, T))
    for n, (r, notch) in ls.items():
        terms.append(kbox(*r, 0, T).cut(kbox(*notch, 0, T)))
    metal = terms[0]
    for t in terms[1:]:
        metal = metal.union(t)
    body = box(-2.0, 2.0, -1.75, 1.75, 0, H).cut(metal)
    # Pin-1 index mark: shallow 0.4 mm dot in the top-left quadrant (pin 1 index area, p.56)
    body = body.cut(cq.Workplane("XY").center(-1.45, 1.20).circle(0.2).extrude(0.03).translate((0, 0, H - 0.03)))
    a = cq.Assembly(name="LMQ61460AFSQRJRRQ1")
    a.add(body, name="body", color=BLACK)
    a.add(metal, name="terminals", color=TIN)
    return a



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