"""Derive extract_r4.py (coping + bearing-seat rebar, G4) of the Ulsan P2 drawing from the P1 script (2026-10-15). Basis: the P2 schedule rows C1~C15 / S1~S4 (values, counts) and the coping outline are identical to P1; only the levels differ (coping bottom EL 68.716 vs 67.863 -> +853, tops EL 72.046 / 71.916, tip 70.416) and the table columns sit at other sheet x positions. All P1 drawn coordinates are heights relative to the coping bottom, so they are reused with Z0 shifted by +853. Text sets of the coping rebar region were compared (multiset diff P1 / P2): only column / footing / table / bearing values differ. Seat bars follow the P2 bearing table (centres, h1). """ from pathlib import Path HERE = Path(__file__).resolve().parent src = (HERE.parent / "울산P1판독" / "extract_r4.py").read_text(encoding="utf-8") pairs = [ ('"""R4 (coping rebar C1~C15, bearing-seat reinforcement S1~S4) reading of the Ulsan P1 drawing ->\ndata/산외교울산P1 params.coping_rebar', '"""R4 (coping rebar C1~C15, bearing-seat reinforcement S1~S4) of the Ulsan P2 drawing (derived from the P1 script, see make_r4.py) ->\ndata/산외교울산P2 params.coping_rebar'), ('PIER = APP / "data" / "산외교울산P1"', 'PIER = APP / "data" / "산외교울산P2"'), ('Z0 = 99715.8 # z = drawing y + Z0 (front / side views)', 'Z0 = 99715.8 + 853 # P1 drawing y -> z, shifted by the P2 coping bottom (68716 - 67863)'), ('ZTL, ZTR, ZTIP = 71193.0, 71063.0, 69563.0', 'ZTL, ZTR, ZTIP = 72046.0, 71916.0, 70416.0'), ('if 111000 < x < 112500)', 'if 110000 < x < 111100)'), ('"src": "재료표 L·수량·범위; 정면·측면 작도 좌표 (z = y + 99,715.8); 단면 A-A/B-B; 받침부 보강 상세",', '"src": "재료표 L·수량·범위; 울산P1 작도 높이(코핑 하면 기준) + 853 = 울산P2 코핑 하면 EL 68.716; 단면 A-A/B-B; 받침부 보강 상세",'), ] for a, b in pairs: assert src.count(a) == 1, a[:60] src = src.replace(a, b) (HERE / "extract_r4.py").write_text(src, encoding="utf-8") print("written", HERE / "extract_r4.py")