Revit Command Line Switches

Revit Command Line Switches

Anonymous
Not applicable
8,828 Views
20 Replies
Message 1 of 21

Revit Command Line Switches

Anonymous
Not applicable
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
0 Likes
8,829 Views
20 Replies
Replies (20)
Message 2 of 21

Anonymous
Not applicable
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?
0 Likes
Message 3 of 21

miguelvalencia5598
Participant
Participant

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

0 Likes
Message 4 of 21

jeremytammik
Autodesk
Autodesk

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

0 Likes
Message 5 of 21

Anonymous
Not applicable

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.

0 Likes
Message 6 of 21

Anonymous
Not applicable

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

0 Likes
Message 7 of 21

jeremytammik
Autodesk
Autodesk

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

0 Likes
Message 8 of 21

Anonymous
Not applicable

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.

0 Likes
Message 9 of 21

arnostlobel
Alumni
Alumni

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
0 Likes
Message 10 of 21

jeremytammik
Autodesk
Autodesk

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

0 Likes
Message 11 of 21

theDarknessRules
Explorer
Explorer

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

 

 

0 Likes
Message 12 of 21

jeremytammik
Autodesk
Autodesk

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

0 Likes
Message 13 of 21

erlich_denis
Observer
Observer

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!

0 Likes
Message 14 of 21

jeremytammik
Autodesk
Autodesk

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

matthew_taylor
Advisor
Advisor

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?
0 Likes
Message 16 of 21

jeremytammik
Autodesk
Autodesk

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

0 Likes
Message 17 of 21

callumf
Contributor
Contributor

Some command line switches that Ive used:

 

/nosplash Suppresses the splash screen

/min Starts the session minimised

/max Starts the session ... maximised!

 

0 Likes
Message 18 of 21

jeremytammik
Autodesk
Autodesk

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

0 Likes
Message 19 of 21

ola6n4qrvdsr
Advocate
Advocate

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).

0 Likes
Message 20 of 21

jeremy_tammik
Alumni
Alumni

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
0 Likes