Skip to content

Debug drawing faster failure search#8228

Open
theoryshaw wants to merge 5 commits into
v0.8.0from
debug-drawing-faster-failure-search
Open

Debug drawing faster failure search#8228
theoryshaw wants to merge 5 commits into
v0.8.0from
debug-drawing-faster-failure-search

Conversation

@theoryshaw

Copy link
Copy Markdown
Member

No description provided.

Parag Debnath and others added 4 commits March 18, 2026 22:17
Fix failure detection by switching from `except Exception` to checking
the return value, then back to `except Exception` once it was confirmed
that `bpy.ops` re-raises inside another operator. Identify the drawing
via the active scene camera (consistent with CreateDrawing) to avoid
the `ifc_definition_id=0` crash on non-drawing list entries.

Improve the binary search to test each candidate in isolation, enabling
multiple independent failures to be found in one pass. Suppress
drawing-generation log noise during tests and print a clean summary
with element id, type, and name.

Add a `should_export_isolated_file` operator property that extracts
the failing elements into a minimal standalone IFC file using
ExtractElements, making it easy to attach a reproduction case when
filing a bug report.

Generated with the assistance of an AI coding tool.
When a drawing fails to generate (e.g. an annotation with a runaway
coordinate that makes project_point_onto_camera return None), surface an
actionable error instead of a raw traceback, and make the search for the
offending element much faster.

drawing/operator.py:
- Wrap CreateDrawing.execute so any failure prints the full traceback
  (still consumed by debug_active_drawing) and reports a clear message
  pointing users at "Search Active Drawing For Failing Elements".
- Add should_generate_underlay/linework/annotation toggles so the
  generation stages can be run independently.

debug/operator.py:
- Detect which stage (underlay/linework/annotation) reproduces the
  failure and bisect with only that stage, skipping the expensive
  underlay render and OpenCASCADE linework on every iteration.
- Add a console spinner (background thread, writes to the real stdout)
  so long silent waits no longer look frozen.
- Include the GlobalId in element labels.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# Conflicts:
#	src/bonsai/bonsai/bim/module/drawing/operator.py
@theoryshaw

Copy link
Copy Markdown
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant