I am trying to develop a addin that uses a Windows From User Control, with a lot of inputs/ buttons that I would like to interact with the revit model. I have read through various sources that you have to be careful when using the API through an external application so I had a few questions.
My Form UserControl is brought up in a window after a button is clicked on the ribbon panel. The excute method of the button passes the commandData to the usercontrol class, where I interact with the API. An example of the functionality of the windows form is exporting to DWF.
Is it ok to pass the command data to my usercontrol ssince the excute method of the button on the ribbon panel is active as long as the usercontrol window is open? I played around with trying to do it other ways like using Idling, but this is much harder to implement seeing that I am interacting with the API alot.
Any help is appreciated.
Thanks
Hello jzayas,
As long as your form is modal - that is you can not return from execution of your external command untill the form is dismissed, you can call the Revit API from it pretty much in any way you want. And yes, you can pass the commandData to it and use it there.
The workflow based on the Idling event is only necessary for modeless dialogs, that is dialogs that stay open after the external command that brought it up finishes its execution and returns control back to Revit.
Thank you for you interest
Arnošt Löbel
Autodesk, Revit R&D
Can't find what you're looking for? Ask the community or share your knowledge.