Skip to content
Truong Giang Vu edited this page Feb 17, 2026 · 7 revisions

RevitDevTool Documentation

Comprehensive developer toolkit for Autodesk Revit (2022-2026) with code execution, visualization, and logging capabilities.

RevitDevTool Ribbon


⚑ 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


πŸ“š Core Modules

RevitDevTool consists of three modules working together to provide a complete development environment within Revit:

🐍 CodeExecute

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 β€’ Python Runtime β€’ Python Debugging


πŸ“Š Logging

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 β€’ Color Keywords


🎨 Visualization

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 β€’ Geometry Types


πŸ”„ How Modules Work Together

Dockable Panel

flowchart TD
    UI[User Interaction<br/>Execute script, visualize geometry, view logs]
    
    UI --> CE[CodeExecute Module<br/>β€’ Discovers Python scripts and .NET assemblies<br/>β€’ Manages dependencies PEP 723<br/>β€’ Executes code in Revit context]
    
    CE --> Output[Code execution output]
    
    Output --> Logging[Logging Module<br/>β€’ Captures output<br/>β€’ Applies themes<br/>β€’ Routes to sinks]
    
    Output --> Viz[Visualization Module<br/>β€’ Renders 3D<br/>β€’ DirectContext3D<br/>β€’ Buffer management]
    
    Logging <-->|Geometry?| Viz
    
    Logging --> TracePanel[Trace Panel<br/>with colors]
    Viz --> View3D[3D View<br/>with geometry]
Loading

πŸ’‘ Complete Example

Python script with all three modules:

# /// 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


🎯 Common Tasks

I want to... Go to...
Execute a Python script CodeExecute Overview
Auto-install dependencies Python Runtime
Debug Python with VSCode Python Debugging
Compare Python options Python Ecosystems
See trace output with colors Logging Overview
Visualize geometry in 3D Visualization Overview
Format JSON output Logging Overview
Use Python stack traces Python Stack Traces
Generate type stubs Stub Generation
Understand .NET execution .NET Runtime
Compare vs pyRevit vs pyRevit

πŸ“š Documentation Pages

Module Documentation

Comparisons

Reference


πŸ—οΈ Architecture Documentation

For developers contributing to RevitDevTool, see architecture documentation in the main repository:


πŸ› οΈ 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
  2. Run the MSI installer
  3. Launch Revit (2022-2026)
  4. Open the RevitDevTool panel from External Tools ribbon

πŸ”— Links


πŸ“œ License

MIT License - See LICENSE in main repository.

Clone this wiki locally