Create Command Aliases for Custom CUI Commands & VBA Macros

Create Command Aliases for Custom CUI Commands & VBA Macros

Anonymous
Not applicable
2,182 Views
5 Replies
Message 1 of 6

Create Command Aliases for Custom CUI Commands & VBA Macros

Anonymous
Not applicable

Hello,

 

I've been trying to find a straightforward tutorial on how to apply command line shortcuts/aliases to a list of custom commands (some listed below). I have no problem creating the custom commands & VBA macros, but I want to be able to type the shortcut (on the command line), press enter and have the command run. How do I set this up? The closest I've come so far is creating a custom menu, but I don't want to have to use the ribbon or menus, I use command line commands for everything.

 

  • [Shortcut] - [Custom Command]
  • GP - get previous
  • SR - shademode, realistic
  • S2 - shademode, 2D
  • S3 - shademode, 3D
  • SX - shademode, XRay
  • UX - Rotate around X axis
  • UY - Rotate around Y axis
  • UZ - Rotate around Z axis
  • MC - Mirror Copy
  • LO - Layer off
  • LN - Layer on
  • CS - Change Space
  • CCN - VBA macro for modelling spheres

Cheers!

0 Likes
2,183 Views
5 Replies
Replies (5)
Message 2 of 6

pendean
Community Legend
Community Legend
You need to use LISP to do more than just call the start of every command. That forum is over here https://forums.autodesk.com/t5/autocad-customization/ct-p/AutoCADTopic1


Message 3 of 6

scot-65
Advisor
Advisor
In a nutshell one will require a third-party interface point such as ACADDOC.lsp.

Inside file will be things like:
(defun c:CFN () (load "CustomFileName_CFN")(c:CFN)) ;description

The load shows file name longhand with keystroke suffix as part of file name.
Only a suggestion. Note that keystroke is defined on startup but the actual
tool is loaded (and redefines the keystroke) on the first call of that tool.

If one wishes to create an alias of the custom command, try this:
(defun c:CF () (c:CFN)) ;alias of CustomFileName

For VBA, the command is likely longhand and you can use this structure:
(defun c:MVBA () (command "My_VBA_Tool")) ;description

Other suggestion is to use AUTOLOAD for the non-VBA tools.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

Message 4 of 6

Johanna_Esteban
Advisor
Advisor

Hello @Anonymous, 

 

I do not do lisp yet, but I have assigned Shortcut Keys for some commands for which there are no aliases, such as the "shademode, 2D" you mention.

 

From Manage, User Interface...

Find the command (2), drag it to the "Shortcut Keys" menu (3) and select properties (4) to take you to the window (5) to press the keys you want to use.

 

Shortcut keys 2.JPG

 

In this part it is not possible to assign the letters S2, but if it could be SHIFT + 2, which are also very close, what do you think?

 

To make my life easier, the commands that I use the most I have assigned to the mouse, I do not know if you have one that offers multiple functions and the possibility of customizing it (I show you mine). (I show you mine)

 

I hope it helps.


Greetings.

 

 



Johanna Esteban

EESignature


Autodesk Expert Elite | Autodesk Certified Professional | AutoCAD Customer Council (Beta Tester for Windows & Mac)

¿Te ha parecido útil este post? ¡Dame Kudos! 😉
Si ha sido resuelta tu inquietud, selecciona 'Marcar como solución' para que otros usuarios la encuentren fácilmente.

0 Likes
Message 5 of 6

Anonymous
Not applicable

Hi Johannaa,

 

Thanks for your reply, but I am already using "shift+F2" etc. for other custom commands. It looks like I need to learn how to write 'lisp' scripts.

 

Cheers,

Hamish

0 Likes
Message 6 of 6

Johanna_Esteban
Advisor
Advisor

Hi @Anonymous, 

 

Then, we are two.

 

Regards, 



Johanna Esteban

EESignature


Autodesk Expert Elite | Autodesk Certified Professional | AutoCAD Customer Council (Beta Tester for Windows & Mac)

¿Te ha parecido útil este post? ¡Dame Kudos! 😉
Si ha sido resuelta tu inquietud, selecciona 'Marcar como solución' para que otros usuarios la encuentren fácilmente.

0 Likes