"""Add the shaft cage (G3: P1-1, P1-2, P2-1, P3-1, P3-2, anti-uplift plate) to the app pier 'Ramp-A교P1'. params = drawn / table values (판독/g3_values.json, 판독서 v0.1.04 §12) and user decisions S1-S6 (2026-10-13); expected = D4 schedule L / N, 구조물 치수표 chains from the shaft top, section radii, typed in by hand. Backs up params.json / expected.json to data/Ramp-A교P1/backup/2026-10-13_g3/ first. Refuses if G3 is in scope. """ import json import math import shutil import sys from pathlib import Path HERE = Path(__file__).resolve().parent D = HERE.parents[1] / "Code" / "교각모델링앱" / "data" / "Ramp-A교P1" V = json.loads((HERE / "판독" / "g3_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 "G3" in P["scope"]: sys.exit("G3 already in scope") bk = D / "backup" / "2026-10-13_g3" bk.mkdir(parents=True, exist_ok=True) for f in ("params.json", "expected.json"): shutil.copy2(D / f, bk / f) TOP = 45452.0 # shaft top (D1) hoops = [TOP - 110 - 150 * k for k in range(14)] hoops += [hoops[-1] - 300 * k for k in range(1, 35)] ties = [TOP - 260 - 300 * k for k in range(7)] ties += [ties[-1] - 600 * k for k in range(1, 18)] assert len(hoops) == 48 and len(ties) == 24 and hoops[0] - hoops[-1] == 8750 + 3400 zb = 32752.0 + 100 # U bottom (centreline), shaft bottom + 100 leg_top = zb + math.sqrt(581 ** 2 - 135 ** 2) jj = V["J-J"] P["scope"] = ["G1", "G2", "G3", "G5"] P["builders"]["G3"] = "shaft_rebar.py" P["rebar_marks"].update({"P1-1": {"dia": "H35", "shape": "I"}, "P1-2": {"dia": "H22", "shape": "I"}, "P2-1": {"dia": "H16", "shape": "hoop-lap"}, "P3-1": {"dia": "H16", "shape": "tie-90/135"}, "P3-2": {"dia": "H16", "shape": "U"}}) P["rebar_marks_src"] = "D4 철근 재료표(기둥) 기호·직경, D3 철근 상세 형상 (기둥 P1~P3 + 말뚝 P1-1~P3-2)" P["shaft_rebar"] = { "form": "shaft_cage", "main": {"count": jj["bar_count"], "start_deg": jj["first_deg"], "radius": 999.5, "coupler_length": 0.0, "pieces": [{"mark": "P1-2", "z0": hoops[-1], "z1": hoops[-1] + 3400}, {"mark": "P1-1", "z0": hoops[-1] + 3400, "z1": hoops[0]}]}, "hoops": {"mark": "P2-1", "radius": 1025.0, "levels": sorted(hoops), "a": 3220.0, "lap": 880.0, "hook": 200.0, "join_deg": [90, 0]}, "ties": {"mark": "P3-1", "levels": sorted(ties), "straight": 2137.0, "leg": 200.0, "hook_tail": 150.0, "y_lift": 16.0}, "u_bars": {"mark": "P3-2", "count": 30, "z_bottom": zb, "half_bottom": 890.0, "half_top": 1025.0, "leg_top_z": round(leg_top, 1), "top_z": round(leg_top + 200, 1), "bend_r": 135.0}, "plate": {"size": 1250.0, "thickness": 4.0, "z_top": zb - 8, "colour": [150, 150, 150]}, "design_lengths": {"P1-1": 8750.0, "P1-2": 3400.0, "P2-1": 3220.0 + 880.0 + 2 * 200.0, "P3-1": 200.0 + 2137.0 + 165.0 + 150.0, "P3-2": 1780.0 + 2 * 581.0 + 2 * 200.0}, "src": {"main": "D4 단면 G-G·J-J 61개 1.475°부터 5.902°; r 999.5 (S2); P1-1 45.342~36.592, P1-2 36.592~33.192 (첫~끝 띠철근 단, 커플러 0, S6)", "hoops": "구조물 치수표 H4 13@150, H3 34@300, 사슬 '110' (48단); r 1,025 (S1, 재료표 r 929는 오기); 겹이음 880 교번 (S5 [추론])", "ties": "H2 6@300, H1 17@600, 사슬 '260' (24단 × X·Y); 재료표 a 200 b 2,137 c 165 d 150; Y +16, 교번 (S5 [추론])", "u_bars": "재료표 r 135, a 1,780, b 581, c 200; 바닥 = 말뚝 바닥 +100; 중심 통과 30면, 주철근 0~29번 각도 (S3 [추론])", "plate": "D4 PLATE 1,250×1,250×4 (T=4mm); U형 바닥 아래, 중심 (S4 [추론])", "not_modelled": "SPACER 4mm 간격재 (공식 {H-2.500-(0.500x2)}x2개소만 기록, 사용자 결정)"}, } X["checkers"]["G3"] = "g3_shaft.py" X["negative"]["G3"] = [{"mark": "P1-1", "d": [5, 0, 0]}, {"mark": "P2-1", "d": [0, 0, 5]}] X["G3"] = {"schedule_L": {"P1-1": 8750, "P1-2": 3400, "P2-1": 9000, "P3-1": 2652, "P3-2": 3342}, "schedule_n": {"P1-1": 61, "P1-2": 61, "P2-1": 48, "P3-1": 48, "P3-2": 30}, "dia": {"P1-1": 35, "P1-2": 22, "P2-1": 16, "P3-1": 16, "P3-2": 16}, "shaft_top": TOP, "main": {"pieces": ["P1-2", "P1-1"], "radius": 999.5, "divisions": 61, "start_deg": 1.475}, "hoops": {"mark": "P2-1", "radius": 1025, "chain": {"first": 110, "groups": [[13, 150], [34, 300]]}}, "ties": {"mark": "P3-1", "chain": {"first": 260, "groups": [[6, 300], [17, 600]]}, "y_lift": 16}, "u_bars": {"mark": "P3-2", "bottom_above": 100}, "plate": {"size": 1250, "thickness": 4}, "src": "D4 재료표(기둥)·PLATE 재료표; 구조물 치수표 H 12,700, H1 17@600, H2 6@300, H3 34@300, H4 13@150, H5·H6 340, " "사슬 '260'·'110'·'100'; 단면 원 r 1,025, DIVISION 61 (첫 1.475°); S1~S6 사용자 결정 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("G3 added; backup", bk)