Files
Pier_v1/Code/운곡교P2판독/extract_r4.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

103 lines
6.4 KiB
Python

"""R4 (coping rebar) reading of the Ungok P2 drawings -> params.coping_rebar / rebar_marks(C*, S*) / expected.G4.
D1 front view (right half, EL = y - 16515.6 + 39456): the coping rebar is the P1 drawing lowered by 955 mm
(coping bottom 40411 -> 39456), with right-end values following the P2 coping (right top 42748):
- bottom C7/C8: flat z 39556 (20E88, 0..1074), arcs R12100 concentric with the soffit (20E8A)
- top tiers: 42356 (20DB8, half 5941.6), 42256 (20DB6), 42156 (20E9F); legs // end faces (20DB7)
- loops C12/C13: 9 levels 39806..41806 @250 (20D9D..20D95), right ends 1548.3..6003.6 (= P1)
- stirrups (verticals 20DB5..20D9E): x 0..900 @300, 1150..5900 @250; tops 42501.9 (x<3900) / 42647.8 (x>=3900)
- C14 dots (41): 42133.5 at 0, 900 .. 4900; 42233.5 / 40056 / 41056 / 40556 / 41556 at 13 + 1000k / 913 + 1000k;
42489.5 at 2913 (right only)
- C15 42647.8 x 3825.6..5900 (20E80); C16 42501.9 x 0..4075.6 (20E82), left end = step-3 left + 100 = -1179 [추론]
D3 (P2): counts as P1; C3/C6 H25; ranges C9 2.958~1.376, C11 2.958~1.668, C10 3.000, C12 12.228~3.151,
C13 12.167~12.044 (range texts read by position; the app table reader does not map them).
Rules reused from P1: stirrup top-left bands = left steps - 100 [추론], b = height + 54.3, loop widths drawn (K1),
C14 hooks up where a down hook would leave the soffit (4 bars, same positions as P1).
"""
import json
import shutil
import sys
import time
from pathlib import Path
HERE = Path(__file__).resolve().parent
APP = HERE.parent / "교각모델링앱"
PIER = APP / "data" / "운곡교p2"
sys.path.insert(0, str(HERE))
from extract_r2 import schedule # noqa: E402
def sym(pts):
out = []
for x, z in pts:
out.append([x, z])
if x > 20:
out.append([-x, z])
return out
def main():
S = schedule()
P = json.loads((PIER / "params.json").read_text(encoding="utf-8"))
E = json.loads((PIER / "expected.json").read_text(encoding="utf-8"))
stamp = time.strftime("%Y%m%d_%H%M%S")
for f in ("params.json", "expected.json"):
shutil.copy2(PIER / f, PIER / "backup" / f"{Path(f).stem}_before_R4_{stamp}.json")
cr = P["coping_rebar"]
cr["_note"] = "Coping rebar C1-C16, S1, S2 (Ungok P2)"
a = lambda m: round(float(S[m]["A"]) * 1000)
cr["top"]["tiers"] = {"1": {"z": 42356, "marks": ["C1", "C4"], "a": a("C1"), "legs": [1319, 1315]},
"2": {"z": 42256, "marks": ["C2", "C5"], "a": a("C2"), "legs": [101, 101]},
"3": {"z": 42156, "marks": ["C3", "C6"], "a": a("C3"), "legs": [101, 101]}}
cr["top"]["src"] = "D1 정면도 20DB8/20DB6/20E9F 42,356/42,256/42,156 (P1 - 955); D3 a 11.856/11.880/11.905, legs 1.319/1.315, 101"
cr["bottom"].update({"z_flat": 39556, "half_flat": 1073.9,
"src": "D1 20E88 z 39,556 (0~1,074) = 하면 100 위; ARC 20E8A R 12,100 동심; arc_len = (13,994 - 2,148 - 2x650)/2"})
cr["soffit_arc_centre"] = [6951.9, 28979.6]
cr["soffit_arc_centre_src"] = "right soffit arc centre (P2), rounded to 0.1 mm as P1; DXF 20E89 / 20E8A"
st = cr["stirrups"]
st["top_right"] = [[0, 42501.9], [3900, 42647.8]]
st["top_left"] = [[0, 42502], [1279, 42429], [3781, 42356]]
st["src"] = ("D1 정면도 수직선 20DB5~20D9E (우측 절반) 상단 42,501.9 / 42,647.8; 좌측 상단 = 좌측 소단 - 100 [추론] "
"(C9 최소 1,376 일치); 재료표 b = 높이 + 54.3 (C10 3,000, C11 2,958~1,668 일치)")
st["bottom"] = "z=39,556 for |X|<=1,073.9 else circle R 12,100 about (+-6,951.9, 28,979.6)"
lp = cr["loops"]
lp["levels"] = [39806 + 250 * k for k in range(9)]
lp["src"] = "D1 정면도 수평선 9단 39,806~41,806 @250 (20D9D~20D95, 우측 끝 1,548~6,004 = P1); 폭 = 작도 (K1)"
c14 = sym([(0, 42133.5), (900, 42133.5), (1900, 42133.5), (2900, 42133.5), (3900, 42133.5), (4900, 42133.5)])
c14 += sym([(13, 42233.5), (913, 42233.5), (1913, 42233.5), (2913, 42233.5), (3913, 42233.5), (4913, 42233.5)])
c14 += sym([(13, 40056), (1913, 40056)]) + sym([(13, 41056), (1913, 41056), (3913, 41056)])
c14 += sym([(913, 40556), (2913, 40556)]) + sym([(913, 41556), (2913, 41556), (4913, 41556)])
c14 += [[2913, 42489.5]]
cr["c14"].update({"points": c14, "a": a("C14"), "hook": int(S["C14"]["B"]),
"hooks_up": [[1913, 40056], [-1913, 40056], [2913, 40556], [-2913, 40556]],
"src": "D1 정면도 철근 점 41 (우측 절반, 대칭 환산; 42,489.5는 우측만); hooks_up = P1 HITL 규칙과 같은 4본"})
cr["c15"].update({"z": 42647.8, "x0": 3825.6, "x1": 5900, "hooks": [350, 350],
"src": "D1 20E80 42,647.8 (3,825.6~5,900 = a 2,074); D3 C15 A 2.074 B 350"})
cr["c16"].update({"z": 42501.9, "x0": -1179.4, "x1": 4075.6, "hook_left": 350,
"src": "D1 20E82 42,501.9 (0~4,075.6, 좌측 미작도) -> a 5,255로 좌단 -1,179.4 (소단3 좌단 +100) [추론]"})
for m in [f"C{i}" for i in range(1, 17)] + ["S1", "S2"]:
P["rebar_marks"][m] = {"dia": S[m]["_dia"], "shape": S[m]["형식"]}
g4 = E["G4"]
g4.update({
"count": {m: int(S[m]["개수"]) for m in g4["count"]},
"L": {m: round(float(S[m]["길이"]) * 1000) for m in g4["L"]},
"range": {"C9": ["b_sched", 2958, 1376], "C11": ["b_sched", 2958, 1668], "C10": ["b_sched", 3000, 3000],
"C12": ["a_sched", 12228, 3151], "C13": ["a_sched", 12167, 12044]},
"dia": {m: int(S[m]["_dia"][1:]) for m in g4["dia"]},
"tier_z": {"C1": 42356, "C4": 42356, "C2": 42256, "C5": 42256, "C3": 42156, "C6": 42156},
"c10_bottom": 39556,
"loop_z": {"C12": {"start": 39806, "pitch": 250, "n": 6}, "C13": [41306, 41556, 41806]},
"c15_top": 42647.8, "c16_top": 42501.9,
"c14_levels": [[42133.5, 11], [42233.5, 11], [40056, 3], [41056, 5], [40556, 4], [41556, 6], [42489.5, 1]],
"step_top": {"1": 42456, "2": 42529, "3": 42602, "4": 42675, "5": 42748},
"src": "D3 (P2) 수량·L·a/b 범위; D1 A-A 사슬 '100','137','21@125','3000' / B-B '10@250'; 정면도 단 높이·스터럽 X·루프 EL; D2 '50','50'",
})
(PIER / "params.json").write_text(json.dumps(P, ensure_ascii=False, indent=1), encoding="utf-8")
(PIER / "expected.json").write_text(json.dumps(E, ensure_ascii=False, indent=1), encoding="utf-8")
print("c14", len(c14), "L", g4["L"])
print("dia", {m: P["rebar_marks"][m]["dia"] for m in ("C1", "C3", "C6", "C7", "C9", "C14")})
if __name__ == "__main__":
main()