IUpdater detects modified elements but not added or deleted elements

Hello,
I’m trying to implement an IUpdater in my pyRevit extension. I followed Erik Frits’s tutorial - How to Create IUpdater in Revit with pyRevit (Create Custom Features)
The tutorial works well for detecting modified elements, but I’m having trouble detecting added and deleted elements.

In my test, the updater is successfully triggered when I modify a wall. I can see that:

  • GetModifiedElementIds() returns the modified wall ID.

  • The message Modified: 1 is printed.

  • A custom parameter (TEST) is successfully updated to "ModifiedElement".

However, when I:

  • create a new wall, or

  • delete an existing wall,

the updater does not appear to detect those actions. GetAddedElementIds() and GetDeletedElementIds() are always empty.

For testing, I’m using the following code:


from Autodesk.Revit.DB import (
    BuiltInCategory,
    ElementId
)

sender = __eventsender__
args = __eventargs__

doc = args.GetDocument()

modified_el_ids = args.GetModifiedElementIds()
deleted_el_ids = args.GetDeletedElementIds()
new_el_ids = args.GetAddedElementIds()

print("Added: {}".format(len(new_el_ids)))
print("Modified: {}".format(len(modified_el_ids)))
print("Deleted: {}".format(len(deleted_el_ids)))

for el_id in modified_el_ids:
    el = doc.GetElement(el_id)

    if el.Category and el.Category.Id == ElementId(BuiltInCategory.OST_Walls):
        print("Modified element: {} / {}".format(el.Id, el.Name))

        try:
            el.LookupParameter("TEST").Set("ModifiedElement")
        except:
            pass

for el_id in new_el_ids:
    el = doc.GetElement(el_id)

    if el.Category and el.Category.Id == ElementId(BuiltInCategory.OST_Walls):
        print("New element: {} / {}".format(el.Id, el.Name))

        try:
            el.LookupParameter("TEST").Set("NewElement")
        except:
            pass

My question is:

Is there anything special that must be done when registering an IUpdater to receive notifications for newly created or deleted elements?

Or is there a limitation in pyRevit’s doc-updater.py implementation that prevents GetAddedElementIds() and GetDeletedElementIds() from being populated?

Any suggestions would be greatly appreciated.

Thanks!

Are you sure you need doc-updater.py and not doc-changed.py ?
Disclaimer: I have never used any of this

Dev Sample:

API reference: