Add Wipe AVF tool#3483
Conversation
|
Nice addition for cleanups @Wurschdhaud thanks |
There was a problem hiding this comment.
Pull request overview
Adds a new pyRevitTools “Wipe AVF” pushbutton under the Project > Wipe pulldown to let users select one or more views and clear their Analysis Visualization Framework (AVF) / SpatialFieldManager data, helping reduce file bloat and mitigate instability caused by orphaned analysis overlays.
Changes:
- Introduces a new
Wipe AVFcommand script that discovers views with an activeSpatialFieldManagerand clears selected ones in a transaction. - Adds a localized
bundle.yaml(title + tooltip) for the new pushbutton.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/Wipe.pulldown/Wipe AVF.pushbutton/script.py | Implements the AVF purge workflow (discover views → select → clear SFM). |
| extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/Wipe.pulldown/Wipe AVF.pushbutton/bundle.yaml | Adds localized UI metadata (title/tooltip) for the new tool. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
PR Summary:
- Adds a new "Wipe AVF" pushbutton under
Wipe.pulldownto clear leftover Analysis Visualization Framework (AVF) data (SpatialFieldManager) from user-selected views. - Scans all views for an active
SpatialFieldManager, lets the user multi-select viaforms.SelectFromList, then callssfm.Clear()per view inside a (defensive) transaction. - Includes multi-language
bundle.yamltitle/tooltip, matching the localization conventions of sibling Wipe tools.
Review Summary:
Reviewed against repo-level guidelines (IPY2.7/IronPython compatibility, Black formatting, PEP8 naming) and compared against sibling tools in Wipe.pulldown for stylistic/UX consistency (e.g. "Purge"-verbiage in dialogs alongside "Wipe" titles is an established pattern here, so no naming inconsistency). Verified via Revit API research that SpatialFieldManager results are RAM-only (so the wrapping transaction is harmless/no-op on the undo stack) and that GetSpatialFieldManager() throws for views lacking AllowsAnalysisDisplay() (sheets/schedules/legends), which query.get_all_views() includes by default — flagged as a performance/code-smell issue since exceptions end up driving control flow for most views in typical projects. Also flagged a small unreachable dead-code branch in main(). No critical bugs, security, or correctness issues found; overall a small, well-scoped, Black-formatted addition consistent with existing Wipe tools.
Description
What
New pushbutton: Purge AVF. Clears SpatialFieldManager data (energy,
structural, MEP analysis overlays, etc.) from user-selected views.
Why
Leftover AVF data from old analysis runs or plugins can bloat the
file or contribute to crashes; this gives a one-click way to clear it
per view without hunting down which views even have an active SFM.
Checklist
Before submitting your pull request, ensure the following requirements are met:
pipenv run black {source_file_or_directory}