Skip to content
Edit this page

ictdesigntools.parts.plugs

Detailed connector plugs: a side view and a mating-face view of each plug in data/plugs.toml, as engine components, for drawings where the detail earns its place (assembly drawings, spec sheets, close-ups). Panels and elevations keep the light footprints of cabling.connectors.

The face view shows what the plug carries: its ferrule or ferrules, an MT ferrule's fiber positions numbered from 1 (on the left with the key up, looking at the face, as TIA-568 counts them), its guide pins (pinned) or holes (unpinned), and an RJ45's eight contacts. Ferrule and contact sizes and pitches are from the cited sources; the plug bodies are proportions for drawing (each row lists them under schematic).

Housings take the TIA-568 connector colours by tone: smf-upc blue, smf-apc green, mmf (OM1, OM2) beige, mmf-om3 and mmf-om4 aqua, mmf-om5 lime, copper clear grey; tone_for picks one from a NetBox cable type and a polish.

>>> plug("mpo").ferrule_w_mm, plug("mpo").fiber_pitch_mm
(6.4, 0.25)
>>> fiber_positions(8)  # an MPO-8 uses the outer four of each side of twelve
[1, 2, 3, 4, 9, 10, 11, 12]

plugs cached

plugs() -> dict[str, Plug]

The plugs in data/plugs.toml, by slug.

Source code in src/ictdesigntools/parts/plugs.py
@cache
def plugs() -> dict[str, Plug]:
    """The plugs in ``data/plugs.toml``, by slug."""
    out = {}
    for r in rows("plugs", "plug"):
        r = dict(r)
        r["schematic"] = tuple(r.get("schematic", ()))
        out[r["slug"]] = Plug(**r)
    return out

tone_for

tone_for(cable_type: str, polish: str = '') -> str

The TIA-568 housing colour key for a NetBox cable type and a polish.

Source code in src/ictdesigntools/parts/plugs.py
def tone_for(cable_type: str, polish: str = "") -> str:
    """The TIA-568 housing colour key for a NetBox cable type and a polish."""
    if cable_type.startswith("smf"):
        return "smf-apc" if polish == "apc" else "smf-upc"
    if cable_type in ("mmf-om3", "mmf-om4", "mmf-om5"):
        return cable_type
    if cable_type.startswith("mmf"):
        return "mmf"
    return "copper"

fiber_positions

fiber_positions(positions: int) -> list[int]

Which of an MT ferrule's places carry fibers: all of them, except an MPO-8, which uses the outer four of each side of a twelve-fiber row (IEEE 802.3 parallel optics).

Source code in src/ictdesigntools/parts/plugs.py
def fiber_positions(positions: int) -> list[int]:
    """Which of an MT ferrule's places carry fibers: all of them, except an MPO-8, which uses
    the outer four of each side of a twelve-fiber row (IEEE 802.3 parallel optics)."""
    return [1, 2, 3, 4, 9, 10, 11, 12] if positions == 8 else list(range(1, positions + 1))

plug_side cached

plug_side(slug: str, tone: str = '') -> Component

A plug from the side, mating face at x = 0 pointing left (-x), the boot to the right, ending at x = body_mm + boot_mm where the drawing's cable joins it; its centre line on y = 0. The cable is not part of the plug, so it can be drawn to any length or curve.

Source code in src/ictdesigntools/parts/plugs.py
@cache
def plug_side(slug: str, tone: str = "") -> Component:
    """A plug from the side, mating face at x = 0 pointing left (-x), the boot to the right,
    ending at x = body_mm + boot_mm where the drawing's cable joins it; its centre line on
    y = 0. The cable is not part of the plug, so it can be drawn to any length or curve."""
    p = plug(slug)
    h, body, boot = p.housing_h_mm, p.body_mm, p.boot_mm
    items: list = []
    # What stands out of the mating face.
    if p.ferrule == "round":
        d = p.ferrule_mm
        n = p.ferrules
        offsets = [(k - (n - 1) / 2) * p.ferrule_pitch_mm for k in range(n)]
        for y in offsets:
            items.append(Rect(-2.2, y - d / 2, 3.2, d, rx=d * 0.2, style="ferrule"))
    elif p.ferrule == "mt":
        items.append(Rect(-1.0, -p.ferrule_h_mm / 2, 2.0, p.ferrule_h_mm, style="ferrule"))
    elif p.ferrule == "pin":
        items.append(Rect(-3.0, -p.ferrule_mm / 2, 3.2, p.ferrule_mm, style="pin"))
    housing = f"housing-{tone or 'plain'}"
    items.append(Rect(0, -h / 2, body, h, rx=min(0.6, h * 0.1), style=housing))
    if p.latch == "latch":  # LC, SN: a lever over the top, free at the back
        # A moulded arm, about a millimetre thick, rising from the front of the housing to a
        # free end over the back; the catches stand on it part way, the thumb pad at the end.
        top, t = -h / 2, 1.0
        rise = min(1.9, h * 0.42)
        x0, x1 = body * 0.06, body * 0.88
        items.append(Polygon(((x0, top), (x0 + 1.2, top - t), (x1, top - rise - t),
                              (x1 + body * 0.08, top - rise - t), (x1 + body * 0.08, top - rise),
                              (x0 + 2.4, top)), style=housing))  # fmt: skip
        cx = x0 + (x1 - x0) * 0.32  # the catches that hold the plug in the adapter
        cy = top - t - rise * (cx - x0 - 1.2) / (x1 - x0 - 1.2)
        items.append(Polygon(((cx, cy + 0.1), (cx + 0.5, cy - 0.55), (cx + 1.3, cy - 0.55),
                              (cx + 1.5, cy + 0.1)), style=housing))  # fmt: skip
    elif p.latch == "tab":  # RJ45: the tab under the plug
        items.append(Polyline(((body * 0.12, h / 2), (body * 0.75, h / 2 + h * 0.3)),
                              style="latch"))  # fmt: skip
    elif p.latch == "key":  # MPO, MMC: the key on top of the inner housing
        items.append(Rect(body * 0.08, -h / 2 - 0.7, body * 0.35, 0.7, style="key"))
        # The pull-back coupling sleeve's grip: ridges across the rear of the housing.
        x0, x1 = body * 0.52, body * 0.92
        n = max(4, round((x1 - x0) / 1.1))
        for k in range(n):
            x = x0 + (x1 - x0) * k / (n - 1)
            items.append(Rect(x - 0.2, -h / 2 + 0.35, 0.4, h - 0.7, rx=0.15,
                              style=f"recess-{tone or 'plain'}"))  # fmt: skip
    elif p.latch == "grip":  # SC: the outer grip's ribs
        for k in range(4):
            x = body * (0.45 + 0.1 * k)
            items.append(Polyline(((x, -h / 2), (x, h / 2)), style="thread"))
    elif p.latch == "thread":  # F: the hex nut and its thread
        t = p.thread_mm
        for k in range(6):
            x = 0.6 + k * 0.9
            items.append(Polyline(((x, -t / 2), (x + 0.45, t / 2)), style="thread"))
    # The boot tapers from the body to the cord.
    c = p.cable_mm
    items.append(Polygon(((body, -h * 0.36), (body + boot, -c * 0.62),
                          (body + boot, c * 0.62), (body, h * 0.36)), style="boot"))  # fmt: skip
    for k in range(1, 6):  # the boot's flexible rear part is ribbed
        x = body + boot * (0.4 + 0.11 * k)
        half = h * 0.36 + (c * 0.62 - h * 0.36) * (x - body) / boot
        items.append(Polyline(((x, -half), (x, half)), style="boot-rib"))
    return Component(f"plug-side-{slug}-{tone or 'plain'}", tuple(items), title=f"{p.name} plug")

plug_face cached

plug_face(
    slug: str,
    positions: int = 0,
    pins: str = "",
    tone: str = "",
    numbers: bool = True,
) -> Component

A plug's mating face, centred, as a person sees it looking into the plug with the key up: the housing in its colour with the opening shaded, white zirconia ferrules with the fiber's cladding and core, an MT ferrule's dark face with its fibers as light points (unused places as faint rings, 1 and the last numbered), steel guide pins or dark guide holes, the key on top, an RJ45's gold contacts in their slots with the tab underneath, or an F connector's hex nut, dielectric and centre conductor.

Source code in src/ictdesigntools/parts/plugs.py
@cache
def plug_face(slug: str, positions: int = 0, pins: str = "", tone: str = "",
              numbers: bool = True) -> Component:  # fmt: skip
    """A plug's mating face, centred, as a person sees it looking into the plug with the key
    up: the housing in its colour with the opening shaded, white zirconia ferrules with the
    fiber's cladding and core, an MT ferrule's dark face with its fibers as light points
    (unused places as faint rings, 1 and the last numbered), steel guide pins or dark guide
    holes, the key on top, an RJ45's gold contacts in their slots with the tab underneath, or
    an F connector's hex nut, dielectric and centre conductor."""
    p = plug(slug)
    w, h = p.housing_w_mm, p.housing_h_mm
    housing, recess = f"housing-{tone or 'plain'}", f"recess-{tone or 'plain'}"
    items: list = []
    small = 0.45
    if p.ferrule == "round":
        d = p.ferrule_mm
        items.append(Rect(-w / 2, -h / 2, w, h, rx=min(0.9, w * 0.14), style=housing))
        if p.latch == "grip":  # SC: the inner housing inside the outer grip, keyed on top
            iw, ih = w - 2.2, h - 1.8
            items.append(Rect(-iw / 2, -ih / 2, iw, ih, rx=0.4, style=recess))
            items.append(Rect(-iw / 2 + 0.5, -ih / 2 + 0.5, iw - 1.0, ih - 1.0, rx=0.3,
                              style=housing))  # fmt: skip
            items.append(Rect(-1.0, -h / 2 - 0.5, 2.0, 0.5, style=housing))
        else:  # LC, SN: the latch arm seen end on, above the housing
            lw = min(w * 0.55, 2.2)
            items.append(Rect(-lw / 2, -h / 2 - 1.1, lw, 1.1, rx=0.2, style=housing))
        for k in range(p.ferrules):
            y = (k - (p.ferrules - 1) / 2) * p.ferrule_pitch_mm
            items.append(Circle(0, y, d * 0.72, style=recess))  # the bore round the ferrule
            items.append(Circle(0, y, d / 2, style="ferrule"))
            items.append(Circle(0, y, d / 2 * 0.82, style="ferrule-face"))  # past the chamfer
            items.append(Circle(0, y, 0.0625, style="cladding"))  # 125 µm
            items.append(Circle(0, y, 0.02, style="core"))
    elif p.ferrule == "mt":
        fw, fh = p.ferrule_w_mm, p.ferrule_h_mm
        items.append(Rect(-w / 2, -h / 2, w, h, rx=min(0.8, h * 0.12), style=housing))
        ow, oh = min(fw + 2.4, w - 1.2), min(fh + 1.6, h - 1.0)
        items.append(Rect(-ow / 2, -oh / 2, ow, oh, rx=0.3, style=recess))
        items.append(Rect(-fw / 2, -fh / 2, fw, fh, rx=0.15, style="mt"))
        n = positions or 12
        cols, nrows = _row_layout(n)
        used = set(fiber_positions(n))
        r = min(p.fiber_pitch_mm * 0.38, 0.0625)
        place = 0
        for row in range(nrows):
            y = (row - (nrows - 1) / 2) * p.row_pitch_mm
            for col in range(cols):
                place += 1
                x = (col - (cols - 1) / 2) * p.fiber_pitch_mm
                items.append(Circle(x, y, r, style="fiber" if place in used else "fiber-dark"))
        for x in (-p.guide_pitch_mm / 2, p.guide_pitch_mm / 2):
            if pins == "pinned":
                items.append(Circle(x, 0, p.pin_mm / 2, style="pin"))
                items.append(Circle(x - p.pin_mm * 0.12, -p.pin_mm * 0.12, p.pin_mm * 0.16,
                                    style="pin-shine"))  # fmt: skip
            else:
                items.append(Circle(x, 0, p.pin_mm / 2, style="hole"))
        items.append(Rect(-1.4, -h / 2 - 0.7, 2.8, 0.7, rx=0.15, style=housing))  # key up
        if numbers:
            ty = -fh / 2 - 0.2
            x1 = -(cols - 1) / 2 * p.fiber_pitch_mm
            items.append(Text(x1, ty, "1", small, style="part-label-light"))
            items.append(Text(-x1, ty, str(cols), small, style="part-label-light"))
    elif p.ferrule == "contacts":
        # The clear plug: slots across the top, each holding a gold blade, the tab below.
        items.append(Rect(-w / 2, -h / 2, w, h, rx=0.6, style="clear"))
        pitch = p.contact_pitch_mm
        sw, cw = pitch * 0.8, pitch * 0.32
        for k in range(p.contacts):
            x = (k - (p.contacts - 1) / 2) * pitch
            items.append(Rect(x - sw / 2, -h / 2 + 0.25, sw, h * 0.36, rx=0.1, style="slot"))
            items.append(Rect(x - cw / 2, -h / 2 + 0.35, cw, h * 0.3, style="contact"))
        items.append(Rect(-w / 2 + 0.6, h * 0.05, w - 1.2, h * 0.3, rx=0.4, style="slot"))
        items.append(Rect(-w * 0.22, h / 2, w * 0.44, 1.0, rx=0.2, style="clear"))  # the tab
        if numbers:
            x1 = -(p.contacts - 1) / 2 * pitch
            items.append(Text(x1, -h / 2 + 0.6 + h * 0.36 + small, "1", small,
                              style="part-label"))  # fmt: skip
    elif p.ferrule == "pin":
        # F: the hex nut (flats top and bottom), its thread, the dielectric and the centre pin.
        a = w / 3**0.5  # side of the hexagon, from the width across flats
        hexagon = tuple(
            (a * c, a * s)
            for c, s in (
                (1, 0),
                (0.5, 0.866),
                (-0.5, 0.866),
                (-1, 0),
                (-0.5, -0.866),
                (0.5, -0.866),
            )
        )
        items.append(Polygon(hexagon, style="nut"))
        items.append(Circle(0, 0, p.thread_mm / 2, style="thread-ring"))
        items.append(Circle(0, 0, p.thread_mm / 2 * 0.72, style="dielectric"))
        items.append(Circle(0, 0, p.ferrule_mm / 2, style="conductor"))
    name = f"plug-face-{slug}-{positions}-{pins or 'none'}-{tone or 'plain'}-{int(numbers)}"
    return Component(name, tuple(items), title=f"{p.name} plug face")

catalogue

catalogue() -> object

Every plug from the side and from its face, with its tone, for review.

Source code in src/ictdesigntools/parts/plugs.py
def catalogue() -> object:
    """Every plug from the side and from its face, with its tone, for review."""
    from ..draw import Drawing, Use, scale, translate

    rows_ = list(plugs().values())
    pitch = 36.0
    d = Drawing(view=(-8, -14, 220, pitch * len(rows_) + 4), units="mm", stroke=0.2, font=3,
                title="Detailed plugs", styles=dict(PART_STYLES),
                desc="Side views at 1:1 and faces enlarged as marked. Plug bodies are "
                "schematic; ferrules, pitches and contacts follow the cited sources.")  # fmt: skip
    for k, p in enumerate(rows_):
        y = k * pitch + 8
        copper = p.ferrule in ("contacts", "pin")
        mag = min(3.0, (pitch - 8) / max(p.housing_w_mm, p.housing_h_mm + 1.6))
        multi = 12 if p.ferrule == "mt" else 0
        d.add(Text(-6, y - 12, f"{p.name} ({p.slug})", 3, anchor="start", style="part-label"))
        d.add(Use(plug_side(p.slug, "copper" if copper else "smf-upc"), translate(8, y)))
        tone = "copper" if copper else "smf-upc"
        d.add(Use(plug_face(p.slug, multi, "unpinned", tone), translate(120, y) @ scale(mag)))
        d.add(Text(120, y + pitch / 2 - 1, f"face ×{mag:.3g}", 2.4, style="part-label"))
        if p.ferrule == "mt":
            d.add(Use(plug_face(p.slug, 8, "pinned", "smf-apc", False),
                      translate(180, y) @ scale(mag)))  # fmt: skip
            d.add(Text(180, y + pitch / 2 - 1, "8 fibers, pinned, APC", 2.4,
                       style="part-label"))  # fmt: skip
    return d