Override a shortcut used by a built-in command using API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
If I go to Customize --> Keyboard tab, find the "Line" command, and try to set its shortcut to "Ctrl+Shift+L", I'm told that "Ctrl+Shift+L" is currently assigned to "Loft [Sketched Features]", and I can click "Yes" to override and take the assignment from the Loft command.
I'm trying to figure out how to do the same thing but through the API.
I can use the following snippet to set the line command's shortcut to something like "Ctrl+L", or "Ctrl+Alt+L":
Dim oLineDef As Inventor.ControlDefinition = ThisApplication.CommandManager.ControlDefinitions("SketchLineCmd") oLineDef.OverrideShortcut = "Ctrl+Shift+L"
However, when I try to set it to Ctrl+Shift+L, I get an error. Presumably because the shortcut belongs to the Loft command.
I tried preceding the code above with this, to remove the Ctrl+Shift+L shortcut from Loft first:
Dim oLoftDef As Inventor.ControlDefinition = ThisApplication.CommandManager.ControlDefinitions("PartLoftCmd") oLoftDef.OverrideShortcut = "LO"
... and it does change the shortcut shown for Loft in the Customize dialog, but apparently, Ctrl+Shift+L is still tied to the loft command under the hood. So the assignment of Ctrl+Shift+L to the line command still fails.
How can I completely unassign Ctrl+Shift+L from the Loft command using the API, so that I can assign it to the Line command using the API?