fix: add try/except + debug logging around sandbox extraction
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -138,3 +138,4 @@ docs/generated/
|
||||
|
||||
# Malformed filenames (Windows path used as filename)
|
||||
C:*
|
||||
*.gitmodules
|
||||
|
||||
@@ -490,23 +490,39 @@ def main():
|
||||
# Extract each sandbox
|
||||
for sandbox_id, body, face in sandbox_entries:
|
||||
lister.WriteLine(f"\n--- Extracting {sandbox_id} ---")
|
||||
geom = extract_sandbox_geometry(
|
||||
face=face,
|
||||
body=body,
|
||||
sandbox_id=sandbox_id,
|
||||
lister=lister,
|
||||
chord_tol_mm=0.1,
|
||||
)
|
||||
try:
|
||||
# Debug: print face info
|
||||
lister.WriteLine(f"[extract_sandbox] Face type: {type(face).__name__}")
|
||||
try:
|
||||
loops = face.GetLoops()
|
||||
lister.WriteLine(f"[extract_sandbox] Loops: {len(loops)}")
|
||||
for li, loop in enumerate(loops):
|
||||
edges = loop.GetEdges()
|
||||
lister.WriteLine(f"[extract_sandbox] Loop {li}: {len(edges)} edges")
|
||||
except Exception as exc:
|
||||
lister.WriteLine(f"[extract_sandbox] GetLoops failed: {exc}")
|
||||
|
||||
out_path = os.path.join(output_dir, f"geometry_{sandbox_id}.json")
|
||||
with open(out_path, "w") as f:
|
||||
json.dump(geom, f, indent=2)
|
||||
lister.WriteLine(f"[extract_sandbox] Wrote: {out_path}")
|
||||
geom = extract_sandbox_geometry(
|
||||
face=face,
|
||||
body=body,
|
||||
sandbox_id=sandbox_id,
|
||||
lister=lister,
|
||||
chord_tol_mm=0.1,
|
||||
)
|
||||
|
||||
# Summary
|
||||
lister.WriteLine(f" outer_boundary: {len(geom['outer_boundary'])} points")
|
||||
lister.WriteLine(f" inner_boundaries: {geom['num_inner_boundaries']}")
|
||||
lister.WriteLine(f" thickness: {geom['thickness']}")
|
||||
out_path = os.path.join(output_dir, f"geometry_{sandbox_id}.json")
|
||||
with open(out_path, "w") as f:
|
||||
json.dump(geom, f, indent=2)
|
||||
lister.WriteLine(f"[extract_sandbox] Wrote: {out_path}")
|
||||
|
||||
# Summary
|
||||
lister.WriteLine(f" outer_boundary: {len(geom['outer_boundary'])} points")
|
||||
lister.WriteLine(f" inner_boundaries: {geom['num_inner_boundaries']}")
|
||||
lister.WriteLine(f" thickness: {geom['thickness']}")
|
||||
except Exception as exc:
|
||||
import traceback
|
||||
lister.WriteLine(f"[extract_sandbox] ERROR extracting {sandbox_id}: {exc}")
|
||||
lister.WriteLine(traceback.format_exc())
|
||||
|
||||
lister.WriteLine("\n" + "=" * 60)
|
||||
lister.WriteLine(f" Done — {len(sandbox_entries)} sandbox(es) exported")
|
||||
|
||||
Reference in New Issue
Block a user