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: 

Revit Command Line Switches

20 REPLIES 20
Reply
Message 1 of 21
Anonymous
7370 Views, 20 Replies

Revit Command Line Switches

Are there any command line switches available in Revit? I've looked in the
help file, but found nothing. I'm looking for switches that tell Revit what
.rvt file to open with, and a switch to specify an External Tool to launch
upon startup. I would also be curious to know of any others that are
available.

Thanks
20 REPLIES 20
Message 2 of 21
Anonymous
in reply to: Anonymous

I guess I don't need to worry about the .rvt file switch, since no switch is
required in that case (just placing the full drawing path in the command
line does the trick). However, I am still curious about any actual startup
switches for Revit. Most importantly though, I'm wondering if anyone knows
of a way to tell Revit to issue a particular External Tool upon startup.

Are we stuck having to try and hook Revit and send the appropriate Windows
messages to accomplish launching an External Tool?
Message 3 of 21
miguelvalencia5598
in reply to: Anonymous

Bringing this thread back to life, any answers to the original question?

Message 4 of 21

As David says, no switch required to load the RVT model. Just list it on the command line with Revit.exe and Revit will open it.

 

Similarly for add-ins: no switch required. Revit will load them as specified in the add-in manifests located in the add-ins folder in the standard manner.

 

Cheers,

 

Jeremy



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

Message 5 of 21

How can you open a file in a particular version with process.start?  I've tried many variations of the path to the .exe and the path to the file and always get an error message.  (File opens fine through UI.)  Thanks.

Message 6 of 21
r.baggen
in reply to: jeremytammik

Replying on Command Line switches,

 

are there StartUp switches using Revit?

 

Is there a way to start revit (from API or add switch to .exe) using a specific .rte?

For now you can select a template after starting Revit, I would like to do it before I start Revit.

 

Thanks!!!

 

Rolph

Message 7 of 21
jeremytammik
in reply to: r.baggen

Dear Rolph,

 

I am not aware of any such switch.

 

You could probably write an add-in that creates a new project document based on any given template automatically at start-up, though.

 

Cheers,

 

Jeremy



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

Message 8 of 21

In my case I wanted to start Revit with a particular file before it was opened.  I used the Idling event that looks for a txt file with a path in it.  As soon as Revit is finished loading, the idling event kicks in and finds the txt file and processes it with the API commands.

Message 9 of 21

Michael,

 

using the Idling event is a possible approach, but not one I recommend. For this kind of a problem (start Revit with a particular file via the API), I suggest using the ApplicationInitialized event instead.It is raised by Revit only once after the application is initialize and after add-ins were started too. In the handler of the event you can use the OpenAndActivateDocument - it would work as long as there is no active document open yet, which can be easily tested, though.

Arnošt Löbel
Message 10 of 21
jeremytammik
in reply to: arnostlobel

Hi Arnošt,

 

Thank you for the good advice!

 

Look at these in-depth discussion of this all-to-unknown event:

 

http://thebuildingcoder.typepad.com/blog/2015/03/opening-and-activating-document-in-an-event-handler...

 

http://thebuildingcoder.typepad.com/blog/2015/03/automatically-open-a-project-on-startup.html

 

Cheers,

 

Jeremy



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

Message 11 of 21
theDarknessRules
in reply to: r.baggen

I could use a switch to set the default View Option.  For instance, one Desktop launch shortcut set to Mechanical, another set to Plumbing.

 

 

Message 12 of 21

Cool  idea. 

 

Please submit it to the Revit idea station:

 

http://thebuildingcoder.typepad.com/blog/2016/05/idea-station-and-textnote-bounding-box.html#2

 

Cheers,

 

Jeremy



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

Message 13 of 21
erlich_denis
in reply to: jeremytammik

Jeremy, 

I am looking for Revit switch that would enable autpmatic load of Revit file as a local (silent mode). Reason- I need to get Dynamo Automation working on Central files ( I have about 80 files to process every iteration)

I explained my line of investigation here:

https://forum.dynamobim.com/t/dynamo-automation-for-central-files/8597?u=erlich.denis

Please, advise if it is possible to "decentralize" revit file via python script

Thank you in advance!

Message 14 of 21
jeremytammik
in reply to: erlich_denis

Dear Denis,

 

Happy New Year to you!

 

You have no need for any additional switch to auto-load a document on Revit start-up.

 

Just providing the full document path is sufficient, e.g.:

 

C:\>"C:\Program Files\Autodesk\Revit 2017\Revit.exe" Y:\a\rvt\Test.rvt

 

Cheers,

 

Jeremy

 



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

Message 15 of 21

Hi,

I know this is not in answer to the last question, but it may be useful to others higher up the conversation.

These are the switches etc I'm aware of (tested in Revit 2017):

 

*no switch* <fully qualified path of file to open> (Opens a Revit file. Seems to work with a template or project file. Haven't tried a family. I've been doing this since Revit 2011, though I put /o in there so I know what it is, though that seems to be ignored.)

*no switch* <fully qualified path of journal file> (Replays a journal file.)

/language <language code such as ENU>

/viewer (Launch Revit in viewer mode.)

 

Cheers,

 

-Matt


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
Message 16 of 21

Dear Matt,

 

thank you for the succinct summary!

 

I promoted it to a blog post for better legibility and future reference:

 

http://thebuildingcoder.typepad.com/blog/2017/01/distances-switches-kiss-ing-and-a-dino.html#3

 

Cheers,

 

Jeremy



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

Message 17 of 21
callumf
in reply to: jeremytammik

Some command line switches that Ive used:

 

/nosplash Suppresses the splash screen

/min Starts the session minimised

/max Starts the session ... maximised!

 

Message 18 of 21
jeremytammik
in reply to: callumf

Dear Callumf,

 

Thank you for your additions! I appended them to the blog post list as well for future reference:

 

http://thebuildingcoder.typepad.com/blog/2017/01/distances-switches-kiss-ing-and-a-dino.html#3

 

Cheers,

 

Jeremy



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

Message 19 of 21
ola6n4qrvdsr
in reply to: callumf

This is an old thread, but I wish there were switches -detach and -audit, to have Revit upgrade and check the file named in the commandline;

 

e.g.   "C:\Program Files\Autodesk\Revit 2021>revit.exe /audit /detach D:\project path\project 1\AR_CD ver_01020304.rvt"

 

This would allow me to pipe a folder/file list to Revit to upgrade 10,000s of files in one hit, with some reliability (the several RVT upgrade apps I've found don't seem to work very well if at all, and have to be spoon fed if you want anything from them).

Message 20 of 21

You can probably achieve running the audit command automatically on thousands of models in many different ways. You might be able to use a journal file to drive the process. Maybe you can run the audit command from a Revit add-in using PostCommand. All of these approaches can be automatically launched file by file in a batch process.

  

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open

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