"""Add the footing rebar (G3: B1~B12, centreline polylines) to the app pier '옥성교P1'. params = 판독/g3_bars.json (extract_g3_bars.py, decisions F1-F5 2026-10-14); builder rebar_polylines.py (GATE G3) expected = schedule L / N, dimension chains, schedule legs b, drawn levels and the B9 rule, typed in by hand. Backs up params.json / expected.json to data/옥성교P1/backup/2026-10-14_g3/ first. Refuses if G3 is in scope. """ import json import shutil import sys from pathlib import Path HERE = Path(__file__).resolve().parent D = HERE.parents[1] / "Code" / "교각모델링앱" / "data" / "옥성교P1" B = json.loads((HERE / "판독" / "g3_bars.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-14_g3" bk.mkdir(parents=True, exist_ok=True) for f in ("params.json", "expected.json"): shutil.copy2(D / f, bk / f) SCHED = {"B1": (12730, 39, "H29"), "B2": (14070, 39, "H29"), "B3": (12730, 38, "H29"), "B4": (14070, 38, "H29"), "B5": (12880, 38, "H29"), "B6": (14370, 38, "H29"), "B7": (12880, 37, "H29"), "B8": (14370, 37, "H29"), "B9": (4763, 171, "H19"), "B10": (41152, 5, "H19"), "B11": (10160, 19, "H19"), "B12": (10160, 19, "H19")} SHAPE = {m: "U" for m in SCHED} | {"B9": "tie-C", "B10": "loop"} P["scope"] = ["G1", "G2", "G3", "G5"] P["builders"]["G3"] = "rebar_polylines.py" P["rebar_marks"].update({m: {"dia": d, "shape": SHAPE[m]} for m, (_, _, d) in SCHED.items()}) P["footing_rebar"] = {"form": "polylines", "host": "FT", "group": "기초", "bars": B["bars"], "not_modelled": "UM 조립용 A자형 받침 H22 L 4,504 x 92 (F5: 기록만), 겹이음 j (F3)", "src": "Code/옥성P1판독/extract_g3_bars.py -> 판독/g3_bars.json; 판독서 v0.1.04 §10, 결정 F1~F5"} X["checkers"]["G3"] = "g3_poly.py" X["negative"]["G3"] = [{"mark": "B1", "d": [5, 0, 0]}, {"mark": "B10", "d": [0, 0, 5]}] cy = lambda: {"start": [-4700], "groups": [[2, 100], [72, 125], [2, 100]]} # '100 | 2@100 | 72@125 | 2@100 | 100' cx = lambda: {"start": [-4700], "groups": [[2, 162.5], [70, 125], [2, 162.5]]} # '100 | 2@163 | 70@125 | 2@163 | 100' X["G3"] = { "schedule": {m: [L, n] for m, (L, n, _) in SCHED.items()}, "dia": {m: int(d[1:]) for m, (_, _, d) in SCHED.items()}, "half_a": 4700, "mats": {"y_bottom": {"marks": ["B2", "B4"], "axis": "Y", "z": 12325, "leg": 1800, "chain": cy()}, "x_bottom": {"marks": ["B6", "B8"], "axis": "X", "z": 12347.5, "leg": 1950, "chain": cx()}, "y_top": {"marks": ["B1", "B3"], "axis": "Y", "z": 14275, "leg": -900, "chain": cy()}, "x_top": {"marks": ["B5", "B7"], "axis": "X", "z": 14252.5, "leg": -975, "chain": cx()}}, "mid": {"B12": {"axis": "Y", "chain": {"start": [-4500], "groups": [[18, 500]]}, "z_hi": 13844, "z_lo": 12844}, "B11": {"axis": "X", "chain": {"start": [-4537.5], "groups": [[1, 537.5], [16, 500], [1, 537.5]]}, "z_hi": 13825, "z_lo": 12825}}, "b10": {"levels": [12575, 12825, 13325, 13825, 14075], "size": 9445}, "b9": {"n_cols": 19, "pitch_x": 500, "height": 1998}, "src": "재료표 L·N·b; 정면 '100, 2@100, 72@125=9.000'·'18@500'; 측면 '100, 2@163, 70@125=8.750'·'538, 16@500, 538'; " "층 EL·B10 단 [작도]; B9 격자 규칙 + F1(171); F3 교번; F4 B11 X / B12 Y(+19); B9 높이 = 상·하면 Y철근 바깥 (14.299 - 12.301)", } (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:", len(B["bars"]), "bars; backup", bk)