# RevitDevTool vs pyRevit **Two tools, two different audiences.** --- ## Target Audiences ### pyRevit: End-User Automation Platform **Who it's for:** - End users creating Revit automation tools - Building ribbon interfaces for teams - Creating reusable buttons and commands - Focus on pure automation tasks **Strengths:** - Mature ribbon UI framework - Extensive community scripts library - Easy button creation and deployment - Large user base and documentation ### RevitDevTool: Developer & Research Platform **Who it's for:** - Developers building computational design tools - Researchers experimenting with Python algorithms - AI/ML integration with Revit - Data scientists analyzing building data - Prototyping and rapid development **Strengths:** - Modern Python 3.13 with full ecosystem - VSCode debugger integration - Automatic dependency management - Research-friendly (pandas, numpy, scikit-learn) - Computational design workflows --- ## Key Philosophical Differences | Aspect | pyRevit | RevitDevTool | |--------|---------|--------------| | **Primary Goal** | Ribbon automation for end users | Developer tools & research | | **UI Focus** | Ribbon buttons, menus, toolbars | Code execution & debugging | | **Target User** | End users clicking buttons | Developers writing code | | **Workflow** | Deploy → Click → Run | Write → Debug → Iterate | | **Distribution** | Share buttons with teams | Share scripts/libraries | --- ## Python Runtime Comparison ### pyRevit: Multiple Python Options pyRevit offers 3 Python runtime choices, each with trade-offs: **1. IronPython 2.7** (Default) - ✅ Direct .NET integration - ✅ No dependency management needed - ❌ Python 2.7 (obsolete since 2010) - ❌ No modern packages (pandas, numpy) - ❌ Limited ecosystem **2. IronPython 3.4** - ✅ Newer Python syntax - ❌ Still incompatible with CPython packages - ❌ No dependency resolver - ❌ Small ecosystem **3. CPython 3.12** (Experimental) - ✅ Modern Python with full ecosystem - ❌ No automatic dependency resolver - ❌ Module reload bugs (state pollution) - ❌ Requires manual environment setup ### RevitDevTool: CPython 3.13 Single, optimized choice: - ✅ Latest Python 3.13 - ✅ Full CPython ecosystem (pandas, numpy, scikit-learn, etc.) - ✅ Automatic dependency resolution (UV + PEP 723) - ✅ Clean module reload (no state pollution) - ✅ VSCode debugger integration - ❌ Not designed for end-user ribbon deployment --- ## IronPython vs CPython: Quick Overview **IronPython strengths:** - Direct .NET interface implementation - No marshaling overhead for .NET objects - Simpler for pure Revit API automation **IronPython weaknesses:** - Obsolete Python versions (2.7, 3.4) - Incompatible with modern Python packages - Limited ecosystem (no pandas, numpy, scikit-learn) **CPython strengths:** - Modern Python (3.13) - Full ecosystem access - Better for data science, AI/ML, research - Standard Python tooling and debugging **CPython weaknesses:** - Requires PythonNet for .NET interop - Slight marshaling overhead **Verdict:** Use IronPython for simple Revit automation. Use CPython for research, data analysis, and modern development. --- ## Dependency Management ### pyRevit **IronPython (2.7/3.4):** - No dependencies needed (Revit API only) - Can't use pandas, numpy, scikit-learn **CPython (3.12):** - Manual `pip install` required - User manages virtual environments - No automatic conflict resolution - Pre-install before running scripts ### RevitDevTool **CPython (3.13) with PEP 723:** ```python # /// script # dependencies = ["pandas==1.5.3", "numpy>=1.24"] # /// import pandas as pd # Auto-installed on first run ``` - Inline dependency declarations - Automatic installation via UV resolver - Per-script isolation - Zero manual setup --- ## Debugging Experience ### pyRevit **Traditional debugging:** ```python # Option 1: pdb debugger import pdb; pdb.set_trace() # Option 2: Print debugging print("Debug:", walls) ``` - Command-line pdb interface - No IDE integration - Manual stepping through code ### RevitDevTool **Modern VSCode debugging:** 1. Set breakpoints in VSCode (click line margin) 2. Press F5 → Attach to Revit 3. Execute script → Pauses at breakpoints 4. Inspect variables, step through code 5. Use Debug Console for expressions | Feature | RevitDevTool | pyRevit | |---------|--------------|---------| | **VSCode debugger** | ✅ Full support | ❌ Not available | | **Breakpoints** | ✅ Visual in IDE | ❌ No IDE integration | | **Variable inspection** | ✅ VSCode panel | ⚠️ pdb commands | | **Step debugging** | ✅ F10, F11 | ⚠️ pdb only | | **Conditional breakpoints** | ✅ Native | ❌ Manual | **See:** [Python Debugging](CodeExecute-PythonDebugging.md) for complete guide --- ## Use Cases Comparison ### pyRevit Excels At: ✅ **End-user automation:** - Creating ribbon buttons for teams - Deploying automation tools to non-programmers - Building reusable command libraries - Simple Revit API automation ✅ **Community sharing:** - Large script library - Established patterns - Easy deployment ### RevitDevTool Excels At: ✅ **Developer workflows:** - Rapid prototyping with modern Python - Debugging complex algorithms - Iterative development ✅ **Computational design:** - Generative design algorithms - Optimization problems - Custom geometry generation ✅ **Data science & research:** - Building data analysis with pandas - Machine learning integration - Statistical analysis of BIM data - Export to data science formats ✅ **AI/ML integration:** - Using modern Python AI libraries - LLM-assisted development (Copilot works well) - Computer vision with OpenCV - Deep learning with PyTorch/TensorFlow --- ## Real-World Scenarios ### Scenario 1: Simple Automation (Both Work) **Task:** Create button to count walls **pyRevit approach:** ```python # button.pushbutton/script.py from pyrevit import revit from Autodesk.Revit import DB doc = revit.doc walls = DB.FilteredElementCollector(doc).OfClass(DB.Wall).ToElements() print(f"Found {len(walls)} walls") ``` **RevitDevTool approach:** ```python # count_walls.script.py # /// script # dependencies = [] # /// from Autodesk.Revit import DB doc = __revit__.ActiveUIDocument.Document walls = DB.FilteredElementCollector(doc).OfClass(DB.Wall).ToElements() print(f"Found {len(walls)} walls") ``` **Verdict:** pyRevit better (ribbon button for end users) --- ### Scenario 2: Data Analysis (RevitDevTool Better) **Task:** Analyze wall data with pandas, create visualizations **pyRevit:** ```python # Can't use pandas in IronPython 2.7 ❌ # Must use manual data structures # Limited analysis capabilities ``` **RevitDevTool:** ```python # /// script # dependencies = ["pandas==1.5.3", "plotly==5.18.0"] # /// import pandas as pd import plotly.express as px from Autodesk.Revit import DB doc = __revit__.ActiveUIDocument.Document walls = DB.FilteredElementCollector(doc).OfClass(DB.Wall).ToElements() # Use pandas for analysis data = [{"Name": w.Name, "Level": w.LevelName, "Area": w.Area} for w in walls] df = pd.DataFrame(data) # Statistical analysis summary = df.groupby("Level").agg({"Area": ["sum", "mean", "count"]}) print(summary) # Create visualization fig = px.bar(df, x="Level", y="Area", title="Wall Areas by Level") fig.show() # Opens in browser or WebView2 ``` **Verdict:** RevitDevTool better (modern data science stack) --- ### Scenario 3: Machine Learning (RevitDevTool Only) **Task:** Predict element categories using ML **pyRevit:** ```python # scikit-learn not available in IronPython ❌ ``` **RevitDevTool:** ```python # /// script # dependencies = ["scikit-learn==1.3.0", "pandas==1.5.3"] # /// from sklearn.ensemble import RandomForestClassifier import pandas as pd from Autodesk.Revit import DB # Collect training data from Revit doc = __revit__.ActiveUIDocument.Document elements = DB.FilteredElementCollector(doc).WhereElementIsNotElementType().ToElements() # Extract features data = extract_features(elements) df = pd.DataFrame(data) # Train model model = RandomForestClassifier() model.fit(df[features], df["category"]) # Predict on new elements predictions = model.predict(new_data) ``` **Verdict:** RevitDevTool only option --- ## When to Use What ### Use pyRevit if: - ✅ Building automation tools for end users - ✅ Need ribbon buttons and menus - ✅ Deploying to non-programmers - ✅ Simple Revit API automation - ✅ Maintaining existing pyRevit scripts - ✅ Sharing with large pyRevit community ### Use RevitDevTool if: - ✅ Developer/researcher workflow - ✅ Need modern Python ecosystem (pandas, numpy, scikit-learn) - ✅ VSCode debugging required - ✅ Computational design projects - ✅ Data science & analytics - ✅ AI/ML integration - ✅ Rapid prototyping and iteration - ✅ Research and experimentation ### Use Both if: - ✅ pyRevit for end-user deployment - ✅ RevitDevTool for development and research - ✅ Different tools for different workflows --- ## Migration Guide ### From pyRevit to RevitDevTool **Minimal code changes:** ```python # pyRevit from pyrevit import revit doc = revit.doc # RevitDevTool doc = __revit__.ActiveUIDocument.Document ``` **File naming:** ``` pyrevit_script.py → script_name.script.py requirements.txt → # /// script ... dependencies = [...] /// ``` **What stays the same:** - Revit API usage (`DB.Wall`, `FilteredElementCollector`, etc.) - Script logic and structure - External package imports (if using CPython) --- ## Summary | Aspect | pyRevit | RevitDevTool | |--------|---------|--------------| | **Target User** | End users | Developers & researchers | | **Primary Use** | Automation buttons | Code development | | **Python** | IronPython 2.7 (default) | CPython 3.13 | | **Packages** | Limited (Revit API only) | Full ecosystem | | **Debugging** | pdb (command-line) | VSCode (full IDE) | | **Dependencies** | Manual pip | Automatic (PEP 723) | | **Best For** | Ribbon automation | Research & development | **Both are excellent tools for different purposes.** - **pyRevit:** Best automation platform for end users - **RevitDevTool:** Best development platform for researchers and developers Choose based on your audience and workflow. --- ## See Also - **[Python Ecosystems](CodeExecute-PythonEcosystems.md)** - All Python options for Revit - **[Python Debugging](CodeExecute-PythonDebugging.md)** - VSCode debugger guide - **[Python Execution](CodeExecute-PythonExecution.md)** - How Python scripts work - **[Examples](Examples-Dashboard.md)** - Real-world examples --- **External Resources:** - [pyRevit GitHub](https://github.com/pyrevitlabs/pyrevit) - [pyRevit Documentation](https://pyrevitlabs.notion.site/pyrevit/pyRevit-bd907d6292ed4ce997c46e84b6ef67a0)