How to Assign KeyBoard Shortcut to external commands

jainn
Advocate
Advocate

How to Assign KeyBoard Shortcut to external commands

jainn
Advocate
Advocate

Hi,

 

How to assign keyboard shortcuts for external commands in the Revit 2015?

 

 

Example:-

 

I have create one external command  to display Element Location.

I want to execute this commend from keyboard shortcut "CP".

 

 

 

Please Suggest.

 

 

Thanks & Regards

Namit Jain

0 Likes
Reply
Accepted solutions (1)
6,366 Views
14 Replies
Replies (14)

Anonymous
Not applicable

Its simple.  Just go to Revit Menu and click on options at the bottom right of the popup.  Then click on User Interface tab and then select the Keyboard Shortcuts in the middle of the dialog on the right side.  From there you can find your custom command and assing a shortcut to it.  You can also adjust existing shortcuts and make new shortcuts there for most of the commands in Revit.

 

Good luck,

 

Keith

0 Likes

jainn
Advocate
Advocate

Dear Keith,

 

Thanks for your reply, but i want to do this programatically.

 

Please suggest

 

Thanks & Regards

Namit Jain

0 Likes

jeremytammik
Autodesk
Autodesk

Dear Namit,

 

Thank you for your query.

 

Here is an old description on how to achieve that back in 2009:

 

http://thebuildingcoder.typepad.com/blog/2009/04/addin-keyboard-shortcut.html

 

Things have changed since then, though.

 

The Revit 2011 API introduced keyboard shortcut support for API buttons:

 

http://thebuildingcoder.typepad.com/blog/2013/02/whats-new-in-the-revit-2011-api.html

 

Keyboard shortcut support for API buttons

 

API buttons found on the Ribbon can be assigned a keyboard shortcut. Buttons created by applications registered using manifest files now use an id based on their application id and button name to provide a unique identifier for the button. The keyboard shortcut will be maintained even if the order of registration of API applications changes.

 

This functionality was overhauled in the Revit 2013 API:

 

http://thebuildingcoder.typepad.com/blog/2013/03/whats-new-in-the-revit-2013-api.html

 

Support for Keyboard Shortcuts and Quick Access Toolbar

 

API commands may now be assigned keyboard shortcuts, and those assignments will be preserved even if add-ins are added, removed or changed in subsequent sessions.

 

API commands may also be moved to the Quick Access Toolbar, and that assignment will also be preserved even if add-ins are added, removed or changed in subsequent sessions.

 

I hope this helps.

 

Please take a look at that and let us know how you can make use of this functionality.

 

Thank you!

 

Best regards,

 

Jeremy



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

0 Likes

jeremytammik
Autodesk
Autodesk

The rest is described in the Revit help and Developer Guide:

 

http://help.autodesk.com/view/RVT/2015/ENU/?guid=GUID-39D549F2-75EE-4C06-8B6A-3DADE1FBEF59



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

0 Likes

Revitalizer
Advisor
Advisor

Hi jainn,

 

you may have a look at this thread:

http://forums.autodesk.com/t5/revit-api/how-to-get-short-key-collection/td-p/5513905

 

You may edit the described XML file, but on your own risk.

 

 

Best regards,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes

jeremytammik
Autodesk
Autodesk

Dear Revitalizer,

 

If you simply edit the XML file, does Revit automatically read in the changes and update the settings accordingly?

 

Or do you have to explicitly import the file to achieve that?

 

Thank you!

 

Cheers,

 

Jeremy



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

0 Likes

jeremytammik
Autodesk
Autodesk
0 Likes

Revitalizer
Advisor
Advisor

Hi Jeremy,

 

I did just give a hint but didn't test that before.

It's just a thought that came to mind after reading the get-shortcuts-thread.

Since this is the related setter-thread, they belong to each other.

 

I assume that Revit needs to be restarted, but the user who started the thread may test the idea and give an answer.

Problem solved - or even not.

 

 

Best regards,

Rudi




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes

jeremytammik
Autodesk
Autodesk

Maybe this is a one-way user, as in black hole...

 

Let's wait and see   🙂



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

0 Likes

jainn
Advocate
Advocate

Hi,

 

Please suggest after edit ShortCutKeys XML file. how to load this file without restating Revit.

 

Thanks & regards

Namit Jain

0 Likes

Revitalizer
Advisor
Advisor
Accepted solution

Hi jainn,

 

if you save the xml and just start the built-in "edit shortcuts" command, your changes will not be visible in the UI.

But if you restart Revit, changes are recognized.

So no, you must restart Revit in each case.

 

I've tested this by canging the ID_BUTTON_SELECT key from "MD" to "MX".

 

Doing so, you must be absolutely clear that you have to validate your input values since you are bypassing Revit this way.

You would have to check duplicate values, check if keys are reserved ones etc.

 

 

Best Regards,

Revitalizer

 

 




Rudolf Honke
Software Developer
Mensch und Maschine





jainn
Advocate
Advocate

HI Revitalizer,

 

Thanks for your Reply.

 

Regards

Namit Jain

0 Likes

JoseFandos
Participant
Participant

Given that add-ins can and often are started after installation while a Revit session is running, it would be great that the API provided a way to reload the XML so that newly added shortcuts for the add-in's use would be available as soon as the add-in is up and running.

 

Requiring a restart removes the advantage of loading an add-in while a Revit session is running, if keyboard shortcuts are key (no pun intended) to the add-in in question. Wish-list item for the API.

jeremytammik
Autodesk
Autodesk

Dear Namit and Jose,

 

Thank you for your updates and suggestion.

 

I submitted the wish list item CF-3919 [API wish: reload ShortCutKeys XML file after edit without restarting Revit] on your behalf for the functionality you suggest, as this issue requires exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

This issue is important to me. What can I do to help?

 

This issue needs to be assessed by our engineering team, and prioritised against all of the other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:

 

  • Impact on your application and/or your development.
  • The number of users affected.
  • The potential revenue impact to you.
  • The potential revenue impact to Autodesk.
  • Realistic timescale over which a fix would help you.
  • In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.

 

This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.

 

Best regards,

 

Jeremy



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