Files
Pier_v1/Code/새재1교P1판독/extract_g2.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

49 lines
3.1 KiB
Python

"""Saejae-1 P1 column rebar reading (G2: P1~P5) -> 판독/g2_values.json.
Sheet 구조도(1) front view: column CL x 225532, z = drawing y - 10329.7 (footing bottom y 20361.7 = EL 10.032, top y 22961.7).
The column is drawn broken (cut symbol), so only 42 hoop lines are drawn; the dimension chains give all levels:
'띠철근외측' 100 | 1.300 | 4@300 | 18@150 | 36@300 | 9@300 | 4@300 | 2.375 | 125 (= 22.500 from the footing bottom, 72 hoops),
'크로스타이' 100 | 950 | 600 | 7@300 | 15@600 | 14@300 | 2@600 | 4.225 | 125 (= 22.500, 40 levels).
Sheet 구조도(2) sections: bar symbols on r 975 (P1, 49) and 930 (P2, 49), hoop arcs r 997.5, ties through the centre.
"""
import json
import math
from collections import Counter
from pathlib import Path
from dxftools import entities
CX, ZO = 225532.0, -10329.7
out = {}
drawn = sorted({round(e.dxf.start.y + ZO, 1) for e in entities("D1", CX - 1500, 14000, CX + 1500, 36000, "CS-RBAR")
if e.dxftype() == "LINE" and abs(e.dxf.start.y - e.dxf.end.y) < 0.5 and abs(abs(e.dxf.start.x - e.dxf.end.x) - 1950) < 1})
out["hoops_drawn"] = {"count": len(drawn), "levels": drawn}
sec = [(268681, 23662), (260729, 23598), (290798, 33491), (283884, 33520), (276837, 33398)]
secs = []
for cx, cy in sec:
ins = [e for e in entities("D1", cx - 1300, cy - 1300, cx + 1300, cy + 1300, "CS-RBAR") if e.dxftype() == "INSERT"]
rr = Counter(round(math.hypot(e.dxf.insert.x - cx, e.dxf.insert.y - cy) / 2.5) * 2.5 for e in ins)
ang = sorted(round(math.degrees(math.atan2(e.dxf.insert.y - cy, e.dxf.insert.x - cx)) % 360, 2) for e in ins if abs(math.hypot(e.dxf.insert.x - cx, e.dxf.insert.y - cy) - 975) < 5)
secs.append({"centre": [cx, cy], "rings": {str(r): n for r, n in rr.most_common(2)}, "angle_pitch": round(360 / 49, 3),
"n_outer": len(ang)})
out["sections"] = secs
out["section_ties"] = {"x_line": [267684.3 - 268681, 269678.7 - 268681], "y_offset": 25.0, "length": 1994.4, "hoop_arc_r": 997.5}
B = 10032.0
hoops = [B + 100 + 1300]
for n, p in ((4, 300), (18, 150), (36, 300), (9, 300), (4, 300)):
hoops += [hoops[-1] + p * k for k in range(1, n + 1)]
ties = [B + 100 + 950]
ties += [ties[-1] + 600]
for n, p in ((7, 300), (15, 600), (14, 300), (2, 600)):
ties += [ties[-1] + p * k for k in range(1, n + 1)]
out["hoops_chain"], out["ties_chain"] = hoops, ties
out["hoop_zones"] = [["P3", 5], ["P4", 18], ["P3", 36], ["P4", 9], ["P3", 4]]
drawn_set = {round(z, 1) for z in drawn}
out["check"] = {"n_hoops": len(hoops), "n_tie_levels": len(ties), "hoops_end_to_coping_top": B + 22375 + 125,
"drawn_subset_of_chain": all(any(abs(d - h) < 0.6 for h in hoops) for d in drawn if d < 15500),
"drawn_beyond_break_not_on_chain": [d for d in drawn if d >= 15500 and not any(abs(d - h) < 0.6 for h in hoops)][:12]}
p = Path(__file__).resolve().parent / "판독" / "g2_values.json"
p.write_text(json.dumps(out, ensure_ascii=False, indent=1), encoding="utf-8")
print(json.dumps({k: out[k] for k in ("section_ties", "check")}, ensure_ascii=False), hoops[:3], hoops[-2:], ties[:3], ties[-2:])
print([s["rings"] for s in secs])