"""Convert the Ungok P1 working params.json into the app schema `pier-T/1`. The legacy build scripts kept some values as code constants. They are moved into params here, each with its source, so that the app builders contain no pier-specific numbers: rebar_marks <- MARK / MARK_DIA tables of the legacy build scripts (D3 schedule reading) footing_rebar.a_y/a_x <- D3 B1 a 7.600 / B5 a 9.150 coping_rebar.soffit_arc_centre <- rounded right soffit-arc centre used by the legacy coping build coping_rebar.stirrups.top_right/top_left <- band thresholds that were encoded in key names sole_plates.h3 <- D2 ELEVATION TABLE h3 display <- layer colours, diameter palette, hidden objects (user decisions) usage: python migrate_legacy_params.py """ import copy import json import sys from pathlib import Path MARKS = { # column (D3, 설계서 §5) "P1": ("S32", "XIV"), "P2": ("S32", "XVI"), "P3": ("H19", "VI"), "P4": ("H19", "V"), "P5": ("H19", "IX"), "P6": ("H16", "III"), # footing (D3, 설계서 §6) "B1": ("S25", "III"), "B2": ("S25", "XII"), "B3": ("S19", "III"), "B4": ("S25", "I"), "B5": ("S29", "XII"), "B6": ("S29", "XII"), "B7": ("S19", "XII"), "B8": ("S29", "XVI"), "B9": ("H16", "XI"), "B10": ("S19", "XIII"), "B11": ("S16", "XII"), "B12": ("S16", "III"), # coping (D3, 설계서 §7) "C1": ("H29", "VIII"), "C2": ("H29", "VIII"), "C3": ("H29", "VIII"), "C4": ("H29", "VIII"), "C5": ("H29", "VIII"), "C6": ("H29", "VIII"), "C7": ("H29", "VII"), "C8": ("H29", "VII"), "C9": ("H25", "IV"), "C10": ("H25", "IV"), "C11": ("H25", "IV"), "C12": ("H25", "X"), "C13": ("H25", "X"), "C14": ("H19", "III"), "C15": ("H19", "III"), "C16": ("H19", "II"), "S1": ("H19", "III"), "S2": ("H19", "III"), } def migrate(P): A = copy.deepcopy(P) A["_schema"] = "pier-T/1" A["pier_id"] = "P1" A["rebar_marks"] = {m: {"dia": d, "shape": s} for m, (d, s) in MARKS.items()} A["rebar_marks_src"] = "D3 철근재료표 판독 (설계서 v0.1.10 §5~7; 동일 기호(\") 해석 반영)" fr = A["footing_rebar"] fr["a_y"], fr["a_x"] = 7600.0, 9150.0 fr["a_src"] = "D3 B1 a '7.600' (Y bars B1-B4, B12) / B5 a '9.150' (X bars B5-B8, B11)" cr = A["coping_rebar"] cr["soffit_arc_centre"] = [6951.9, 29934.6] cr["soffit_arc_centre_src"] = "right soffit arc centre, rounded to 0.1 mm (legacy build constant); left mirrored" st = cr["stirrups"] st["top_right"] = [[0, st["top_right"]["X<3900"]], [3900, st["top_right"]["X>=3900"]]] t = st.pop("top_left_inferred") st["top_left"] = [[0, t["|X|<1296"]], [1296, t["1296<=|X|<3801"]], [3801, t["|X|>=3801"]]] st["top_bands_note"] = "[[|X| from, Z]]: right applies to X>=0, left to X<0 [추론]; last band with |X|>=from wins" A["materials"] = {"fck": {"lean": "15MPa", "footing": "27MPa", "column": "40MPa", "coping": "40MPa", "seat": "40MPa"}, "src": "D1 주기 콘크리트 강도 (legacy build constants)"} A["piles"]["kind"] = "composite pile" bs = A["bearing_seats"] bs["reference_girder"] = 5 bs["pad_margin_bottom"], bs["pad_margin_top"] = 200, 100 bs["pad_margin_src"] = "D1 평면도 pad (A+200)x(B+200) bottom / (A+100)x(B+100) top (pad_size_rule)" A["sole_plates"]["h3"] = 181 A["display"] = { "concrete_layers": {"lean": ["버림콘크리트", [160, 160, 160]], "footing": ["기초", [120, 150, 200]], "column": ["기둥", [200, 140, 90]], "coping": ["코핑", [210, 180, 80]], "pile": ["말뚝", [110, 110, 110]], "seat": ["받침대좌", [190, 90, 90]], "pad": ["받침패드", [90, 160, 90]]}, "centreline_colour": [60, 60, 60], "column_mark_colours": {"P1": [200, 40, 40], "P2": [230, 120, 40], "P3": [40, 120, 200], "P4": [40, 170, 170], "P5": [90, 90, 220], "P6": [140, 60, 160]}, "footing_layer_colour": [150, 110, 60], "coping_layer_colour": [120, 120, 160], "rebar_palette": {"32": [214, 39, 40], "29": [255, 127, 14], "25": [188, 60, 160], "19": [44, 160, 44], "16": [31, 119, 180]}, "hidden_ids": ["P1-FT", "P1-CP"], "src": "디자인지침_경로.md R8 팔레트(2026-10-07), 숨김 = 사용자 결정 '숨김 유지'(P1-FT, P1-CP)", } return A if __name__ == "__main__": src, dst = Path(sys.argv[1]), Path(sys.argv[2]) A = migrate(json.loads(src.read_text(encoding="utf-8"))) dst.parent.mkdir(parents=True, exist_ok=True) dst.write_text(json.dumps(A, ensure_ascii=False, indent=1), encoding="utf-8") print(dst, len(A["rebar_marks"]), "marks")