"""Add the coping rebar (G4: C1~C16, S1~S4) to the app pier 'Ramp-A교P1' (generic builder rebar_polylines.py). params = 판독/g4_bars.json (extract_g4.py: drawn values + decisions T1-T6, 2026-10-14) expected = D3 schedule L / N, D2 / D3 drawn positions and section dimensions, typed in by hand. Backs up params.json / expected.json to data/Ramp-A교P1/backup/2026-10-14_g4/ first. Refuses if G4 is in scope. """ import json import shutil import sys from pathlib import Path HERE = Path(__file__).resolve().parent D = HERE.parents[1] / "Code" / "교각모델링앱" / "data" / "Ramp-A교P1" B = json.loads((HERE / "판독" / "g4_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 "G4" in P["scope"]: sys.exit("G4 already in scope") bk = D / "backup" / "2026-10-14_g4" bk.mkdir(parents=True, exist_ok=True) for f in ("params.json", "expected.json"): shutil.copy2(D / f, bk / f) SCHED = {"C1": (8617, 9, "H29"), "C2": (7177, 9, "H29"), "C4": (8617, 8, "H29"), "C5": (7177, 8, "H29"), "C3": (7230, 9, "H25"), "C6": (9003, 9, "H25"), "S3": (1250, 44, "H25"), "S4": (1250, 44, "H25"), "C7": (7480, 20, "H19"), "C8": (6071, 40, "H19"), "C9": (9251, 15, "H19"), "C10": (7426, 30, "H19"), "C11": (8110, 20, "H19"), "C12": (5333, 40, "H19"), "C13": (11309, 18, "H19"), "C14": (18057, 12, "H19"), "C15": (2700, 51, "H19"), "C16": (4000, 17, "H19"), "S1": (2700, 22, "H16"), "S2": (2600, 24, "H16")} SHAPE = {"C1": "top-legs", "C2": "top-legs", "C3": "top-legs", "C4": "top-legs", "C5": "top-legs", "C6": "soffit-R", "C7": "stirrup", "C8": "stirrup-chamfer", "C9": "stirrup", "C10": "stirrup-chamfer", "C11": "stirrup", "C12": "stirrup-chamfer", "C13": "loop", "C14": "loop", "C15": "U", "C16": "U", "S1": "U", "S2": "U", "S3": "I", "S4": "I"} P["scope"] = ["G1", "G2", "G3", "G4", "G5"] P["builders"]["G4"] = "rebar_polylines.py" P["rebar_marks"].update({m: {"dia": d, "shape": SHAPE[m]} for m, (_, _, d) in SCHED.items()}) P["coping_rebar"] = {"form": "polylines", "host": "CP", "group": "코핑", "bars": B["bars"], "src": "Code/RampA판독/extract_g4.py -> 판독/g4_bars.json; 판독서 v0.1.06 §13, 결정 T1~T6 (2026-10-14)"} X["checkers"]["G4"] = "g4_ramp.py" X["negative"]["G4"] = [{"mark": "C1", "d": [0, 5, 0]}, {"mark": "C7", "d": [0, 0, 5]}] row = lambda s, p, n: {"start": s, "pitch": p, "n": n} X["G4"] = { "schedule": {m: [L, n] for m, (L, n, _) in SCHED.items()}, "dia": {m: int(d[1:]) for m, (_, _, d) in SCHED.items()}, "fixed_length": ["C1", "C2", "C3", "C4", "C5", "C6", "C15", "C16", "S1", "S2", "S3", "S4"], "layers": {"C1": {"z": 59852, "y": row(-1000, 250, 9), "x_top": [-3425.6, 3492.1]}, "C4": {"z": 59852, "y": row(-875, 250, 8), "x_top": [-3425.6, 3492.1]}, "C2": {"z": 59752, "y": row(-1000, 250, 9), "x_top": [-3455.6, 3515.0]}, "C5": {"z": 59752, "y": row(-875, 250, 8), "x_top": [-3455.6, 3515.0]}, "C3": {"z": 59652, "y": row(-1000, 250, 9), "x_top": [-3485.6, 3537.8]}, "C16": {"z": 60167, "y": row(-1000, 125, 17), "x_top": [100, 3400]}}, "stirrups": {"x": row(-3375, 125, 55), "inner_dx": 20, "top_cover": 77.5, "bottom_cover": 77.5, "outer_y": [-875, 750], "zones": {"left": ["C7", "C8", -3375, -1000], "centre": ["C9", "C10", -875, 875], "right": ["C11", "C12", 1000, 3375]}}, "loops": {"per_level": 3, "levels": {"C14": [59827, 59577, 59327, 59077], "C13": [58827, 58577, 58327, 58077, 57827, 57577]}}, "c6": {"z_bottom": 57552, "y": [-906.5, -750, -500, -250, 0, 250, 500, 750, 906.5], "y_note": "T1 @250 9본; 하면 직선부(EL 57.552)에서는 바깥 2본이 측면 테이퍼 피복 100.2로 ±906.5"}, "c15": {"a": 2000}, "seats": {"1": {"S1": 11, "S2": 12, "S3": 22, "S4": 22}, "2": {"S1": 11, "S2": 12, "S3": 22, "S4": 22}}, "src": "D3 재료표·철근 상세; D2 정면 작도(상면 3단 EL·x 끝, 스터럽 55곳, C13·C14 단, C16); 단면 A-A·B-B(행 @125/@250, " "스터럽 y·피복 77.5); 교좌면 E-E·F-F; 결정 T1~T6 (2026-10-14)", } (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("G4 added:", len(B["bars"]), "bars; backup", bk)