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 like AutoCAD

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
khoa.ho
9750 Views, 4 Replies

Revit Command Line like AutoCAD

Hi,

 

I wonder if Revit does have the command window like AutoCAD or not. So we can type any command to run inside Revit like AutoCAD.

 

For example, if I define a new class: public class Lab1PlaceGroup : IExternalCommand

 

Then I can type my new command Lab1PlaceGroup to the "Revit command line" (as I imagine with AutoCAD). It will be better than to define an addin file for each command. Therefore, I can have many classes inherited from IExternalCommand interface in a single DLL file.

 

Thanks,

4 REPLIES 4
Message 2 of 5
Scott_Wilson
in reply to: khoa.ho

There's no command line that I know of.

 

You can however assign keyboard shortcuts to any custom commands that you have added using the UI customization functionality found in Revit's Options window.

 

There is nothing stoping you from creating your own command console as a dockable window though 🙂

 

A simpler alternative might be to create a TextBox item in the ribbon labelled "Execute" where you type in the name of the command that you want to run and hit enter. Your "EnterPressed" event handler can then use reflection and some predetermined assembly / namespace locations to find the specified method and call it, passing through its "TextBoxEnterPressedEventArgs" paramter to provide a valid API context.

 

Message 3 of 5
khoa.ho
in reply to: Scott_Wilson

That is a very good idea. Thank you!

Message 4 of 5
jeremytammik
in reply to: khoa.ho

You can also take a look at the Revit Python and Ruby Shells.

 

They provide an interactive scripting command line:

 

http://thebuildingcoder.typepad.com/blog/2013/11/intimate-revit-database-exploration-with-the-python...

 

Cheers, 

 

Jeremy

 



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

Message 5 of 5
khoa.ho
in reply to: jeremytammik

Hi Jeremy,

 

Those two projects of Python and Ruby for Revit are very interesting. I am looking into them.

 

Thank you!

Khoa

 

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