- 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>
171 lines
7.4 KiB
Python
171 lines
7.4 KiB
Python
#! python3
|
|
# Footing shear / vertical bars of Sanoe and Okseong (user approved 2026-10-26):
|
|
# Okseong B9 (H19 C-tie): both hook tails lengthened so the centre-line length = material-table L (design_length)
|
|
# Sanoe B7 (H13 vertical): both ends moved so the hooks wrap the outermost main bars (bottom 132.5, top 2414.5 above footing bottom)
|
|
# Sanoe B9, B10 (H16 straight + 90deg hooks): tails lengthened to the material-table L
|
|
# Sources: ..._수정2_20261026.3dm -> saved as ..._수정3_20261026.3dm (new names)
|
|
import sys, os, json, math, collections, traceback
|
|
sys.path.insert(0, r"C:\Users\User\AppData\Local\PierApp\jobs\c1_work")
|
|
import c1_core
|
|
import Rhino
|
|
from Rhino.Geometry import Arc, ArcCurve, LineCurve, PolyCurve, Point3d, Vector3d
|
|
from c1_core import BASE, make_pipe, _retarget
|
|
|
|
DATE_TXT = "2026-10-26"
|
|
OUT = r"C:\Users\User\AppData\Local\PierApp\jobs\c1_work\c1_shear_fix.json"
|
|
JOBS = {
|
|
"sanoe": {"src": os.path.join(BASE, "검토_산외교P1", "산외교P1 G5_수정2_20261026.3dm"),
|
|
"dst": os.path.join(BASE, "검토_산외교P1", "산외교P1 G5_수정3_20261026.3dm"),
|
|
"marks": {"B7": "wrap", "B9": "tails_to_L", "B10": "tails_to_L"},
|
|
"note": "footing shear bars: B7 ends wrap outer main bars (132.5 / 2414.5), B9,B10 tails to schedule L"},
|
|
"okseong": {"src": os.path.join(BASE, "검토_옥성교P1", "옥성교P1_G5_수정2_20261026.3dm"),
|
|
"dst": os.path.join(BASE, "검토_옥성교P1", "옥성교P1_G5_수정3_20261026.3dm"),
|
|
"marks": {"B9": "tails_to_L"},
|
|
"note": "footing C-tie B9: hook tails lengthened to schedule L 4763"},
|
|
}
|
|
BOT_Z, TOP_Z = 132.5, 2414.5 # Sanoe B7 end heights (outer bottom 150 - 11 - 6.5, outer top 2400 + 8 + 6.5)
|
|
res = {}
|
|
|
|
|
|
def tails_to_L(c, L):
|
|
"""lengthen first and last (straight) segments so the total length equals L"""
|
|
n = c.SegmentCount
|
|
segs = [c.SegmentCurve(i).DuplicateCurve() for i in range(n)]
|
|
delta = (L - c.GetLength()) / 2.0
|
|
if delta <= 0 or not (segs[0].IsLinear() and segs[-1].IsLinear()):
|
|
return None, delta
|
|
d0 = segs[0].PointAtEnd - segs[0].PointAtStart
|
|
d0.Unitize()
|
|
dN = segs[-1].PointAtEnd - segs[-1].PointAtStart
|
|
dN.Unitize()
|
|
segs[0] = _retarget(segs[0], start=segs[0].PointAtStart - d0 * delta)
|
|
segs[-1] = _retarget(segs[-1], end=segs[-1].PointAtEnd + dN * delta)
|
|
pc = PolyCurve()
|
|
for s in segs:
|
|
pc.Append(s)
|
|
return pc, delta
|
|
|
|
|
|
def wrap_ends(c, fbot):
|
|
"""Sanoe B7: rebuild 5 segments (tail, arc, vertical, arc, tail) with new end heights"""
|
|
if c.SegmentCount != 5:
|
|
return None
|
|
s = [c.SegmentCurve(i) for i in range(5)]
|
|
if not (s[0].IsLinear() and s[2].IsLinear() and s[4].IsLinear()):
|
|
return None
|
|
ok1, a1 = s[1].TryGetArc()
|
|
ok2, a2 = s[3].TryGetArc()
|
|
if not (ok1 and ok2):
|
|
return None
|
|
R = a1.Radius
|
|
tail = s[0].GetLength()
|
|
v0 = s[2].PointAtStart
|
|
base = Point3d(v0.X, v0.Y, 0)
|
|
u = s[0].PointAtStart - Point3d(v0.X, v0.Y, s[0].PointAtStart.Z)
|
|
u.Z = 0
|
|
u.Unitize()
|
|
zb, zt = fbot + BOT_Z, fbot + TOP_Z
|
|
P = lambda off, z: Point3d(base.X + u.X * off, base.Y + u.Y * off, z)
|
|
z_up = Vector3d(0, 0, 1)
|
|
segs = [LineCurve(P(R + tail, zb), P(R, zb)),
|
|
ArcCurve(Arc(P(R, zb), -u, P(0, zb + R))),
|
|
LineCurve(P(0, zb + R), P(0, zt - R)),
|
|
ArcCurve(Arc(P(0, zt - R), z_up, P(R, zt))),
|
|
LineCurve(P(R, zt), P(R + tail, zt))]
|
|
pc = PolyCurve()
|
|
for g in segs:
|
|
pc.Append(g)
|
|
return pc
|
|
|
|
|
|
def run_one(key, job):
|
|
r = {}
|
|
doc = Rhino.RhinoDoc.OpenHeadless(job["src"])
|
|
tol = doc.ModelAbsoluteTolerance
|
|
st = Rhino.DocObjects.ObjectEnumeratorSettings()
|
|
st.HiddenObjects = True
|
|
st.LockedObjects = True
|
|
st.NormalObjects = True
|
|
lay = {l.Index: l.FullPath for l in doc.Layers}
|
|
r["objects_before"] = doc.Objects.Count
|
|
fbot = [o for o in doc.Objects.GetObjectList(st) if o.Attributes.Name == "P1-FT"][0].Geometry.GetBoundingBox(True).Min.Z
|
|
breps = collections.defaultdict(list)
|
|
curves = []
|
|
for o in doc.Objects.GetObjectList(st):
|
|
g = o.Geometry
|
|
L = lay.get(o.Attributes.LayerIndex, "")
|
|
if isinstance(g, Rhino.Geometry.Brep) and "철근" in L:
|
|
breps[o.Attributes.Name].append(o)
|
|
elif isinstance(g, Rhino.Geometry.Curve) and "중심선" in L and o.Attributes.GetUserString("mark") in job["marks"]:
|
|
curves.append(o)
|
|
stat = collections.Counter()
|
|
info = collections.defaultdict(lambda: {"len_old": None, "len_new": None, "tail_new": None, "z": None})
|
|
for o in curves:
|
|
a = o.Attributes
|
|
m = a.GetUserString("mark")
|
|
mode = job["marks"][m]
|
|
d = int("".join(ch for ch in a.GetUserString("dia") if ch.isdigit()))
|
|
c = o.Geometry
|
|
nb = breps.get(a.Name.replace("-RC-", "-R-"), [])
|
|
if len(nb) != 1 or not isinstance(c, PolyCurve):
|
|
stat[m + "_unexpected"] += 1
|
|
continue
|
|
if mode == "tails_to_L":
|
|
Ltab = float(a.GetUserString("design_length"))
|
|
pc, delta = tails_to_L(c, Ltab)
|
|
note = "tails +%.1f each -> L %.0f" % (delta, Ltab)
|
|
else:
|
|
z0, z1 = c.GetBoundingBox(True).Min.Z - fbot, c.GetBoundingBox(True).Max.Z - fbot
|
|
if abs(z0 - 166.0) > 0.6 or abs(z1 - 2384.0) > 0.6:
|
|
stat[m + "_unexpected_z"] += 1
|
|
continue
|
|
pc = wrap_ends(c, fbot)
|
|
note = "ends wrap outer main bars: bottom %.1f top %.1f" % (BOT_Z, TOP_Z)
|
|
if pc is None:
|
|
stat[m + "_cannot_rebuild"] += 1
|
|
continue
|
|
pipes = make_pipe(pc, d, tol)
|
|
if not pipes or len(pipes) != 1 or not pipes[0].IsSolid:
|
|
stat[m + "_pipe_fail"] += 1
|
|
continue
|
|
vol = Rhino.Geometry.VolumeMassProperties.Compute(pipes[0]).Volume
|
|
if abs(vol / (math.pi * (d / 2.0) ** 2 * pc.GetLength()) - 1.0) > 0.002:
|
|
stat[m + "_volume_off"] += 1
|
|
continue
|
|
cid, bid = o.Id, nb[0].Id
|
|
if not (doc.Objects.Replace(cid, pc) and doc.Objects.Replace(bid, pipes[0])):
|
|
stat[m + "_replace_failed"] += 1
|
|
continue
|
|
for oid in (cid, bid):
|
|
ro = doc.Objects.FindId(oid)
|
|
at = ro.Attributes.Duplicate()
|
|
at.SetUserString("shear_fix", note + " (" + DATE_TXT + ", user approved)")
|
|
doc.Objects.ModifyAttributes(ro, at, True)
|
|
i = info[m]
|
|
i["len_old"] = round(c.GetLength(), 2)
|
|
i["len_new"] = round(pc.GetLength(), 2)
|
|
i["tail_new"] = round(pc.SegmentCurve(0).GetLength(), 2)
|
|
bb = pc.GetBoundingBox(True)
|
|
i["z"] = [round(bb.Min.Z - fbot, 2), round(bb.Max.Z - fbot, 2)]
|
|
stat[m + "_done"] += 1
|
|
r["stat"] = dict(stat)
|
|
r["sample"] = dict(info)
|
|
doc.Strings.SetString("수정일", DATE_TXT)
|
|
prev = doc.Strings.GetValue("수정내용") or ""
|
|
doc.Strings.SetString("수정내용", (prev + " | " if prev else "") + job["note"])
|
|
r["objects_after"] = doc.Objects.Count
|
|
r["saved"] = bool(doc.WriteFile(job["dst"], Rhino.FileIO.FileWriteOptions()))
|
|
r["out"] = job["dst"]
|
|
doc.Dispose()
|
|
return r
|
|
|
|
|
|
for key, job in JOBS.items():
|
|
try:
|
|
res[key] = run_one(key, job)
|
|
except Exception:
|
|
res[key] = {"error": traceback.format_exc()}
|
|
json.dump(res, open(OUT, "w", encoding="utf-8"), ensure_ascii=False, indent=1)
|
|
res["done"] = True
|
|
json.dump(res, open(OUT, "w", encoding="utf-8"), ensure_ascii=False, indent=1)
|