How to hook on "Reload linked file" event ?

How to hook on "Reload linked file" event ?

m.vallee
Advocate Advocate
750 Views
3 Replies
Message 1 of 4

How to hook on "Reload linked file" event ?

m.vallee
Advocate
Advocate

Hi Revit API community,

 

I want some code to be executed each time the user clicks on "Reload" on a linked file.

I've had a look at PostCommands and Idling events but I haven't find the corresponding "trigger".

How would you do that ?

 

Thanks for your advice.

BR

Maxime

0 Likes
751 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

Dear Maxime,

 

Thank you for your query.

 

I do not think there is a dedicated event to catch that.

 

Here are some ideas that you might try out:

 

  • Implement a dynamic model updater, specifying a specific linked file type (or all) as triggers, with ChangeTypeAny.
  • Subscribe to the DocumentChanged event and check whether any recognisable elements get added, deleted or modified when you reload the link.

 

I hope this helps.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 4

m.vallee
Advocate
Advocate

Hi Jeremy,

 

I tried your first idea, as it sounded quite promising.

The resulting behaviour is not far from what I want : my updater is triggered each time a RevitLinkInstance is loaded or unloaded. So if the user clicks on "Reload from", it is executed. But if the user simply clicks on "Reload", nothing happens.

Another point I missed when thinking about the process is that when linked files have been replaced/updated, reopening the main file *does* already refresh all the links, without any user manipulation... how could I detect these changes to execute some code... 

0 Likes
Message 4 of 4

m.vallee
Advocate
Advocate

Hi, 

Another ideas from the Revit API community ? 

Thanks in advance.

BR

Maxime

0 Likes