"""TEMPLATE figures for a DWG sheet: a generic wall-plate sign bracket in three views.
Drafting conventions: ink linework, centrelines in Dark Gold (long-dash-dot), hidden lines dashed,
dimensions in mm (JetBrains Mono), schedule tags as gold bubbles. One mm = SCALE px."""
from mpmdoc.figkit import T, svg_open, dim_h, dim_v, tag, INK, KICK, MUTE, CREAM
S = 0.9 # px per mm in these views
PLATE_W, PLATE_H, T_PL = 200, 300, 10
HOLE_X, HOLE_Y, HOLE_D = 150, 250, 14
ARM_L, ARM_H = 400, 60
def _cl(x1, y1, x2, y2):
return f''
def elevation():
"""Front view of the wall plate with the four anchor holes."""
W, H = 360, 420
ox, oy = 80, 50
pw, ph = PLATE_W * S, PLATE_H * S
o = [svg_open(W, H, grid=True)]
o.append(f'')
cx, cy = ox + pw / 2, oy + ph / 2
for dx in (-HOLE_X / 2, HOLE_X / 2):
for dy in (-HOLE_Y / 2, HOLE_Y / 2):
o.append(f'')
o.append(_cl(cx, oy - 14, cx, oy + ph + 14) + _cl(ox - 14, cy, ox + pw + 14, cy))
o.append(f'')
o.append(dim_h(ox, ox + pw, oy + ph + 34, f"{PLATE_W}", ext_from=oy + ph))
o.append(dim_h(cx - HOLE_X / 2 * S, cx + HOLE_X / 2 * S, oy - 22, f"{HOLE_X}", ext_from=oy + (PLATE_H - HOLE_Y) / 2 * S))
o.append(dim_v(ox - 30, oy, oy + ph, f"{PLATE_H}", ext_from=ox))
o.append(dim_v(ox + pw + 30, cy - HOLE_Y / 2 * S, cy + HOLE_Y / 2 * S, f"{HOLE_Y}", ext_from=cx + HOLE_X / 2 * S))
o.append(tag(ox + pw + 52, oy + 18, "B-1"))
o.append(T(ox + pw - 4, oy + ph - 8, f"4× Ø{HOLE_D} THRU", size=7.5, w=700, anchor="end", ls=.6))
o.append("")
return "".join(o)
def section():
"""Side section: plate, arm and sign hanging point."""
W, H = 640, 420
ox, oy = 70, 50
ph = PLATE_H * S
o = [svg_open(W, H, grid=True)]
o.append(f'')
o.append(T(ox - 26, oy - 36, "WALL / POST", size=7, w=700, fill=MUTE, ls=1))
o.append(f'')
ay = oy + ph / 2 - ARM_H / 2 * S
o.append(f'')
ex = ox + T_PL * S + ARM_L * S
o.append(f'')
o.append(f'')
o.append(T(ex - 30, ay + ARM_H * S + 100, "SIGN (BY OTHERS)", size=7.5, w=700, fill="#fff", anchor="middle", ls=1))
o.append(_cl(ox - 30, oy + ph / 2, ex + 30, oy + ph / 2))
o.append(dim_h(ox, ex, oy - 16, f"{T_PL + ARM_L}", ext_from=ay))
o.append(dim_v(ex + 26, ay, ay + ARM_H * S, f"{ARM_H}", ext_from=ex))
o.append(tag(ox + 40, ay - 16, "A-1") + tag(ox + 4, oy + ph + 16, "B-1"))
o.append("")
return "".join(o)
def detail():
"""Detail: anchor at the plate, enlarged."""
W, H = 300, 220
o = [svg_open(W, H, grid=True)]
o.append(f'')
o.append(f'')
o.append(f'')
o.append(f'')
o.append(f'')
o.append(_cl(10, 110, 190, 110))
o.append(tag(150, 70, "F-1") + f'')
o.append(T(150, 200, "M12 ANCHOR · SEE SCHEDULE", size=7, w=700, anchor="middle", fill=MUTE, ls=.8))
o.append("")
return "".join(o)
FIGS = {"elevation": elevation, "section": section, "detail": detail}