Files
mpm-documentation-kit/_STANDARDS/templates/DWG/build_zh.py
T
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

63 lines
2.8 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""TEMPLATE — Drawing sheet, Simplified Chinese edition (图纸 · 中文版).
Copy next to the English build.py in <PROJECT>/source/. See MPM_Document_Standard.md §12.
Rules:
* Same number, slug, revision, sheets and views as build.py; figs.py is shared. Build English first:
the engine refuses to build the _ZH file without the English PDF at this revision.
* Dimensions mm first, imperial in [ ]: if figs.py formats dimensions through a function F, replace it
here before drawing the figures (figs functions read F at call time).
* Figure text goes through i18n.Translator (TERMS, then _STANDARDS/glossary_zh.md); tr.check() fails the
build on any English left. Tags (B-1), part numbers, standards and place names stay in Latin script.
* The frame (title block, schedule and notes headings, dates) is translated by the engine; the
"英文版为准" note is added to each sheet's notes unless you place it yourself.
"""
import sys, pathlib
HERE = pathlib.Path(__file__).resolve().parent
sys.path.insert(0, str(next(p / "_STANDARDS" for p in HERE.parents if (p / "_STANDARDS").is_dir())))
sys.path.insert(0, str(HERE))
from mpmdoc import Drawing, i18n
from figs import FIGS
TERMS = { # this document's figure phrases (single terms: glossary)
"WALL / POST": "墙体 / 立柱",
"SIGN (BY OTHERS)": "显示屏(他方供货)",
"M12 ANCHOR · SEE SCHEDULE": "M12 锚栓 · 见部件表",
}
tr = i18n.Translator(TERMS)
F = {k: tr.svg(f()) for k, f in FIGS.items()}
tr.check()
dwg = Drawing(
number="DWG-MPM-SUBJ-01", rev="0.1", date="2026-11-06", lang="zh",
title="墙板式显示屏支架",
subtitle="安装支架总图",
project="项目名称", client="Customer", location="城市, 州",
discipline="机械图纸 · 安装",
drawn="JS", checked="—", approved="—",
slug="Customer_Sign-Bracket_GA", # identical to the English slug
history=[("0.1", "2026-11-06", "首次发布,供审核。")],
)
dwg.sheet(
views=[
dwg.view(F["elevation"], 1, "立面 · 墙板", "1:4", area="1 / 1 / 5 / 3"),
dwg.view(F["section"], 2, "剖面 A · 侧视", "1:4", area="1 / 3 / 4 / 7"),
dwg.view(F["detail"], 3, "详图 B · 锚栓", "1:1", area="4 / 3 / 5 / 5"),
],
schedule=[
("B-1", "墙板", "6 mm 热镀锌钢板,200 × 300", 1),
("A-1", "悬臂", "60 × 60 × 4 方钢管,热镀锌,长 400", 1),
("F-1", "锚栓", "M12 膨胀锚栓,A4 不锈钢", 4),
],
notes=[
"除注明外尺寸单位为 mm。请勿从图纸量取尺寸。",
"所有钢件加工完成后热镀锌。",
"钻孔前确认墙体 / 立柱结构。",
"显示屏及其吊挂件由他方供货。",
],
scale="As shown",
)
dwg.build()