Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Run addin without having to start Revit

3 REPLIES 3
Reply
Message 1 of 4
christostsar
528 Views, 3 Replies

Run addin without having to start Revit

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?

Tags (1)
3 REPLIES 3
Message 2 of 4

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
Message 3 of 4

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?

 

Message 4 of 4

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community