UpdaterRegistry.AddTrigger() is disabled to called from the Updater

UpdaterRegistry.AddTrigger() is disabled to called from the Updater

gill.gonnissen
Explorer Explorer
678 Views
1 Reply
Message 1 of 2

UpdaterRegistry.AddTrigger() is disabled to called from the Updater

gill.gonnissen
Explorer
Explorer

Hello,

The UpdaterRegistry.AddTrigger() API method is disabled to be used inside of a Dinamic Model Updater (DMU). Updater throws an exception when you try to use this function. This is the message "This method may not be called during dynamic update."

 

Our ElementUpdater is added to listen to additions of specific categories. After these elements are added our ElementUpdater wants to add triggers to specific parameters for that element. It is not possible to do that in the updater. At the moment we do it in the Idling command where it is possible to add the trigger. This results in multiple actions in the Revit log. So when a user then wants to rollback changes it's very messy because for this one action, he needs to do 2 rollbacks. This results in multiple errors. 

 

Is it possible to open up the DMU just like the idling command? 

 

I can provide some code or a project if the issues is not clear.

 

Thank you in advance!

Gill Gonnissen

0 Likes
679 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk

Dear Gill,

 

As far as I can judge naively from outside, the error message and behaviour that you describe makes perfect sense.

  

I think you would do best to rethink and redesign your logic a bit.

 

One approach that I have seen used is to register an updater up front and add a Boolean switch in the Execute method to control when it should truly be active, and when it can just return without doing anything.

 

You might want to check out some of the existing examples in The Building Coder DMU topic group:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.31

  

I hope this helps.

 

Best regards,

  

Jeremy

  



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

0 Likes