LearnRevitAPI
![](https://framerusercontent.com/images/zMFB840Y52OLteloUT4BRuogE.png)
![](https://framerusercontent.com/images/U9zjOvD4k3m6cIJd5bOiu960DeI.png)
Apr 25, 2024
How to use IUpdater?
![](https://framerusercontent.com/images/Sd5FTaxiqzG7oeH1ykV6yypUzXo.png?scale-down-to=512)
It's time to cover IUpdater on the channel!
It's a very requested feature, and it offers a lot! We can literally create a lot of new functionality in Revit, as it allows us to add certain code to every change that happens in our projects.
So, whenever you move an element, we can make additional changes, and it's huge!
💡Watch this video to learn more about it, or read it briefly here.
![](https://framerusercontent.com/images/jA0CSxti5xhnMkgJTgCKeSak9c.png)
Dynamic Model Update
DMU (Dynamic Model Update) provides an ability to monitor for changes and inject additional changes when they happen. And to do that we need to use the IUpdater Interface
This is an incredibly powerful feature, because we can create a lot of new features in Revit that we thought were not possible before.
e.g.:
- Track Element Coordinates
- Write Timestamps and Names when elements were modified
- Report Mirror state of Doors
There is literally infinite possibilities what we can do with it.
And it's not a rocket science to do that, but you should certainly be very careful with what you do, as it might affect your team at scale.
pyRevit + IUpdater
IUpdater involves a lot of steps to create it, but luckily pyRevit simplifies it for us.
However, I would still recommend you to go through Revit API Developer's Guide and read more about it here.
But I will show you how to create it simple with pyRevit hooks.
Create IUpdater hook
Creating hooks in pyRevit is very easy. We just need to create hooks folder in the root of our pyRevit extension where we have the .tab and lib folders.
-YourExtension.extension
- hooks
- .tab
- lib
Then we need to create a python file with the correct name. You can learn more about possible names here, but for IUpdater we need to create a script named doc-updater.py
doc-updater.py
The syntax in this file will be a little different, because we are dealing with an event. Therefore, we have to work with EventSender and EvenetArguments.
Here is a base script you can use to get doc variable and lists of Modified/Deleted/New Element Ids.
![](https://framerusercontent.com/images/SYtJzGfNkty2AgC9lHtSswzlA.png)
Now we can dive deeper and add a few new features. I will iterate through all modified elements and check if they are in the list of allowed categories (Windows, Doors) and if they have a class of FamilyInstance.
You can introduce your own checks here, but this is what I will be working with in my tutorial.
![](https://framerusercontent.com/images/2CcWiHRruzRGZAhPZ4QnWofdNOQ.png)
Now let's go through these features that I want to add.
Feature #1 - Track Coordinates
First of all I want to report the origin coordinates in Meters. This is very simple; every time our WIndows or Doors are marked as modified, we will look at Location.Point coordinates, convert them to meters and write the results to one of the parameters.
![](https://framerusercontent.com/images/oiYEHXvOsyfs2tl6g2nBh2Zij0.png)
Feature #2 - Write Timestamp + Name
Also I want to add a timestamp and the name of the user who made the change. This is fairly simple to do, and you can see the code here:
![](https://framerusercontent.com/images/xSS18EbS5dpXtGibey4xXwiuI.png)
Feature #3 - IsMirrored
Lastly, We will check if Window/Door is mirrored or not, because it's important to know when you want to order them correctly.
And it couldn't be easier than that:
![](https://framerusercontent.com/images/5sqXjU6RsxtzJRGzw4eBQzLuIKM.png)
Final Code
We didn't need a lot of code to add 3 new features to Revit:
- Track Coordinates
- Add Timestamps and Usernames
- Report Mirror State
And here is the final code:
![](https://framerusercontent.com/images/rio8yPJfz0Pg25T4UeVAdYLiUM.png)
😉Make sure you watch the whole video to see it in action
Join Newsletter
📩 You will be added to Revit API Newsletter
Join Us!
which is already read by 6700+ people!
![](https://framerusercontent.com/images/svHzzMLtnnRCxtCUwbgAm6CUeB8.jpg)
![](https://framerusercontent.com/images/Y44kwhY0i7q37LzXUjrlxeGUo.jpg)
![](https://framerusercontent.com/images/lqKYmh8rqwZwgY2C9MSQER6iBCI.jpg)
![](https://framerusercontent.com/images/SyGCvJ3dbHsJEyklWWBhweY.jpg)
![](https://framerusercontent.com/images/DwiaUdmQHs3FVdDH2PXwAr0Y.jpg)