How erikfrits/ef-tools works
Purpose and runtime
EF-Tools is a pyRevit extension for Autodesk Revit 2019–2023. It exposes 50+ focused ribbon commands for editing, generating, auditing, naming, and managing Revit model/document data. Python runs inside pyRevit/Revit, calling the Revit API; XAML supplies WPF dialogs where interactive input is needed.
Extension entry and command discovery
pyRevit discovers the extension from extension.json, then maps the ribbon hierarchy under EF_Tools.tab/ into Revit tabs, panels, stacks, pulldowns, and pushbuttons. Each *.pushbutton/script.py is an independently invokable command entry point; folder names define presentation and grouping.
• extension.json
• EF_Tools.tab/bundle.yaml
• EF_Tools.tab/Sheets.panel/col1.stack/EF_SheetGenerator.pushbutton/script.py
Shared library boundary
Reusable behavior is centralized in lib/, separating command-facing scripts from shared UI, selection, renaming, and Revit API utility code. Commands should consume these modules rather than duplicate cross-cutting selection, filtering, geometry, transaction, or UI patterns.
• lib/GUI/WPF_Base.py
• lib/Selection/super_select.py
• lib/Snippets/_context_manager.py
Model-element transformation tools
The Elements area contains commands that mutate model geometry and parameters: rotation; walls; filled-region splitting/merging/conversion; rooms-to-elements; material replacement; group operations. These form a key document-write boundary and should execute Revit modifications transactionally.
• EF_Tools.tab/Elements.panel/col1.stack/ElementsRotateMultiple.pushbutton/script.py
• EF_Tools.tab/Elements.panel/col1.stack/FilledRegions.pulldown/RegionsToFloors.pushbutton/script.py
• EF_Tools.tab/Elements.panel/col2.stack/MaterialsAndOverrides.pulldown/ReplaceMaterials.pushbutton/script.py
Document organization and maintenance
Naming and maintenance commands manage names, numbering, warnings, and cleanup of document-level entities such as views, sheets, materials, types, filters, templates, and levels. Rename commands share a dedicated renaming abstraction; maintenance commands operate on potentially broad document scopes.
• lib/Renaming/BaseClass_FindReplace.py
• EF_Tools.tab/Naming.panel/col1.stack/Rename.pulldown/FindReplace - Views.pushbutton/script.py
• EF_Tools.tab/Maintenance.panel/col1.stack/Purge.pulldown/PurgeViewTemplates.pushbutton/script.py
View and sheet production pipeline
View-generation commands create or duplicate plans, sections, workset views, graphics/filter artifacts, and templates. Sheet commands then create sheets, place/align views, duplicate sheets, and manage revisions. This is the main production flow: source model/views → generated views/templates → composed sheets/revision state.
• EF_Tools.tab/Views.panel/Column1.stack/PlansGenerator.pulldown/CreateWorksetViews.pushbutton/script.py
• EF_Tools.tab/Views.panel/Column2.stack/ViewFilters.pulldown/ViewFiltersCopy.pushbutton/script.py
• EF_Tools.tab/Sheets.panel/col1.stack/place_views_on_new_sheets.pushbutton/script.py
Interaction, reporting, and external boundaries
Commands obtain user context through Revit selection and WPF dialogs, then report or update the active Revit document/UI. DWG commands are the notable external-file boundary: they open selected DWGs or save/export DWGs. No server, database, or web-service infrastructure is evident.
• EF_Tools.tab/DWG.panel/col1.stack/open_selected_dwg.pushbutton/Script.xaml
• EF_Tools.tab/DWG.panel/col1.stack/save_DWGs.pushbutton/script.py
• lib/GUI/SelectFromDict.py
Main entry points: EF_SheetGenerator.pushbutton/script.py Command entry points · _context_manager.py Transaction helpers · FindReplace - Views.pushbutton/script.py Naming and maintenance · CreateWorksetViews.pushbutton/script.py View generation
Components 19
pyRevit Runtime
- Extension manifest · Registers the EF-Tools extension.
extension.json - Ribbon hierarchy · Folder structure defines tabs, panels, and command presentation.
EF_Tools.tab/bundle.yaml - Command entry points · Each pushbutton script is independently invoked by pyRevit.
EF_Tools.tab/Sheets.panel/col1.stack/EF_SheetGenerator.pushbutton/script.py - Revit document and UI · Active document is the central model read/write target.
Shared Library
- WPF UI base
lib/GUI/WPF_Base.py - Selection utilities
lib/Selection/super_select.py - Transaction helpers · Supports safe document modifications.
lib/Snippets/_context_manager.py - Renaming abstraction
lib/Renaming/BaseClass_FindReplace.py
Ribbon Command Domains
- Element transformations · Edits geometry, regions, materials, rooms, and groups.
EF_Tools.tab/Elements.panel/col1.stack/ElementsRotateMultiple.pushbutton/script.py - Region-to-floor conversion
EF_Tools.tab/Elements.panel/col1.stack/FilledRegions.pulldown/RegionsToFloors.pushbutton/script.py - Material replacement
EF_Tools.tab/Elements.panel/col2.stack/MaterialsAndOverrides.pulldown/ReplaceMaterials.pushbutton/script.py - Naming and maintenance · Renames, numbers, audits, and purges document entities.
EF_Tools.tab/Naming.panel/col1.stack/Rename.pulldown/FindReplace - Views.pushbutton/script.py - Template purge
EF_Tools.tab/Maintenance.panel/col1.stack/Purge.pulldown/PurgeViewTemplates.pushbutton/script.py - View generation · Creates views, templates, filters, and graphics artifacts.
EF_Tools.tab/Views.panel/Column1.stack/PlansGenerator.pulldown/CreateWorksetViews.pushbutton/script.py - View filter copy
EF_Tools.tab/Views.panel/Column2.stack/ViewFilters.pulldown/ViewFiltersCopy.pushbutton/script.py - Sheet production · Creates sheets and places, aligns, or duplicates views.
EF_Tools.tab/Sheets.panel/col1.stack/place_views_on_new_sheets.pushbutton/script.py
User and File Boundaries
- WPF dialogs · Commands collect choices and report results through WPF.
lib/GUI/SelectFromDict.py - DWG import/export · Opens selected DWGs or saves DWG output.
EF_Tools.tab/DWG.panel/col1.stack/save_DWGs.pushbutton/script.py - DWG selection dialog
EF_Tools.tab/DWG.panel/col1.stack/open_selected_dwg.pushbutton/Script.xaml
Connections 20
- Extension manifest → Ribbon hierarchy: loads
- Ribbon hierarchy → Command entry points: discovers
- Command entry points → Selection utilities: uses
- Command entry points → WPF UI base: uses
- Command entry points → Revit document and UI: reads and updates
- Element transformations → Transaction helpers: wraps writes
- Region-to-floor conversion → Transaction helpers: wraps writes
- Material replacement → Transaction helpers: wraps writes
- Transaction helpers → Revit document and UI: commits changes
- Naming and maintenance → Renaming abstraction: uses
- Naming and maintenance → Revit document and UI: manages entities
- Template purge → Revit document and UI: removes templates
- View generation → Revit document and UI: creates views and templates
- View filter copy → Revit document and UI: copies filter artifacts
- View generation → Sheet production: supplies generated views
- Sheet production → Revit document and UI: composes sheets and revisions
- WPF dialogs → WPF UI base: built on
- WPF dialogs → Command entry points: provides user choices
- DWG selection dialog → DWG import/export: selects source files
- DWG import/export → Revit document and UI: opens or exports