Files
Pier_v1/Code/검토수정/스크립트/c1_radial_cover.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

65 lines
3.1 KiB
Python

#! python3
# radial centre cover of Ramp-A P3 / P3-1 against the pile / column radius at each height (before = 검토완료, after = 수정5)
import sys, os, json, math, collections, traceback
sys.path.insert(0, r"C:\Users\User\AppData\Local\PierApp\jobs\c1_work")
import Rhino
import Rhino.Geometry as rg
from c1_core import BASE
FILES = {"before": os.path.join(BASE, "Ramp-A교P1", "ramp-A G5_검토완료.3dm"), "after": os.path.join(BASE, "Ramp-A교P1", "ramp-A G5_수정5_20261026.3dm")}
OUT = r"C:\Users\User\AppData\Local\PierApp\jobs\c1_work\c1_radial_cover.json"
# concrete radius by height (from the solids: P1-PL01 r1175 z32752-40252, P1-PL02 r1250 z40252-45452, P1-CL r1000 z45452-57452)
ZONES = [("PL01", 32752.0, 40252.0, 1175.0), ("PL02", 40252.0, 45452.0, 1250.0), ("CL", 45452.0, 57452.0, 1000.0)]
def zone(z):
for n, z0, z1, r in ZONES:
if z0 - 1e-6 <= z <= z1 + 1e-6:
return n, r
return None, None
res = {}
try:
for tag, p in FILES.items():
doc = Rhino.RhinoDoc.OpenHeadless(p)
st = Rhino.DocObjects.ObjectEnumeratorSettings()
st.HiddenObjects = True; st.LockedObjects = True; st.NormalObjects = True
lay = {l.Index: l.FullPath for l in doc.Layers}
bars = collections.defaultdict(list)
for o in doc.Objects.GetObjectList(st):
g = o.Geometry
if isinstance(g, rg.Curve) and "중심선" in lay.get(o.Attributes.LayerIndex, ""):
m = o.Attributes.GetUserString("mark")
if m in ("P3", "P3-1"):
bars[m].append(o)
out = {}
for m, lst in bars.items():
per_zone = collections.defaultdict(lambda: {"bars": set(), "bars_pipe_out": set(), "bars_center_out": set(), "min_cover": 1e9, "worst": None})
for o in lst:
c = o.Geometry
n = max(40, int(c.GetLength() / 10.0))
for t in c.DivideByCount(n, True):
pt = c.PointAt(t)
zn, R = zone(pt.Z)
if zn is None:
continue
cov = R - math.hypot(pt.X, pt.Y)
zr = per_zone[zn]
zr["bars"].add(o.Attributes.Name)
if cov < zr["min_cover"]:
zr["min_cover"] = cov
zr["worst"] = [o.Attributes.Name, round(pt.X), round(pt.Y), round(pt.Z)]
if cov < 8.0:
zr["bars_pipe_out"].add(o.Attributes.Name)
if cov < 0.0:
zr["bars_center_out"].add(o.Attributes.Name)
out[m] = {zn: {"bars": len(v["bars"]), "bars_pipe_sticks_out(cover<8)": len(v["bars_pipe_out"]), "bars_center_outside": len(v["bars_center_out"]),
"min_radial_centre_cover": round(v["min_cover"], 1), "worst": v["worst"]} for zn, v in per_zone.items()}
res[tag] = out
doc.Dispose()
except Exception:
res["error"] = traceback.format_exc()
res["done"] = True
json.dump(res, open(OUT, "w", encoding="utf-8"), ensure_ascii=False, indent=1)