Files
CMPlanning/scripts/verify_geom/faces.py
T
Claude 3638249c43 chore(verify): store Step 3 solid-model verification scripts and geometry results
- scripts/verify_solids_step3.py: deterministic checks M1-M6, S1-S2, G1 (9/9 PASS)
- scripts/verify_geom/: independent DXF-vs-STEP section deviation scripts (agent run)
- data/verify_geom_hd2_results.json: Hausdorff results at 4+745, 5+100, 5+470
Judgement: DOC/05_검증/검증_본선3D솔리드모델_2026-10-22_v0.1.00.md (FAIL 3 items to Step 4)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A5Cun3RHQKna9qxE6ybZ4A
2026-10-22 00:51:01 +00:00

43 lines
1.7 KiB
Python

import sys, time, pickle
sys.path += ['/root/.local/lib/python3.13/site-packages','/usr/local/lib/python3.13/dist-packages','/usr/lib/python3/dist-packages']
from build123d import import_step, Face
import numpy as np
shape = import_step("/mnt/user-data/uploads/97.과제/Code/3d-drawing/model/tunnel_solids.step")
solids = shape.solids()
pickle_out = {}
import json
meta=json.load(open('/mnt/user-data/uploads/97.과제/Code/3d-drawing/model/tunnel_solids_meta.json'))
comps=[c for c in meta['components'] if c['group']!='시설한계(참조선)']
print("non-clearance comps", len(comps))
# match by volume greedily in meta order
used=set(); mapping={}
for c in comps:
best=None;bd=1e9
for j,s in enumerate(solids):
if j in used: continue
d=abs(s.volume-c['volume_m3'])
if d<bd: bd=d;best=j
if bd<0.02:
used.add(best); mapping[c['id']]=best
else:
mapping[c['id']]=None
print("matched", sum(v is not None for v in mapping.values()), "of", len(comps), "unused solids", len(solids)-len(used))
print("first 10 mapping", list(mapping.items())[:10])
pickle.dump({'mapping':mapping}, open('/tmp/verify_daesan2_run/mapping.pkl','wb'))
# faces of solid 0 (LIN_01)
for idx in [mapping['LIN_01_P-3']]:
s=solids[idx]
fs=s.faces()
print("solid",idx,"nfaces",len(fs), "vol", round(s.volume,3))
rows=[]
for f in fs:
gt=f.geom_type
c=f.center(); a=f.area
try:
n=f.normal_at(c)
except Exception as ex:
n=None
rows.append((gt, round(a,1), [round(x,3) for x in (c.X,c.Y,c.Z)], None if n is None else [round(x,4) for x in (n.X,n.Y,n.Z)]))
rows.sort(key=lambda r: -r[1])
for r in rows[:25]: print(r)