"""Add the column rebar (G2: P1 main, P2 hoops, P3 ties) to the app pier 'Ramp-A교P1'. params = drawn / chain values (판독/g2_values.json, DOC 판독서 v0.1.02 §11) and user decisions K1-K4 (2026-10-13); expected = schedule L / N / r (D4 재료표(기둥), D3 철근 상세) and the D2 chain anchor, typed in by hand. Backs up params.json / expected.json to data/Ramp-A교P1/backup/2026-10-13_g2/ first. Refuses if G2 is already in scope. """ import json import shutil import sys from pathlib import Path HERE = Path(__file__).resolve().parent APP = HERE.parents[1] / "Code" / "교각모델링앱" D = APP / "data" / "Ramp-A교P1" V = json.loads((HERE / "판독" / "g2_values.json").read_text(encoding="utf-8")) P = json.loads((D / "params.json").read_text(encoding="utf-8")) X = json.loads((D / "expected.json").read_text(encoding="utf-8")) if "G2" in P["scope"]: sys.exit("G2 already in scope") bk = D / "backup" / "2026-10-13_g2" bk.mkdir(parents=True, exist_ok=True) for f in ("params.json", "expected.json"): shutil.copy2(D / f, bk / f) A = 45492.0 # chain anchor (D2 '띠철근외측' / '크로스타이' common tick) mf, ms = V["main_front"], V["main_section"] P["scope"] = ["G1", "G2", "G5"] P["builders"]["G2"] = "column_rebar_straight.py" P["rebar_marks"] = {"P1": {"dia": "H35", "shape": "I"}, "P2": {"dia": "H16", "shape": "hoop-lap"}, "P3": {"dia": "H16", "shape": "tie-90/135"}} P["rebar_marks_src"] = "D4 철근 재료표(기둥) 기호·직경, D3 철근 상세 형상. 말뚝 철근망(P1-1·P1-2·P2-1·P3-1·P3-2)은 범위 밖" P["display"]["rebar_palette"]["35"] = [148, 103, 189] P["display"]["rebar_palette_src_H35"] = "H35 (148,103,189) Agent 제안 2026-10-13 — R8 등재 확정 대기" P["column_rebar"] = { "form": "straight", "main": {"mark": "P1", "count": ms["count"], "start_deg": 0.0, "radius": ms["radius"], "z0": mf["bottom_EL"], "z1": mf["top_EL"], "coupler_length": 40.0}, "hoops": {"mark": "P2", "radius": 901.0, "levels": [43542.0 + 150 * k for k in range(107)], "a": 2829.0, "lap": 650.0, "hook": 200.0, "join_deg": [90, 0]}, "ties": {"mark": "P3", "levels": [43692.0 + 300 * k for k in range(54)], "straight": 1832.0, "leg": 200.0, "hook_tail": 150.0, "y_lift": 16.0}, "design_lengths": {"P1": mf["top_EL"] - mf["bottom_EL"], "P2": 2829.0 + 650.0 + 2 * 200.0, "P3": 200.0 + 1832.0 + 141.0 + 100.0}, "src": {"main": "D2 단면 C-C 기호 54개 r 875 (0°부터 6.667°), 정면 작도 EL 43.492~59.752; 하단 커플러 40 = L 16,300 - 작도 16,260 (K1)", "hoops": "재료표 r 901, a 2,829, b 200, j 650x2; 단 = 사슬 격자 43.542 + 150k, 107단 (K2); 이음 90°/0° 교번 (K4 [추론])", "ties": "재료표 a 200, b 1,832, c 141, d 100; 단 = 43.692 + 300k, 54단, X·Y 1단 2개, Y +16 (K3 [추론]); 다리·갈고리 좌우 교번 (K4 [추론]); 갈고리 꼬리 작도 150 [추론]", "design_lengths": "P1 작도 길이(+커플러 40 = L), P2 a+j+2b 한 조각(두 조각 = L 7,758), P3 a+b+c+d = 2,273 (L 2,274 반올림)"}, } X["checkers"]["G2"] = "g2_straight.py" X["negative"]["G2"] = [{"mark": "P1", "d": [5, 0, 0]}, {"mark": "P2", "d": [0, 0, 5]}] X["rebar_palette"]["35"] = [148, 103, 189] X["G2"] = {"schedule_L": {"P1": 16300, "P2": 7758, "P3": 2274}, "schedule_n": {"P1": 54, "P2": 107, "P3": 108}, "dia": {"P1": 35, "P2": 16, "P3": 16}, "chain_anchor": A, "main": {"mark": "P1", "radius": 875, "divisions": 54, "start_deg": 0.0, "below_anchor": 2000, "coupler": 40}, "hoops": {"mark": "P2", "radius": 901, "pitch": 150, "below": 13}, "ties": {"mark": "P3", "pitch": 300, "below": 6, "per_level": 2, "y_lift": 16}, "src": "D4 재료표(기둥) L·N, D3 상세 r 901; D2 단면 '125, 875, 875, 125' DIVISION 54; D2 사슬 '2,000', H4 14@150, H5 78@150, " "H1 7@300, H2 39@300 (기점 EL 45.492); K1 커플러 40, K2 hoop 13단 아래, K3 Y +16 (사용자 결정 2026-10-13)"} (D / "params.json").write_text(json.dumps(P, ensure_ascii=False, indent=1), encoding="utf-8") (D / "expected.json").write_text(json.dumps(X, ensure_ascii=False, indent=1), encoding="utf-8") print("G2 added; backup", bk)