Files
Pier_v1/Code/교각모델링앱/tools/make_anchors.py
T
ahnyongjooandClaude Sonnet 5.5 964a841de1 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>
2026-10-28 11:20:18 +09:00

29 lines
1.5 KiB
Python

"""Learn anchors (engine/anchors.py) for the protected templates from their source pier's drawing and write data/_템플릿/<t>/anchors.json
(2026-10-19). The template's own params / expected give the values, the source pier's drawing texts give the places.
usage: python tools/make_anchors.py [--force]"""
import json
import sys
from pathlib import Path
APP = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(APP))
from engine import anchors # noqa: E402
SOURCE = {"운곡교P1형": "운곡교P1", "산외교울산P1형": "산외교울산P1", "산외교울산P2형": "산외교울산P2", "새재1교P1형": "새재1교P1",
"옥성교P1형": "옥성교P1", "Ramp-A교P1형": "Ramp-A교P1"}
force = "--force" in sys.argv
for t, pier in SOURCE.items():
td = APP / "data" / "_템플릿" / t
out = td / "anchors.json"
if out.exists() and not force:
print("keep", t)
continue
P = json.loads((td / "params.json").read_text(encoding="utf-8"))
E = json.loads((td / "expected.json").read_text(encoding="utf-8"))
d = APP / "data" / pier / "drawings"
texts = json.loads((d / "texts.json").read_text(encoding="utf-8"))
shas = [a["source_sha256"] for a in json.loads((d / "audit.json").read_text(encoding="utf-8")) if a.get("source_sha256")]
a = anchors.learn(P, E, texts, shas)
out.write_text(json.dumps(a, ensure_ascii=False), encoding="utf-8")
print("wrote", t, "fields", len(a["fields"]), "landmarks", len(a["landmarks"]), f"{out.stat().st_size // 1024} KB")