chore(rebar): Pier_T_rebar 작업 폴더 초기 구성 및 외부 의존 파일 통합
- Code\rebar_pipeline, review_pipeline, pier-program을 정션에서 실제 폴더로 전환 - Code\rhino_mcp 및 CLAUDE_rhino배경.md 추가, .mcp.json은 PYTHONPATH로 새 위치 사용 - pier-program 내부 .git 제거(이력은 backup\pier-program_20261028.bundle에 보관) - worktree 가이드 반영(CLAUDE.local.md, HANDOFF.md) - D:\Rhino-MCP 경로 참조를 새 위치로 치환 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
964a841de1
3978 files changed
+58013356
No files matched your search
@@ -0,0 +1,89 @@
|
||||
"""Stage 2: survey converted DXF drawings (full population, read only).
|
||||
|
||||
Outputs per drawing into 판독/:
|
||||
<n>_overview.png rendered modelspace (visual reading aid, not geometry evidence)
|
||||
<n>_survey.json layer counts, all TEXT/MTEXT with position, all DIMENSION
|
||||
entities with measurement, override text and defpoints
|
||||
"""
|
||||
import json
|
||||
import sys
|
||||
from collections import Counter
|
||||
from pathlib import Path
|
||||
|
||||
import ezdxf
|
||||
import matplotlib
|
||||
|
||||
matplotlib.use("Agg")
|
||||
import matplotlib.pyplot as plt
|
||||
from ezdxf.addons.drawing import Frontend, RenderContext
|
||||
from ezdxf.addons.drawing.matplotlib import MatplotlibBackend
|
||||
|
||||
HERE = Path(__file__).resolve().parent
|
||||
IN_DIR = HERE / "입력DXF"
|
||||
OUT_DIR = HERE / "판독"
|
||||
|
||||
|
||||
def text_of(e):
|
||||
if e.dxftype() == "MTEXT":
|
||||
return e.plain_text()
|
||||
return e.dxf.text
|
||||
|
||||
|
||||
def survey(path, index):
|
||||
doc = ezdxf.readfile(path)
|
||||
msp = doc.modelspace()
|
||||
texts, dims = [], []
|
||||
for e in msp.query("TEXT MTEXT"):
|
||||
p = e.dxf.insert
|
||||
texts.append(dict(h=e.dxf.handle, layer=e.dxf.layer, x=round(p.x, 1), y=round(p.y, 1),
|
||||
height=round((e.dxf.char_height if e.dxftype() == "MTEXT"
|
||||
else e.dxf.height) or 0, 2),
|
||||
text=text_of(e).strip()))
|
||||
# Texts inside block inserts (title blocks, labels) are flattened via virtual entities.
|
||||
for ins in msp.query("INSERT"):
|
||||
try:
|
||||
for v in ins.virtual_entities():
|
||||
if v.dxftype() in ("TEXT", "MTEXT"):
|
||||
p = v.dxf.insert
|
||||
texts.append(dict(h=ins.dxf.handle, layer=v.dxf.layer, x=round(p.x, 1),
|
||||
y=round(p.y, 1), height=0, block=ins.dxf.name,
|
||||
text=text_of(v).strip()))
|
||||
except Exception:
|
||||
pass
|
||||
for d in msp.query("DIMENSION"):
|
||||
try:
|
||||
m = d.get_measurement()
|
||||
m = round(m, 3) if isinstance(m, (int, float)) else round(abs(m), 3)
|
||||
except Exception:
|
||||
m = None
|
||||
dims.append(dict(h=d.dxf.handle, layer=d.dxf.layer, type=d.dimtype,
|
||||
measurement=m, text=d.dxf.get("text", ""),
|
||||
p1=[round(v, 1) for v in d.dxf.get("defpoint2", (0, 0, 0))][:2],
|
||||
p2=[round(v, 1) for v in d.dxf.get("defpoint3", (0, 0, 0))][:2],
|
||||
line=[round(v, 1) for v in d.dxf.get("defpoint", (0, 0, 0))][:2],
|
||||
style=d.dxf.get("dimstyle", "")))
|
||||
data = dict(file=path.name, layers=Counter(e.dxf.layer for e in msp).most_common(),
|
||||
types=Counter(e.dxftype() for e in msp).most_common(),
|
||||
text_count=len(texts), dimension_count=len(dims), texts=texts, dimensions=dims)
|
||||
(OUT_DIR / f"{index}_survey.json").write_text(json.dumps(data, ensure_ascii=False, indent=1),
|
||||
encoding="utf-8")
|
||||
fig = plt.figure(figsize=(42, 30), dpi=100)
|
||||
ax = fig.add_axes([0, 0, 1, 1])
|
||||
Frontend(RenderContext(doc), MatplotlibBackend(ax)).draw_layout(msp, finalize=True)
|
||||
fig.savefig(OUT_DIR / f"{index}_overview.png", facecolor="white")
|
||||
plt.close(fig)
|
||||
return data
|
||||
|
||||
|
||||
def main():
|
||||
OUT_DIR.mkdir(exist_ok=True)
|
||||
files = sorted(IN_DIR.glob("*.dxf"))
|
||||
if len(files) != 3:
|
||||
sys.exit(f"expected 3 DXF, found {len(files)}")
|
||||
for i, f in enumerate(files, 1):
|
||||
d = survey(f, i)
|
||||
print(i, d["file"], "texts", d["text_count"], "dims", d["dimension_count"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user