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: 

Calling Revit Plug-In without Revit Open

4 REPLIES 4
Reply
Message 1 of 5
JackVR
2140 Views, 4 Replies

Calling Revit Plug-In without Revit Open

I'm writing software that extracts and analyzes information from Revit using a Revit API plug-in, but as it stands the plug-in has to be activated from the External Tools menu in Revit, and ideally I'd like the start point to be within my application, instead of Revit.

 

I understand that Revit probably has to be open to run the plug-in within its own runtime, but I'm wondering if it's possible to start a hidden instance of Revit and call the plug-in like that instead of having to explicitly start Revit and select the plug-in from the menu. Is something like this possible?

Tags (2)
4 REPLIES 4
Message 2 of 5
arnostlobel
in reply to: JackVR

Hello JackVR!

As you've found out, there is no direct support out of the box for what you want. A Revit instance must be running in order for an add-in to be executed. However, you can possibly sort of work around it if you figure out how to instantiate a Revit process that is hidden. Perhaps you can launch it in a separate desktop, one that is set to be out of screen. Even then, though, it is still a limitation that you cannot invoke your add-in from outside of Revit. The call must always come from within Revit. External command is out of the question, I presume, because there will be no user to click it and invoke it. However, I assume you do not need an external command anyway. My guess is that you want to do something to a model, and for that all you ought to need is one of the document events, most likely DocumentOpened. Or, as an alternative, you can do your task in an ApplicationIitialized event or in OnStartup method your external application implements. The following are the steps for one of the possible workflow:


1. Implement your functionality in an add-in (external application) and have it installed in Revit.

2. Design a simple standalone application (exe) that starts Revit in a separate process.

3. Use the standalone application to start Revit hidden somehow (or not hidden, if you do not care)

4. In the OnStartup method your application implements, subscribe to ApplicationInitialized event

5. When your add-in receives the event, open the document you want to analyze

6. When the document is opened, perform the analysis; output whatever you need to output.

7. Close the document.

8. Notify the standalone application that your task is finished. Perhaps some kind of inter-process messaging can be used - I suggest making it asynchronous.

9. Exit the ApplicationInitialized event handler

10. When the standalone application receives the inter-process message from your add-in, kill the Revit process.
Arnošt Löbel
Message 3 of 5
jeremytammik
in reply to: arnostlobel

Hi Arnošt,

 

Thank you for the cool suggestion!

 

This fits in well with a case that I just answered, so I added it to The Building Coder as well for future reference:

 

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

 

Cheers,

 

Jeremy



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

Message 4 of 5

There is real need for a "headless" Revit.

Dale




______________
Yes, I'm Satoshi.
Message 5 of 5
arnostlobel
in reply to: Dale.Bartlett

That is definitely an argument we understand I do agree with.

Arnošt Löbel

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community