Files
Jason StedwellandClaude Opus 5.5 5b52636003 MPM Documentation Kit v1.3 (CW-034)
MPM Document Standard 1.3, mpmdoc build engine, templates for TN, INS, SOP,
BOM, SVY, TAP, DWG, TSB, PRO, SOW and WO (Chinese editions for TN and DWG),
glossary, MPM fonts and logos, and the mpm-technical-documents plugin 1.3.0.
Worked examples ship in the kit zip on Drive only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NWatTMmqmGatgHjDZvWs5b
2026-11-09 11:51:56 -06:00

32 lines
1.5 KiB
Python

"""TEMPLATE figures for a TN. Keep the source numbers here; build.py imports them.
Each figure is a function returning an SVG string; register it in FIGS."""
from mpmdoc.figkit import T, svg_open, INK, KICK, MUTE, LINE, RED, GRY
# ---- source numbers (one place only) ----
MEASURED = 51.0
LIMIT = 63.8
def bars():
W, L, R, top, rowh = 700, 150, 640, 30, 30
rows = [("Measured", MEASURED, INK), ("Reference", 20.4, GRY)]
vmax = 70.0
x = lambda v: L + v * (R - L) / vmax
bot = top + rowh * len(rows)
o = [svg_open(W, bot + 30)]
for v in range(0, 71, 10):
o.append(f'<line x1="{x(v):.1f}" y1="{top-6}" x2="{x(v):.1f}" y2="{bot}" stroke="{LINE}" stroke-width="0.8"/>')
o.append(T(x(v), bot + 14, v, size=7.4, w=500, fill=MUTE, anchor="middle", fam="JetBrains Mono", ls=0))
o.append(f'<line x1="{x(LIMIT):.1f}" y1="{top-14}" x2="{x(LIMIT):.1f}" y2="{bot}" stroke="{RED}" stroke-width="1.4" stroke-dasharray="5 3"/>')
o.append(T(x(LIMIT), top - 18, f"LIMIT · {LIMIT:.1f} W", size=6.8, w=800, fill=RED, anchor="middle", ls=1.0))
for i, (name, v, c) in enumerate(rows):
cy = top + i * rowh + rowh / 2
o.append(T(L - 10, cy + 3, name, size=8.2, anchor="end"))
o.append(f'<rect x="{L}" y="{cy-8.5:.1f}" width="{x(v)-L:.1f}" height="17" rx="2" fill="{c}"/>')
o.append(T(x(v) + 6, cy + 3.2, f"{v:.1f} W", size=8.6, w=700, fam="JetBrains Mono", ls=0, halo=True))
o.append("</svg>")
return "".join(o)
FIGS = {"bars": bars}