WindowsForm dynamic update

WindowsForm dynamic update

yafimski
Contributor Contributor
586 Views
3 Replies
Message 1 of 4

WindowsForm dynamic update

yafimski
Contributor
Contributor

Hi,

I've built a Windows Form in Revit, that displays some information on the project when a button is clicked.

So far, I've used the DocumentChanged() event to determine if something has changed since the last time I clicked the button.

 

What I'd like to achieve is a Form where it allows to dynamically select and modify objects in Revit, and display the updated information in the Form, without having to exit and restart the Form.

 

My current Form is modeless, meaning it doesn't allow any actions in Revit while it is active. I understand that I might need to use a modal form, but I'm not sure if that will allow me the same functionality.

 

I've tried reading the information about ExternalEvents and Modeless_Dialogue etc., but it's very hard for me to understand, and no matter how much I read into it I quickly get confused as to which method will help me achieve my goal.

 

Any advice? I'd appreciate even a direction on which specific things to read up on.

Thanks

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

jeremytammik
Autodesk
Autodesk

If you want your form to remain open while at the same time continuing interaction with Revit independently of the form, it must indeed remain modeless, just as you have it now.

 

To obtain access to the Revit API from the modeless context, you need some way to enter a valid Revit API context. One such possibility is provided by the external event mechanism, demonstrated by the Revit SDK Sample ModelessDialog/ModelessForm_ExternalEvent.

 



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

0 Likes
Message 3 of 4

yafimski
Contributor
Contributor

Hi @jeremytammik,

Thanks.

 

Do you mean to say that in order to keep the Form open while I'm selecting objects, I need to start a Transaction, select/pick objects, and then Commit the transaction to return back to the Form and update it?

0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk

No, I mean to say that you need to implement an external event as demonstrated by the sample I pointed out.

 



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

0 Likes