Apr 24, 2024

How to Create IUpdater in Revit with pyRevit (Create Custom Features)

IUpdater (Dynamic Model Update)

Dynamic model update offers the ability for a Revit API application to modify the Revit model as a reaction to changes happening in the model when those changes are about to be committed at the end of a transaction. Revit API applications can create updaters by implementing the IUpdater interface and registering it with the UpdaterRegistry class. Registering includes specifying what changes in the model should trigger the updater.


Resources

Revit API Dev Guide - IUpdater

pyRevit doc-updater


Create pyRevit Hook


Hook Base

# -*- coding: utf-8 -*-

#⬇️ Imports
from datetime import datetime
from Autodesk.Revit.DB import (BuiltInCategory,
                               BuiltInParameter,
                               UnitUtils,
                               UnitTypeId,
                               ElementId,
                               WorksharingUtils,
                               FamilyInstance)

#📦 Variables
sender = __eventsender__
args   = __eventargs__

doc = args.GetDocument()

#👉 Get ElementIds for Modified/Deleted/New
modified_el_ids = args.GetModifiedElementIds()
deleted_el_ids  = args.GetDeletedElementIds()
new_el_ids      = args.GetAddedElementIds()

modified_el = [doc.GetElement(e_id) for e_id in modified_el_ids]


Feature #1: Track Coordinates


Feature #2: Track LastEdited Timestamp + Name


Feature #3: Track Mirrored Windows and Doors


Error: Third-Party IUpdater not Registered

Solution: How to get rid of the the Error





Want to Learn More?

🔥 Amazing Revit API Resources!

Join Revit API

Newsletter Today!

Join Us!

which is already read by 5000+ people!

Get short Revit API Lessons and Tips directly in your mail!