"""Printability check: every part we'd actually PRINT must be a watertight, manifold solid (sliceable).
Reports watertight / winding-consistent / volume / bbox for the printed parts (the servo mesh is NOT
printed, so it's excluded)."""
import glob
import numpy as np
import trimesh

PRINTED = (["wrap_holder.stl", "yoke_exact.stl"] + sorted(glob.glob("so100_bridge_*.stl")))
print(f"{'part':28s} {'watertight':10s} {'winding':8s} {'vol(cm3)':9s} bbox(mm)")
allok = True
for f in PRINTED:
    m = trimesh.load(f, force="mesh")
    wt = m.is_watertight
    wc = m.is_winding_consistent
    allok &= bool(wt)
    vol = m.volume / 1000.0 if wt else float("nan")
    print(f"{f:28s} {str(wt):10s} {str(wc):8s} {vol:8.1f}  {np.round(m.extents,1).tolist()}")
print("ALL PRINTED PARTS WATERTIGHT" if allok else "SOME PARTS NOT WATERTIGHT -> not directly sliceable")
