Sample Code Revit Batch Processor 1.1.16 documentation
Panel: Purge Unused | Menu: Purge
Tools to remove unused graphic styles, patterns, parameters, views and templates from the current model.
Every tool in this menu asks you what to remove before it deletes anything. None of them runs unattended. What differs is how they decide what to offer you.
Try-and-delete tools — Line Styles, Line Patterns, Fill Patterns, Shared Parameters. These attempt to delete each candidate and keep only the deletions Revit accepts; anything still in use is rejected and survives. Each has a plain button that sweeps everything of that kind, and a By Selection twin that runs the same sweep restricted to items you pick.
List-and-choose tools — Filters, Unplaced Legends, Unplaced Schedules, Templates, Unplaced Views. These work out the unused items up front and present that list for you to choose from. There is no By Selection twin because the selection is the tool.
Removes line styles not referenced by any element.
The By Selection variant lists every line style in the model, not just the unused ones — the try-and-delete pass still refuses to remove any that are in use, so a selection that includes used styles is safe, it simply won’t remove them.
Removes fill patterns not used by any material, surface pattern or element override. Same selection behaviour as line styles.
Removes line patterns not used by any line style, grid, level or other element. Same selection behaviour as line styles.
Collects view filters not assigned to any view or view template, then asks which of them to purge.
Collects legend views not placed on any sheet, then asks which to purge.
Collects schedule views not placed on any sheet, then asks which to purge.
Collects view templates not applied to any view, then asks which to purge.
Collects views not placed on any sheet — floor plans, sections, elevations, 3D views — then asks which to purge.
Save or back up the model before purging. Deletions cannot be undone once the file is saved.
The list-and-choose tools show nothing to select when there is nothing unused of that kind; they report so and exit.
Running Revit’s built-in Purge Unused afterwards can free up further items these tools do not target.
These tools cover specific element types. They are not a substitute for a full model audit.