Recognize change of air flow in system

Recognize change of air flow in system

otto_lagerquist
Participant Participant
180 Views
2 Replies
Message 1 of 3

Recognize change of air flow in system

otto_lagerquist
Participant
Participant

Hi all,

I'm trying to recognize changes in air flow of a system using the OnDocumentChangedEvent. When selecting my outlet there are two ways of changing the flow. Either changing the flow parameter directly in the properties tab or changing the value in the small contextual ribbon underneath the other buttons in the ribbon. The problem is that a change is never registered for the system (I'm looking in the modified ElementIds of the EventArgs). If I access the system from other elements that were modified (the outlet, for example), I can get the new flow of the system only if I changed the flow using the contextual ribbon but not if I changed the flow parameter of the outlet. In both cases the system flow is changed when looking in the UI. Does anyone have any insight on how to recognize when the flow of a system changes?

Thanks in advance!

0 Likes
181 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

OnDocumentChanged is one way to react to model modifications. Another way, and mostly more recommended for such purposes, is to make use of the dynamic model updater framework DMU. Main advantage: your modification is embedded in the same transaction that triggered it to be performed, so if the triggering modification is undone, your additional modification reacting to the trigger is undone as well. So, maybe DMU is better suited to your purpose. Check it out first:

 

     

If you decide to stick with OnDocumentChanged after all, we can take another look at your original question.

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

otto_lagerquist
Participant
Participant

Thanks for your answer @jeremy_tammik!

I'm already a bit familiar with DMU and I don't think it's the right approach this time. To be more specific about what I'm trying to do:
With an external command I open a modeless window and list all the mechanical systems divided into two groups, those with air flow, and those without. And then for those that have an air flow greater than zero I go on to display some other information as well. So I'm not really interested in making any modifications to the document (which the DMU would be for, I think), I just want to see what is there and be able to react on changes. When a system is changed I want to potentially move it to the other group.

From my own tries to debug, it seems to be a question of when the change of the air flow for the entire system is registered in the revit database. In one case it seems to be before the Document Changed Event (as expected as it is triggered after a transaction is committed), but in the other case it seems that the change is happening after the Document Changed Event.

 

Kind regards,

Otto

0 Likes