Files
Pier_v1/Code/옥성P1판독/extract_g1.py
T
ahnyongjooandClaude Sonnet 5.5 964a841de1 chore(rebar): Pier_T_rebar 작업 폴더 초기 구성 및 외부 의존 파일 통합
- Code\rebar_pipeline, review_pipeline, pier-program을 정션에서 실제 폴더로 전환
- Code\rhino_mcp 및 CLAUDE_rhino배경.md 추가, .mcp.json은 PYTHONPATH로 새 위치 사용
- pier-program 내부 .git 제거(이력은 backup\pier-program_20261028.bundle에 보관)
- worktree 가이드 반영(CLAUDE.local.md, HANDOFF.md)
- D:\Rhino-MCP 경로 참조를 새 위치로 치환

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 11:20:18 +09:00

87 lines
5.2 KiB
Python

"""Okseong P1 shape reading (G1 + G5 positions) from the general drawing -> 판독/g1_values.json.
Datums: front view CL x 390779.3, side view CL x 418514.4, z(mm) = drawing y - 314374.9 (footing bottom y 326549.9
= EL 12.175, coping top left y 335549.9 = EL 21.175). Plan view: column centre (391315.4, 352134.6) = model origin;
plan y up = model +Y. The coping is skewed in plan: end faces and top-step lines at 108 deg.
"""
import json
import math
from pathlib import Path
from dxftools import doc, entities
D = doc("D1")
FX, SX, ZO = 390779.3, 418514.4, -314374.9
PCX, PCY = 391315.4, 352134.6
out = {}
def line(h):
e = D.entitydb[h]
return (e.dxf.start.x, e.dxf.start.y), (e.dxf.end.x, e.dxf.end.y)
z = lambda y: round(y + ZO, 1)
# front view coping outline (y = 0 section): 1044B..10458
a, b = line("1044C")
out["coping_front"] = {
"bottom_flat_half": round(line("1044D")[1][0] - FX, 1), "z_bottom": z(line("1044D")[0][1]),
"tip_x": round(abs(a[0] - FX), 1), "z_tip": z(a[1]),
"end_left": {"x": round(line("1044B")[0][0] - FX, 1), "z0": z(line("1044B")[1][1]), "z1": z(line("1044B")[0][1])},
"end_right": {"x": round(line("1044F")[0][0] - FX, 1), "z0": z(line("1044F")[0][1]), "z1": z(line("1044F")[1][1])},
"top_steps": [{"x0": round(line(h)[0][0] - FX, 1), "x1": round(line(h)[1][0] - FX, 1), "z": z(line(h)[0][1])}
for h in ("10450", "10452", "10454", "10456", "10458")],
"src": "D1 정면 1044B~10458"}
# side view: coping width / taper, column, footing, lean
out["coping_side"] = {"half_width_top": 1650.0, "z_taper_top": 19675.0, "half_width_bottom": 1250.0, "z_bottom": 18175.0,
"src": "D1 단면도 (416864.4 / 420164.4 수직 EL 19.675~, 417264.4 / 419764.4 EL 18.175, 경사 1,552.4)"}
out["column"] = {"d": 2500.0, "z0": 14375.0, "z1": 18175.0, "src": "D1 정면 10347/10349, 단면도"}
out["footing"] = {"size_x": 9600.0, "size_y": 9600.0, "z0": 12175.0, "z1": 14375.0, "src": "D1 정면 1035C~1035F, 단면도"}
out["lean"] = {"size_x": 9800.0, "size_y": 9800.0, "z0": 12075.0, "z1": 12175.0, "src": "D1 정면 10355~1035B (9,800 x 100)"}
# piles: foundation plan symbols CSPILEH (5 x 5 @2,000), front view: D609, head 100 above the footing bottom
pins = [e for e in entities("D1", 409000, 343500, 428500, 358500) if e.dxftype() == "INSERT" and e.dxf.name == "CSPILEH"]
px = sorted({round(e.dxf.insert.x, 1) for e in pins})
py = sorted({round(e.dxf.insert.y, 1) for e in pins})
out["piles"] = {"count": len(pins), "nx": len(px), "ny": len(py), "pitch_x": px[1] - px[0], "pitch_y": py[1] - py[0],
"d": 609.0, "t": 12.0, "length": 22000.0, "z_top": 12275.0,
"src": "기초 평면도 CSPILEH 25개 (5 x 5 @2,000), 정면 말뚝 x 0, +-2,000, +-4,000, 머리 EL 12.275; 'Ø609.0x12T, L=22.0M'"}
# plan: skew of the coping (end line 104A3), coping outline 104A4 / 104A6
(e0, e1) = line("104A3")
out["skew_deg"] = round(math.degrees(math.atan2(e1[1] - e0[1], e1[0] - e0[0])) - 90, 3)
out["coping_plan"] = {"top_edge_y": round(line("104A4")[0][1] - PCY, 1), "bottom_edge_y": round(line("104A6")[0][1] - PCY, 1),
"top_edge_x": [round(line("104A4")[0][0] - PCX, 1), round(line("104A4")[1][0] - PCX, 1)],
"bottom_edge_x": [round(line("104A6")[1][0] - PCX, 1), round(line("104A6")[0][0] - PCX, 1)],
"step_lines_top_x": [round(line(h)[1][0] - PCX, 1) for h in ("104A7", "104A8", "104A9", "104AA")],
"src": "D1 평면 104A3~104AA"}
def rect(h):
pts = [p[:2] for p in D.entitydb[h].get_points("xy")]
cx, cy = sum(p[0] for p in pts) / 4 - PCX, sum(p[1] for p in pts) / 4 - PCY
e = [(pts[(i + 1) % 4][0] - pts[i][0], pts[(i + 1) % 4][1] - pts[i][1]) for i in range(4)]
L = [math.hypot(*v) for v in e]
ia = max(range(4), key=lambda i: abs(e[i][1]))
vx, vy = e[ia] if e[ia][1] > 0 else (-e[ia][0], -e[ia][1])
return {"centre": [round(cx, 1), round(cy, 1)], "along": round(L[ia], 1), "across": round(L[(ia + 1) % 4], 1),
"rotation_deg": round(math.degrees(math.atan2(vx, vy)), 3), "src": f"D1 평면 {h}"}
# pads: three nested rectangles per bearing (900 x 850 / 800 x 750 / 700 x 650); front row NO.1-5 = lower y
pads = {}
outer = ["10DB1", "10DAE", "10DAB", "10DA8", "10DA5", "10DA2", "10D9F", "10D9C", "10D99", "10D96"]
for no, h in enumerate(outer, 1):
pads[no] = rect(h)
out["pads_outer"] = pads
# pedestals: parallelograms (x width 1,366.9 along X, 2,600 in Y)
peds = []
for hs in (("104A2", "1049F", "104A0", "104A1"), ("1049A", "10497", "10498", "10499"), ("10492", "1048F", "10490", "10491"),
("1048A", "10487", "10488", "10489"), ("10482", "1047F", "10480", "10481")):
pts = [line(h)[0] for h in hs]
peds.append({"corners": [[round(x - PCX, 1), round(y - PCY, 1)] for x, y in pts], "src": "D1 평면 " + "/".join(hs)})
out["pedestals"] = peds
p = Path(__file__).resolve().parent / "판독" / "g1_values.json"
p.write_text(json.dumps(out, ensure_ascii=False, indent=1), encoding="utf-8")
print(json.dumps({k: v for k, v in out.items() if k not in ("pads_outer", "pedestals")}, ensure_ascii=False))
print({k: (v["centre"], v["along"], v["across"], v["rotation_deg"]) for k, v in pads.items()})
print([p_["corners"] for p_ in peds][:2])