# erikfrits/ef-tools architecture

> Architecture diagram of the GitHub repository erikfrits/ef-tools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/erikfrits/ef-tools
- Repository: https://github.com/erikfrits/ef-tools

## Overview

#### 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_Tools.tab/Sheets.panel/col1.stack/EF_SheetGenerator.pushbutton/script.py`](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Sheets.panel/col1.stack/EF_SheetGenerator.pushbutton/script.py) (Command entry points), [`lib/Snippets/_context_manager.py`](https://github.com/erikfrits/ef-tools/blob/main/lib/Snippets/_context_manager.py) (Transaction helpers), [`EF_Tools.tab/Naming.panel/col1.stack/Rename.pulldown/FindReplace - Views.pushbutton/script.py`](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Naming.panel/col1.stack/Rename.pulldown/FindReplace%20-%20Views.pushbutton/script.py) (Naming and maintenance), [`EF_Tools.tab/Views.panel/Column1.stack/PlansGenerator.pulldown/CreateWorksetViews.pushbutton/script.py`](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Views.panel/Column1.stack/PlansGenerator.pulldown/CreateWorksetViews.pushbutton/script.py) (View generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["pyRevit Runtime"]
  node_extension_manifest["Extension manifest<br/>pyRevit metadata<br/>[extension.json]"]
  node_ribbon_hierarchy["Ribbon hierarchy<br/>pyRevit bundles<br/>[bundle.yaml]"]
  node_command_entries["Command entry points<br/>Python scripts<br/>[script.py]"]
  node_revit_api[("Revit document and UI<br/>Revit API")]
end

subgraph group_shared["Shared Library"]
  node_wpf_base["WPF UI base<br/>shared UI<br/>[WPF_Base.py]"]
  node_selection["Selection utilities<br/>shared selection<br/>[super_select.py]"]
  node_transactions["Transaction helpers<br/>shared Revit utility"]
  node_renaming["Renaming abstraction<br/>shared naming"]
end

subgraph group_commands["Ribbon Command Domains"]
  node_element_tools["Element transformations<br/>model-write commands<br/>[script.py]"]
  node_region_to_floors["Region-to-floor conversion<br/>model-write command<br/>[script.py]"]
  node_material_replacement["Material replacement<br/>model-write command<br/>[script.py]"]
  node_naming_maintenance["Naming and maintenance<br/>document management<br/>[script.py]"]
  node_purge_templates["Template purge<br/>maintenance command<br/>[script.py]"]
  node_view_generation["View generation<br/>production commands<br/>[script.py]"]
  node_view_filter_copy["View filter copy<br/>view command<br/>[script.py]"]
  node_sheet_production["Sheet production<br/>production commands<br/>[script.py]"]
end

subgraph group_boundaries["User and File Boundaries"]
  node_dialogs["WPF dialogs<br/>user input<br/>[SelectFromDict.py]"]
  node_dwg_io["DWG import/export<br/>external file commands<br/>[script.py]"]
  node_dwg_dialog["DWG selection dialog<br/>XAML UI<br/>[Script.xaml]"]
end

node_extension_manifest -->|"loads"| node_ribbon_hierarchy
node_ribbon_hierarchy -->|"discovers"| node_command_entries
node_command_entries -.->|"uses"| node_selection
node_command_entries -.->|"uses"| node_wpf_base
node_command_entries -->|"reads and updates"| node_revit_api
node_element_tools -.->|"wraps writes"| node_transactions
node_region_to_floors -.->|"wraps writes"| node_transactions
node_material_replacement -.->|"wraps writes"| node_transactions
node_transactions -->|"commits changes"| node_revit_api
node_naming_maintenance -->|"uses"| node_renaming
node_naming_maintenance -->|"manages entities"| node_revit_api
node_purge_templates -->|"removes templates"| node_revit_api
node_view_generation -->|"creates views and templates"| node_revit_api
node_view_filter_copy -->|"copies filter artifacts"| node_revit_api
node_view_generation -->|"supplies generated views"| node_sheet_production
node_sheet_production -->|"composes sheets and revisions"| node_revit_api
node_dialogs -->|"built on"| node_wpf_base
node_dialogs -.->|"provides user choices"| node_command_entries
node_dwg_dialog -->|"selects source files"| node_dwg_io
node_dwg_io -->|"opens or exports"| node_revit_api

click node_extension_manifest "https://github.com/erikfrits/ef-tools/blob/main/extension.json"
click node_ribbon_hierarchy "https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/bundle.yaml"
click node_command_entries "https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Sheets.panel/col1.stack/EF_SheetGenerator.pushbutton/script.py"
click node_wpf_base "https://github.com/erikfrits/ef-tools/blob/main/lib/GUI/WPF_Base.py"
click node_selection "https://github.com/erikfrits/ef-tools/blob/main/lib/Selection/super_select.py"
click node_transactions "https://github.com/erikfrits/ef-tools/blob/main/lib/Snippets/_context_manager.py"
click node_renaming "https://github.com/erikfrits/ef-tools/blob/main/lib/Renaming/BaseClass_FindReplace.py"
click node_element_tools "https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Elements.panel/col1.stack/ElementsRotateMultiple.pushbutton/script.py"
click node_region_to_floors "https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Elements.panel/col1.stack/FilledRegions.pulldown/RegionsToFloors.pushbutton/script.py"
click node_material_replacement "https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Elements.panel/col2.stack/MaterialsAndOverrides.pulldown/ReplaceMaterials.pushbutton/script.py"
click node_naming_maintenance "https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Naming.panel/col1.stack/Rename.pulldown/FindReplace%20-%20Views.pushbutton/script.py"
click node_purge_templates "https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Maintenance.panel/col1.stack/Purge.pulldown/PurgeViewTemplates.pushbutton/script.py"
click node_view_generation "https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Views.panel/Column1.stack/PlansGenerator.pulldown/CreateWorksetViews.pushbutton/script.py"
click node_view_filter_copy "https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Views.panel/Column2.stack/ViewFilters.pulldown/ViewFiltersCopy.pushbutton/script.py"
click node_sheet_production "https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Sheets.panel/col1.stack/place_views_on_new_sheets.pushbutton/script.py"
click node_dialogs "https://github.com/erikfrits/ef-tools/blob/main/lib/GUI/SelectFromDict.py"
click node_dwg_io "https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/DWG.panel/col1.stack/save_DWGs.pushbutton/script.py"
click node_dwg_dialog "https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/DWG.panel/col1.stack/open_selected_dwg.pushbutton/Script.xaml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_extension_manifest,node_ribbon_hierarchy,node_command_entries,node_revit_api toneBlue
class node_wpf_base,node_selection,node_transactions,node_renaming toneAmber
class node_element_tools,node_region_to_floors,node_material_replacement,node_naming_maintenance,node_purge_templates,node_view_generation,node_view_filter_copy,node_sheet_production toneMint
class node_dialogs,node_dwg_io,node_dwg_dialog toneRose
```

## Components

### pyRevit Runtime

- [Extension manifest](https://github.com/erikfrits/ef-tools/blob/main/extension.json): pyRevit metadata · Registers the EF-Tools extension. · `extension.json`
- [Ribbon hierarchy](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/bundle.yaml): pyRevit bundles · Folder structure defines tabs, panels, and command presentation. · `EF_Tools.tab/bundle.yaml`
- [Command entry points](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Sheets.panel/col1.stack/EF_SheetGenerator.pushbutton/script.py): Python scripts · Each pushbutton script is independently invoked by pyRevit. · `EF_Tools.tab/Sheets.panel/col1.stack/EF_SheetGenerator.pushbutton/script.py`
- **Revit document and UI**: Revit API · Active document is the central model read/write target.

### Shared Library

- [WPF UI base](https://github.com/erikfrits/ef-tools/blob/main/lib/GUI/WPF_Base.py): shared UI · `lib/GUI/WPF_Base.py`
- [Selection utilities](https://github.com/erikfrits/ef-tools/blob/main/lib/Selection/super_select.py): shared selection · `lib/Selection/super_select.py`
- [Transaction helpers](https://github.com/erikfrits/ef-tools/blob/main/lib/Snippets/_context_manager.py): shared Revit utility · Supports safe document modifications. · `lib/Snippets/_context_manager.py`
- [Renaming abstraction](https://github.com/erikfrits/ef-tools/blob/main/lib/Renaming/BaseClass_FindReplace.py): shared naming · `lib/Renaming/BaseClass_FindReplace.py`

### Ribbon Command Domains

- [Element transformations](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Elements.panel/col1.stack/ElementsRotateMultiple.pushbutton/script.py): model-write commands · Edits geometry, regions, materials, rooms, and groups. · `EF_Tools.tab/Elements.panel/col1.stack/ElementsRotateMultiple.pushbutton/script.py`
- [Region-to-floor conversion](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Elements.panel/col1.stack/FilledRegions.pulldown/RegionsToFloors.pushbutton/script.py): model-write command · `EF_Tools.tab/Elements.panel/col1.stack/FilledRegions.pulldown/RegionsToFloors.pushbutton/script.py`
- [Material replacement](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Elements.panel/col2.stack/MaterialsAndOverrides.pulldown/ReplaceMaterials.pushbutton/script.py): model-write command · `EF_Tools.tab/Elements.panel/col2.stack/MaterialsAndOverrides.pulldown/ReplaceMaterials.pushbutton/script.py`
- [Naming and maintenance](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Naming.panel/col1.stack/Rename.pulldown/FindReplace%20-%20Views.pushbutton/script.py): document management · Renames, numbers, audits, and purges document entities. · `EF_Tools.tab/Naming.panel/col1.stack/Rename.pulldown/FindReplace - Views.pushbutton/script.py`
- [Template purge](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Maintenance.panel/col1.stack/Purge.pulldown/PurgeViewTemplates.pushbutton/script.py): maintenance command · `EF_Tools.tab/Maintenance.panel/col1.stack/Purge.pulldown/PurgeViewTemplates.pushbutton/script.py`
- [View generation](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Views.panel/Column1.stack/PlansGenerator.pulldown/CreateWorksetViews.pushbutton/script.py): production commands · Creates views, templates, filters, and graphics artifacts. · `EF_Tools.tab/Views.panel/Column1.stack/PlansGenerator.pulldown/CreateWorksetViews.pushbutton/script.py`
- [View filter copy](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Views.panel/Column2.stack/ViewFilters.pulldown/ViewFiltersCopy.pushbutton/script.py): view command · `EF_Tools.tab/Views.panel/Column2.stack/ViewFilters.pulldown/ViewFiltersCopy.pushbutton/script.py`
- [Sheet production](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/Sheets.panel/col1.stack/place_views_on_new_sheets.pushbutton/script.py): production commands · 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](https://github.com/erikfrits/ef-tools/blob/main/lib/GUI/SelectFromDict.py): user input · Commands collect choices and report results through WPF. · `lib/GUI/SelectFromDict.py`
- [DWG import/export](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/DWG.panel/col1.stack/save_DWGs.pushbutton/script.py): external file commands · Opens selected DWGs or saves DWG output. · `EF_Tools.tab/DWG.panel/col1.stack/save_DWGs.pushbutton/script.py`
- [DWG selection dialog](https://github.com/erikfrits/ef-tools/blob/main/EF_Tools.tab/DWG.panel/col1.stack/open_selected_dwg.pushbutton/Script.xaml): XAML UI · `EF_Tools.tab/DWG.panel/col1.stack/open_selected_dwg.pushbutton/Script.xaml`

## Connections

- 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
