Files
Pier_v1/Code/검토수정/스크립트/make_legend_compare_sanoe.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

64 lines
3.5 KiB
Python

"""산외교 마크별 대조 이미지: 재료표 형식 → 같은 강종 이형철근 상세의 형식 그림(왼쪽) ↔ 모델 형상(오른쪽) ↔ 표 L/모델 L.
입력: 도면_이형철근상세_DXF렌더.png(원본 DXF 렌더 5000x4210), jobs/c1_work/c1_shape_audit2.json. 출력: 검토파일/수정후_캡처/도면대조_산외_<부재>.png"""
import json
from pathlib import Path
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib import font_manager
from PIL import Image
font_manager.fontManager.addfont(r"C:\Windows\Fonts\malgun.ttf")
plt.rcParams["font.family"] = "Malgun Gothic"
ROOT = Path(r"D:\★Pier 자료\프로그램\Pier_T")
SRC = Image.open(ROOT / "검토파일" / "검토_산외교P1" / "도면_이형철근상세_DXF렌더.png").convert("RGB") # 원본 DXF(교각배근도(울산P1)_2016.10.28.dxf) 렌더, 5000x4210
D = json.load(open(r"C:\Users\User\AppData\Local\PierApp\jobs\c1_work\c1_shape_audit2.json", encoding="utf-8-sig"))["산외"]
OUT = ROOT / "검토파일" / "수정후_캡처"
ROM = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"]
SD500 = {"P1", "B1", "B2", "B3", "B4", "B5", "B6", "B8", "B9", "B10"}
S = 2.5
def legend(grade, shape):
i = ROM.index(shape)
if grade == "SD400":
r, c = divmod(i, 3)
x0, y0 = 766 + 210.3 * c, 286 + 157.75 * r
return (int(x0 * S), int(y0 * S), int((x0 + 210) * S), int((y0 + 157) * S))
y0 = 286 + 158 * i
return (int(1417 * S), int(y0 * S), int(1627 * S), int((y0 + 157) * S))
PARTS = {"코핑": "P1-CP", "기초": "P1-FT", "기둥": "P1-CL"}
made = []
for part, host in PARTS.items():
its = [x for x in D if x["host"] == host]
its.sort(key=lambda x: (x["mark"][0], int(x["mark"][1:])))
rows = (len(its) + 1) // 2
fig, axs = plt.subplots(rows, 4, figsize=(17, rows * 2.6))
axs = np.atleast_2d(axs)
for ax in axs.ravel():
ax.axis("off")
for i, x in enumerate(its):
r, c = divmod(i, 2)
a1, a2 = axs[r][c * 2], axs[r][c * 2 + 1]
grade = "SD500" if x["mark"] in SD500 else "SD400"
a1.axis("on"); a1.set_xticks([]); a1.set_yticks([])
a1.imshow(SRC.crop(legend(grade, x["shape"])))
a1.set_title("도면 %s 형식 %s (%s 상세) → %s" % ("", x["shape"], grade, x["mark"]), fontsize=9.5, fontweight="bold", color="#8a5a00")
P = np.array(x["pts"]); C = P - P.mean(0)
_, _, vt = np.linalg.svd(C, full_matrices=False); Q = C @ vt[:2].T
a2.axis("on"); a2.set_xticks([]); a2.set_yticks([])
a2.plot(Q[:, 0], Q[:, 1], "-", color="#1f77b4", lw=2); a2.plot(*Q[0], "o", color="green", ms=5); a2.plot(*Q[-1], "s", color="red", ms=5)
w, h = np.ptp(Q[:, 0]), np.ptp(Q[:, 1])
if h < 0.2 * w or w < 0.2 * h:
a2.set_aspect("auto"); a2.margins(0.08)
else:
a2.set_aspect("equal")
a2.set_title("모델 %s %s N=%d" % (x["mark"], x["dia"], x["n_obj"]), fontsize=9.5, fontweight="bold")
a2.set_xlabel("표 L=%s / 모델 %s (가로세로 비율 왜곡 가능)" % ((x["design_len"] or "-").split(".")[0], x["len"]), fontsize=8)
fig.suptitle("산외교 %s 철근 — 재료표 형식 ↔ 도면 형식 그림(같은 강종) ↔ 모델 형상" % part, fontsize=15, fontweight="bold")
fig.tight_layout(rect=(0, 0, 1, 0.97))
p = OUT / ("도면대조_산외_%s.png" % part); fig.savefig(p, dpi=75); plt.close(fig); made.append(p.name)
print(made)