Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.

Revit API Forum

Reply
Post 1 of 16

Revit Command Line Switches

2139 Views, 15 Replies
04-12-2006 09:55 AM
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
Post 2 of 16

Re: Revit Command Line Switches

04-13-2006 11:02 AM in reply to: *Dave Blackburn
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?

Re: Revit Command Line Switches

05-06-2015 12:43 PM in reply to: *Dave Blackburn

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

Post 4 of 16

Re: Revit Command Line Switches

05-06-2015 03:50 PM in reply to: miguelvalencia5598

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

Post 5 of 16

Re: Revit Command Line Switches

05-31-2015 08:04 AM in reply to: jeremytammik

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.

Post 6 of 16

Re: Revit Command Line Switches

06-23-2015 04:32 AM 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

Post 7 of 16

Re: Revit Command Line Switches

06-23-2015 04:42 AM 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

Post 8 of 16

Re: Revit Command Line Switches

06-23-2015 05:37 AM in reply to: jeremytammik

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.

Post 9 of 16

Re: Revit Command Line Switches

06-23-2015 08:54 AM in reply to: michael_coffey

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
Post 10 of 16

Re: Revit Command Line Switches

06-23-2015 09:13 AM 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

Re: Revit Command Line Switches

07-21-2016 09:16 AM 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.

 

 

Post 12 of 16

Re: Revit Command Line Switches

07-21-2016 12:38 PM in reply to: theDarknessRules

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

Post 13 of 16

Re: Revit Command Line Switches

01-04-2017 04:30 AM 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!

Post 14 of 16

Re: Revit Command Line Switches

01-04-2017 06:24 AM 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

Highlighted
Post 15 of 16

Re: Revit Command Line Switches

01-04-2017 06:47 AM in reply to: erlich.denis

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?
Post 16 of 16

Re: Revit Command Line Switches

01-09-2017 04:23 AM in reply to: matthew.taylor

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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post

Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.