Run addin without having to start Revit

christostsar
Contributor
Contributor

Run addin without having to start Revit

christostsar
Contributor
Contributor

I am searching for a way to test my add-in functionality. I have read about the Dynamo testing framework and the RevitTestFramework. These can evidently be used to run unit tests that reference some model without having to start Revit.

 

What I want is to be able to run a part of my add-in functionality (which fires when a user presses a button normally) ideally using a command line application or a batch file (so I need something that can run Revit, open a model and run some add-in code), without having to manually start Revit.

 

From what I gather, this must be somehow possible with the Dynamo testing framework, which, although it was meant for unit testing, does indeed use Revit in the background to open models and run code. Anyone has some suggestions?

Reply
670 Views
3 Replies
Replies (3)

moturi.magati.george
Autodesk
Autodesk

Hi @christostsar,

 

Kindly note that a Revit instance must be running in order for an add-in to be executed.
The Building Coder talks about this in the blog post below:

https://thebuildingcoder.typepad.com/blog/2015/04/duplicate-add-in-guid-and-driving-revit-from-outsi...

  Moturi George,     Developer Advocacy and Support,  ADN Open

christostsar
Contributor
Contributor

Thanks for the link. I have noted already that Revit does not intend for the API to be used by external processes, but I also noted that both of the testing frameworks I mentioned in the OP do indeed use the API without having to start Revit first, so they are somehow starting Revit in the background (?).

 

Would it be a good idea to use one of these frameworks that were designed for unit testing to run my ExternalCommand, or would it be easier to just set up my own application to start Revit in the background?

 

dtartaglia_PYEBEB5KA84W
Contributor
Contributor

Yes you can open Revit non-manually using the Idling event, open a model, run a command and close Revit. I do this regularly to batch print at night launching Revit and opening a model via the Windows Task Scheduler. This is really old but the logic still works: https://jeremytammik.github.io/tbc/a/0957_auto_pdf_print.htm

0 Likes