DocumentReloadingLatest Event

This is kind of a two part question.

So I have made some IUpdaters that monitor for (and block) certain actions based on a person’s username being on a list of approved names. They work great in isolation, but I came across a problem that they are triggered on Reload Latest. Essentially, here’s what happens:

1.Person A (who is Allowed to make a change) makes their change and syncs.
2. Person B who is not allowed to make the change syncs or reloads latest and gets swatted down as if They are making the change themselves.

My thinking was to try to create some kind of flag that would let the Updater know that it’s being triggered by a reload. I tried using the DocumentChanged event and checking transaction names for “Reload Latest”. This worked in that I could detect that a reload was happening. The problem was at that point, the changes have already happened. Then I came across the DocumentReloadingLatest Event, which is supposed to trigger BEFORE the reload latest starts. However, I can’t seem to get this event to trigger. This is how I’m registering it:

def reloading(sender, args):
    print "TRIGGERED"
__revit__.Application.DocumentReloadingLatest += reloading

Has anyone ever used this event before? I noticed that there isn’t a built in hook for it in the pyRevitDevHooks, so maybe there is something funky with it?

Thanks !

What exactly are you trying to block? If you are trying to prevent users from moving linked models or something similar there are def. better solutions available.

And IUpdater is a poor replacement for proper training.

I’m using it to prevent changes to View templates. But the IUpdater is actually irrelevant to my real question. My question is really just about this DocumentReloadingLatest Event. I can’t seem to get that event to trigger no matter what I do. I’m curious if there is something special about this event or some kind of limitation to accessing it

What version of Revit? It was added to API in 2021. Event handler module was added like 5 years ago, so maybe the newer events have not been added yet.

I’m testing in 2023. While digging around, I found that there is another event called “WorksharedOperationProgressChanged”. It gets triggered a bunch of times during reload latest but it has an event arg property called “ReloadLatestFinished” which gives me what I want. This way I can know when the reload latest is in progress/finished.

1 Like