Skip to content

Latest commit

Β 

History

History
313 lines (205 loc) Β· 10.7 KB

File metadata and controls

313 lines (205 loc) Β· 10.7 KB

RevitDevTool

Comprehensive developer toolkit for Autodesk Revit with code execution, visualization, and logging.

RevitVersion Badge Badge Badge Badge

🎯 Why RevitDevTool?

For developers and researchers who need:

  • 🐍 Modern Python - CPython 3.13 with full ecosystem (pandas, numpy, scikit-learn, AI/ML libraries)
  • πŸ› VSCode Debugging - Set breakpoints, step through code, inspect Revit API objects
  • πŸ“¦ Zero-friction dependencies - Declare packages inline, auto-install with UV (10-15x faster than pip)
  • 🎨 3D Visualization - Render geometry directly in Revit view (no model elements)
  • πŸ“Š Real-time logging - Color-coded output with stack traces and JSON formatting

Not another Revit add-in loader. RevitDevTool is a complete development environment focused on rapid prototyping, computational design, and data science workflows.


🎬 See It In Action

Python Debugging with VSCode

Set breakpoints, inspect variables, step through Revit API calls in real-time.

Python Debugger

β†’ Python Debugging Guide


Automatic Dependency Management

Declare packages inline. System auto-installs. No manual pip, no venv setup.

Python Dependency Resolve

# /// script
# dependencies = ["pandas==2.1.0", "numpy>=1.24"]
# ///

import pandas as pd
from Autodesk.Revit import DB

doc = __revit__.ActiveUIDocument.Document
walls = DB.FilteredElementCollector(doc).OfClass(DB.Wall)

data = [{"Name": w.Name, "Area": w.Area} for w in walls]
df = pd.DataFrame(data)
print(df.groupby("Level").agg({"Area": ["sum", "mean"]}))

β†’ Python Execution Guide


Real-time Logging with Stack Traces

Monitor output with color coding, JSON formatting, and Python stack traces.

Monitor Logging

Stack Trace

β†’ Logging Guide


3D Geometry Visualization

Render curves, faces, solids directly in Revit view without creating model elements.

Geometry Visualization

# Pick edge, visualize automatically
ref = uidoc.Selection.PickObject(ObjectType.Edge)
edge = elem.GetGeometryObjectFromReference(ref)
print(edge)  # Renders in 3D view

β†’ Visualization Guide


⚑ Quick Start

1. Install

Download and run the MSI installer from Releases.

2. Write Your First Script

Create hello.script.py:

# /// script
# dependencies = []
# ///

from Autodesk.Revit import DB

doc = __revit__.ActiveUIDocument.Document
walls = DB.FilteredElementCollector(doc).OfClass(DB.Wall)

print(f"Found {walls.GetElementCount()} walls")

3. Execute

  1. Open RevitDevTool panel in Revit
  2. Load folder containing your script
  3. Click Execute
  4. See output in Trace panel

β†’ Complete Getting Started Guide


🌟 Key Features

🐍 Python Execution

  • CPython 3.13 - Latest Python with full ecosystem access
  • PEP 723 inline dependencies - No separate requirements.txt
  • UV resolver - Automatic package installation (10-15x faster than pip)
  • VSCode debugger - Full IDE debugging with breakpoints
  • Module isolation - Clean cache between runs
  • Type stubs - Full Revit API autocomplete in IDE

πŸ”§ .NET Execution

  • IExternalCommand discovery - Automatic command detection
  • FileWatcher - Auto-reload on assembly changes
  • Dependency loading - All DLLs loaded automatically
  • No temp folder - Direct execution for Revit 2024- (.NET 4.8)

πŸ“Š Logging System

  • Multi-source capture - Trace, Console, Debug, Python print
  • Syntax highlighting - Automatic color coding by keywords
  • JSON formatting - Pretty-print with syntax highlighting
  • Stack traces - Python exception formatting with file links
  • Geometry interception - Auto-visualize printed geometry

🎨 Visualization

  • DirectContext3D - Transient rendering (no model elements)
  • Multiple geometry types - Curves, faces, solids, meshes, points, bounding boxes
  • Thread-safe - Buffered rendering from any thread
  • Performance optimized - Caching and batch updates

πŸ†š Comparisons

vs pyRevit

Aspect RevitDevTool pyRevit
Target User Developers & researchers End users
Python CPython 3.13 IronPython 2.7 (default)
Packages Full ecosystem (pandas, numpy, AI/ML) Limited (Revit API only)
Dependencies Automatic (PEP 723 + UV) Manual pip install
Debugging VSCode (full IDE) pdb (command-line)
Best For Development, research, data science Ribbon automation for teams

β†’ Detailed Comparison

Python Ecosystem Options

Tool Python Auto-dependencies VSCode Debugger Best For
pyRevit IronPython 2.7 ❌ ❌ End-user automation
Dynamo CPython 3.9 ❌ ❌ Visual programming
RevitDevTool CPython 3.13 βœ… UV βœ… debugpy Development & research

β†’ Complete Ecosystem Analysis


πŸ“¦ Installation

Requirements

  • Autodesk Revit 2022-2026
  • Windows 10/11

Install Steps

  1. Download MSI installer from Releases
  2. Run installer (admin rights required)
  3. Launch Revit
  4. Find RevitDevTool in External Tools ribbon

β†’ Installation Guide


πŸ“– Examples

Python

source/RevitDevTool.PythonDemo/

  • dashboard_script.py - Production BIM dashboard
  • data_analysis_script.py - Polars data analysis
  • visualization_curve_script.py - 3D geometry rendering
  • logging_format_script.py - Log formatting examples
  • sklearn_script.py - ML with scikit-learn
  • shapely_script.py - Geometric operations
  • trimesh_script.py - 3D mesh processing

.NET

source/RevitDevTool.DotnetDemo/

  • Logging: logging sample with stack trace and JSON formatting.
  • Geometry: visualized geometry sample.

β†’ All Examples


πŸ› οΈ Building from Source

Prerequisites

  • .NET 10.0 SDK

Build Steps

git clone https://github.com/trgiangv/RevitDevTool.git
cd RevitDevTool

# Restore and build for Revit 2025
dotnet restore
dotnet build RevitDevTool.sln -c "Release R25"

Available configurations: Release R22, Release R23, Release R24, Release R25, Release R26


🀝 Contributing

Contributions welcome! Here's how to get started:

  1. Read architecture docs - docs/ for module you're modifying
  2. Follow design patterns - Provider, Strategy, Composite patterns
  3. Add tests - Demo scripts or unit tests
  4. Update docs - Architecture docs + Wiki if user-facing

β†’ GitHub Discussions for ideas β†’ GitHub Issues for bugs


πŸ™ Acknowledgments

Built on the shoulders of giants:


πŸ“œ License

MIT License - see LICENSE for details.


πŸ’¬ Get Help


Made with ❀️ for the Revit developer community ⭐ Star this repo if you find it useful!