Developer & BIM Engineer Track

PyRevit

Supercharging Autodesk Revit with Python

Arrow keys to navigate  ·  S speaker notes  ·  F fullscreen

PyRevit logo

About the Speaker

Roman Golev
01 / What is PyRevit

What is PyRevit?

Background, architecture, and why it matters.

RAD Tool

Rapid Application Development
for Autodesk Revit

🌳

Born in Portland, OR

Created by Ehsan Iran-Nejad
in Portland, Oregon

💡

Inspired by RPS

Built on ideas from
RevitPythonShell

The Problem with Revit Add-ins

Traditional Revit customisation requires a .NET add-in:

Typical workflow

  • Write C# / VB.NET
  • Add Revit API references
  • Compile → .dll
  • Copy to add-ins folder
  • Restart Revit
  • Test → find bug → repeat
Typical cycle time: 3–10 min per iteration.
For a small script this is unsustainable.
No REPL. You cannot run a one-liner against a live Revit document.

Why pyRevit?

  • Rapid Application Development toolkit for Revit
  • Scripts run inside the Revit process — no restart needed
  • Supports IronPython 2.7 & CPython 3.x (via pyrevitlib)
  • Rich helper library on top of the raw Revit API
  • Private tooling distribution

Key stats

  • GitHub stars
  • 200+ built-in tools out of the box
  • GPL v3 licensed

Who uses it?

AEC firms, BIM Managers, and a growing open-source community sharing extensions via GitHub.

Architecture Overview

Autodesk Revit (host process)
Revit API (.NET)
PyRevit Engine (IronPython / CPython)
pyrevitlib — DB, UI, forms, hooks, script
Your script.py

Key Concepts

ConceptWhat it isAnalogy
Extension A folder that defines a ribbon tab with panels & buttons VS Code extension
Button (pushbutton) A .pushbutton folder containing script.py npm script
Hook Python file that fires on a Revit event (open, save, sync…) git hook
Library A .lib extension that exposes shared Python modules shared package
02 / Installation & Setup

Installation & Setup

Two paths: GUI installer or CLI.

Executable

Latest release: v6.1.0

CLI

# Install via Chocolatey
choco install pyrevit-cli

# Clone & attach to Revit
pyrevit clone default
pyrevit attach default 2024

# Verify
pyrevit clones

Ideal for CI/CD & team deployments.

03 / Built-in Tools & Extensions

Built-in Tools & Extensions

What ships in the box.

pyRevitTools.extension

The default extension ships 200+ tools organised into panels:

Drawing Set

Batch Sheet Maker, Rename Selected Sheets, Rename Selected Views, Keynotes

Analysis & Inspection

Color Splasher, Lines Per View Counter, Preflight Checks, Find Monitored Links

Selection & Modify

Set Workset, Match, Flip, ReNumber, Tag All in All Views

All tools are open source — great learning resource. Read any script at %APPDATA%\pyRevit-Master\extensions\pyRevitTools.extension

Community Extensions

Install any Git-hosted extension with one command:

# Install a community library extension
pyrevit extend lib MyTools https://github.com/yourorg/my-pyrevit-tools.git

# List all installed extensions
pyrevit extensions

# Update all extensions
pyrevit update

Notable community extensions

  • PyRevitPlus (Gui Talarico)
  • PyRevitMEP (Cyril Waechter)
  • pyApex (Aleksey Melnikov)
Each team member runs the same install command and gets identical tools — zero file-sharing friction.
04 / Building Custom Tools

Building Custom Tools

From folder structure to shipping.

Extension Folder Structure

MyTools.extension/
├── MyTools.tab/                  ← Ribbon tab
│   └── Sheets.panel/             ← Ribbon panel
│       ├── RenameSheets.pushbutton/
│       │   ├── script.py         ← Main script
│       │   ├── icon.png          ← 32×32 button icon (optional)
│       │   └── bundle.yaml       ← Metadata (optional)
│       └── SheetIndex.pushbutton/
│           └── script.py
└── lib/                          ← Shared Python modules
    └── myutils.py
Folder names are the button labels. Register via PyRevit Settings → Custom Extension Directories or CLI: pyrevit extend ui MyTools /path/to/MyTools.extension

Bundle Anatomy

Every button in the ribbon is a bundle — a folder with a specific suffix:

Suffix Type
.pushbutton Single command button
.pulldown Dropdown menu
.splitbutton Split button (default + dropdown)
.stack Stacked small buttons (2–3)
.panel Ribbon panel group
.tab Ribbon tab
# bundle.yaml
title: Rename Sheets
tooltip: >
  Batch rename sheets by
  find & replace pattern
author: Roman Golev
highlight: new
context: zero-doc
engines:
  - iron-python-27
  - cpython-385

bundle.yaml controls tooltip, author, engine, and button behavior.

Script Example

import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory, BuiltInParameter

doc = __revit__.ActiveUIDocument.Document

walls = FilteredElementCollector(doc) \
    .OfCategory(BuiltInCategory.OST_Walls) \
    .WhereElementIsNotElementType() \
    .ToElements()

for wall in walls:
    vol_param = wall.get_Parameter(BuiltInParameter.HOST_VOLUME_COMPUTED)
    if vol_param:
        vol_ft3 = vol_param.AsDouble()
        vol_m3 = vol_ft3 * 0.0283168
        print("{0}: {1:.3f} m3".format(
            wall.get_Parameter(BuiltInParameter.ELEM_TYPE_PARAM).AsValueString(),
            vol_m3
        ))

pyRevit forms Module

Rich UI dialogs without writing WPF / XAML:

from pyrevit import forms

# Simple alert
forms.alert("Operation complete!")

# Yes / No confirmation
if forms.alert("Delete elements?",
               yes=True, no=True):
    # proceed with deletion
    pass

# Text input
text = forms.ask_for_string(
    prompt="Enter prefix:",
    default="XX-"
)
from pyrevit import forms, revit, DB

# Select from a list
selected = forms.SelectFromList.show(
    ["Option A", "Option B", "Option C"],
    title="Choose option",
    multiselect=True
)

# Select Revit elements
doc = revit.doc
sheets = DB.FilteredElementCollector(doc)\
    .OfClass(DB.ViewSheet).ToElements()

picked = forms.SelectFromList.show(
    sorted(sheets, key=lambda s: s.SheetNumber),
    title="Pick sheets",
    multiselect=True,
    name_attr="Name"
)

Transactions

Standard transaction

from pyrevit import revit, DB

with revit.Transaction("Set Parameter"):
    elem.LookupParameter("Comments") \
        .Set("Reviewed")

Auto-commits on success; rolls back on any exception.

Transaction Group

from pyrevit import revit

with revit.TransactionGroup("Batch Ops"):
    with revit.Transaction("Step 1"):
        wall.get_Parameter(
            DB.BuiltInParameter.ALL_MODEL_MARK
        ).Set("A")

    with revit.Transaction("Step 2"):
        wall.get_Parameter(
            DB.BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS
        ).Set("Updated")

Groups multiple transactions into one undo operation in Revit.

Demo

Extension Builder

Scaffold extensions visually — download ready-to-use folder structures.

builder.pyrevitlabs.io

PyRevit Builder logo

Prompt Engineering for pyRevit

Use AI to generate scripts — provide context for better results:

## Task
Write a pyRevit script that calculates and prints the volume
of all walls in the active Revit document.

## Environment
- Autodesk Revit 2025
- pyRevit (latest)
- IronPython 2.7 (IPY27)

## Requirements
- Calculate the total volume of all walls in the project
- Print the result as a single sum in both cubic meters and cubic feet

Agent: OpenCode or any AI coding assistant

Magic Keys

Hold modifier keys when clicking any pyRevit button:

Modifier Action
Shift + Click Alternate / Config Script
Alt + Click Show script in Explorer
Ctrl + Click Debug Mode
Ctrl + Alt + Shift + Click Reload Engine
Win + Shift + Click Button Context Menu

Resources

Key Takeaways

  • PyRevit turns Revit into a scriptable platform — no C# required
  • Hot-reload means seconds per iteration, not minutes
  • The forms module eliminates WPF boilerplate for 80 % of UI needs
  • Event hooks let you enforce model standards automatically
  • Git-based distribution makes team rollout trivially reproducible

Contributors

pyRevit contributors
github.com/pyrevitlabs/pyRevit opencollective.com/pyrevitlabs

pyRevit is a free, open-source project driven by community contributions. Whether it's code, documentation, bug reports, or financial support — every contribution helps keep the project alive and growing.

Thank you

Questions?

github.com/pyrevitlabs/pyRevit

Slides built with Reveal.js 5 & Bun  ·  Dark theme & code blocks: JetBrains Mono + Monokai