Skip to content

Add Wipe AVF tool#3483

Open
Wurschdhaud wants to merge 3 commits into
pyrevitlabs:developfrom
Wurschdhaud:add-wipe-purge-avf-helper
Open

Add Wipe AVF tool#3483
Wurschdhaud wants to merge 3 commits into
pyrevitlabs:developfrom
Wurschdhaud:add-wipe-purge-avf-helper

Conversation

@Wurschdhaud

Copy link
Copy Markdown
Contributor

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:

  • Code follows the PEP 8 style guide.
  • Code has been formatted with Black using the command:
    pipenv run black {source_file_or_directory}
  • Changes are tested and verified to work as expected.

@jmcouffin
jmcouffin requested a review from Copilot July 10, 2026 18:45
@jmcouffin jmcouffin added the Tools Issues related to pyRevit commands [subsystem] label Jul 10, 2026
@jmcouffin

Copy link
Copy Markdown
Contributor

Nice addition for cleanups @Wurschdhaud thanks

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AVF command script that discovers views with an active SpatialFieldManager and 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>

@devloai devloai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary:

  • Adds a new "Wipe AVF" pushbutton under Wipe.pulldown to clear leftover Analysis Visualization Framework (AVF) data (SpatialFieldManager) from user-selected views.
  • Scans all views for an active SpatialFieldManager, lets the user multi-select via forms.SelectFromList, then calls sfm.Clear() per view inside a (defensive) transaction.
  • Includes multi-language bundle.yaml title/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.

Suggestions

  • Pre-filter views with view.AllowsAnalysisDisplay() before calling GetSpatialFieldManager() to avoid exception-driven control flow. Apply
  • Remove the unreachable if not sfm dead-code branch in main(). Apply

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

Labels

Tools Issues related to pyRevit commands [subsystem]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants