# RevitDevTool Documentation **Comprehensive developer toolkit for Autodesk Revit (2022-2026) with code execution, visualization, and logging capabilities.** ![RevitDevTool Ribbon](images/RevitDevTool_Ribbon.png) --- ## ⚡ Quick Start **Essential shortcuts for rapid development:** - **Press `AD`** → Re-run last script + show Trace Panel - **Ctrl + Click** Trace Panel button → Toggle panel visibility - **F5 in VSCode** → Attach debugger for breakpoint debugging **Basic workflow:** ``` 1. Click script in CodeExecute → First execution 2. Edit code in your IDE 3. Press AD → See updated results 4. Repeat steps 2-3 for rapid iteration ``` **Debugging workflow:** ``` 1. Set breakpoints in VSCode 2. Press F5 → Attach to Revit Python 3. Execute script in RevitDevTool 4. Debugger pauses at breakpoints 5. Inspect variables, step through code ``` **💡 Tip:** Use `AD` shortcut for rapid iteration during development! **🐛 Debug Status:** Check the indicator in Trace panel toolbar: - 🔴 Red dot = Debugger not connected - 🟢 Green dot = VSCode debugger attached --- ## ⚙️ Settings Access RevitDevTool settings from the dockable panel to configure themes, logging, visualization, and code execution behavior: ![General Settings](images/RevitDevTool_GeneralSettings.png) --- ## 📚 Core Modules RevitDevTool consists of three modules working together to provide a complete development environment within Revit: ### 🐍 [CodeExecute](CodeExecute-Overview.md) **Multi-language code execution framework** - Execute Python 3.13 scripts with CPython + PythonNet3 - Automatic dependency management with PEP 723 metadata - **VSCode debugger integration** with breakpoints and variable inspection - .NET hot-reload (no temp folder copying) - File watcher for instant reload - Hierarchical tree organization **Use when:** You need to run custom scripts or commands in Revit with automatic dependency installation. **Learn more:** [CodeExecute Overview](CodeExecute-Overview.md) • [Python Runtime](CodeExecute-PythonExecution.md) • [Python Debugging](CodeExecute-PythonExecution.md#part-5-python-debugging-with-vscode) --- ### 📊 [Logging](Logging-Overview.md) **Unified logging infrastructure** - Multi-sink output (UI RichTextBox + File logging) - Revit context enrichment (version, document, user info) - Filter keywords for log level detection - Pretty JSON output and WPF trace support - Syntax highlighting with keyword detection - Geometry interception → automatic visualization - Python stack trace formatting **Use when:** You need structured logging with visual feedback and geometry visualization. **Learn more:** [Logging Overview](Logging-Overview.md) • [Color Keywords](Logging-ColorKeywords.md) --- ### 🎨 [Visualization](Visualization-Overview.md) **Real-time 3D geometry rendering** - DirectContext3D transient rendering (no model elements) - Support for curves, faces, solids, meshes, points, bounding boxes - Thread-safe buffering - Performance optimization with caching - Transparent rendering **Use when:** You need to visualize geometry without creating model elements. **Learn more:** [Visualization Overview](Visualization-Overview.md) • [Geometry Types](Visualization-GeometryTypes.md) --- ## 🔄 How Modules Work Together ![Dockable Panel](images/RevitDevTool_Dockpanel.png) ```mermaid flowchart TD UI[User Interaction
Execute script, visualize geometry, view logs] UI --> CE[CodeExecute Module
• Discovers Python scripts and .NET assemblies
• Manages dependencies PEP 723
• Executes code in Revit context] CE --> Output[Code execution output] Output --> Logging[Logging Module
• Captures output
• Applies themes
• Routes to sinks] Output --> Viz[Visualization Module
• Renders 3D
• DirectContext3D
• Buffer management] Logging <-->|Geometry?| Viz Logging --> TracePanel[Trace Panel
with colors] Viz --> View3D[3D View
with geometry] ``` --- ## 💡 Complete Example **Python script with all three modules:** ```python # /// script # dependencies = ["polars==1.38.1"] # /// import polars as pl from Autodesk.Revit.DB import FilteredElementCollector, Wall # CodeExecute: Manages dependencies and execution doc = __revit__.ActiveUIDocument.Document walls = FilteredElementCollector(doc).OfClass(Wall).ToElements() # Logging: Captures and displays output print(f"Found {len(list(walls))} walls") # Visualization: Renders geometry in 3D view for wall in walls: curve = wall.Location.Curve print(curve) # Geometry automatically visualized print("Analysis complete ✓") ``` **What happens:** 1. **CodeExecute** discovers script, installs polars, executes code 2. **Logging** captures print() calls → Trace panel with syntax highlighting 3. **Logging** intercepts print(geometry) → routes to Visualization 4. **Visualization** renders curves in 3D via DirectContext3D 5. User sees both text output and visual output **More examples:** [Examples Overview](Examples-Overview.md) - [Data Analysis](Examples-DataAnalysis.md) - Collect → analyze → visualize - [Curve Visualization](Examples-VisualizationCurves.md) - Pick & display curves - [Logging Format](Examples-LoggingFormat.md) - Syntax highlighting tests - [Python Dashboard](Examples-Dashboard.md) - WebView2 dashboard with charts (PythonDemo) --- ## 🎯 Common Tasks | I want to... | Go to... | |-------------|----------| | Execute a Python script | [CodeExecute Overview](CodeExecute-Overview.md) | | Auto-install dependencies | [Python Runtime](CodeExecute-PythonExecution.md) | | Debug Python with VSCode | [Python Debugging](CodeExecute-PythonExecution.md#part-5-python-debugging-with-vscode) | | Compare Python options | [Python Ecosystems](CodeExecute-PythonEcosystems.md) | | See trace output with colors | [Logging Overview](Logging-Overview.md) | | Visualize geometry in 3D | [Visualization Overview](Visualization-Overview.md) | | Format JSON output | [Logging Overview](Logging-Overview.md#pretty-json-output) | | Use Python stack traces | [Python Stack Traces](Logging-PythonStackTraces.md) | | Generate type stubs | [Stub Generation](CodeExecute-StubGeneration.md) | | Understand .NET execution | [.NET Runtime](CodeExecute-DotNetExecution.md) | | Compare vs pyRevit | [vs pyRevit](CodeExecute-VsPyRevit.md) | --- ## 📚 Documentation Pages ### Module Documentation - **[CodeExecute](CodeExecute-Overview.md)** - Python & .NET execution - **[Logging](Logging-Overview.md)** - Logging system - **[Visualization](Visualization-Overview.md)** - Geometry visualization ### Comparisons - **[vs pyRevit](CodeExecute-VsPyRevit.md)** - Python execution comparison - **[Python Ecosystems](CodeExecute-PythonEcosystems.md)** - IronPython vs CPython vs PythonNet3 ### Reference --- ## 🏗️ Architecture Documentation For developers contributing to RevitDevTool, see architecture documentation in the main repository: - **[Architecture Overview](https://github.com/trgiangv/RevitDevTool/tree/master/docs)** - **[CodeExecute Architecture](https://github.com/trgiangv/RevitDevTool/tree/master/docs/CodeExecute/architecture)** - **[Logging Architecture](https://github.com/trgiangv/RevitDevTool/tree/master/docs/Logging/architecture)** - **[Visualization Architecture](https://github.com/trgiangv/RevitDevTool/tree/master/docs/Visualization/architecture)** --- ## 🛠️ Language Support RevitDevTool works with multiple programming languages: - **Python 3.13** - Full support via CPython + PythonNet3 - **C#** - Full support through .NET Trace API - **IronPython** - Legacy support for pyRevit/RevitPythonShell scripts - **Any .NET Language** - F#, VB.NET, etc. --- ## 📦 Installation 1. **Download** the latest release from [GitHub Releases](https://github.com/trgiangv/RevitDevTool/releases) 2. **Run** the MSI installer 3. **Launch** Revit (2022-2026) 4. **Open** the RevitDevTool panel from External Tools ribbon --- ## 🔗 Links - **Main Repository:** [RevitDevTool](https://github.com/trgiangv/RevitDevTool) - **Issues:** [Report bugs or request features](https://github.com/trgiangv/RevitDevTool/issues) - **Discussions:** [Ask questions](https://github.com/trgiangv/RevitDevTool/discussions) --- ## 📜 License MIT License - See [LICENSE](https://github.com/trgiangv/RevitDevTool/blob/master/LICENSE) in main repository.