Create Command Aliases for Custom CUI Commands & VBA Macros

Create Command Aliases for Custom CUI Commands & VBA Macros

Anonymous
Not applicable
1,473 Views
7 Replies
Message 1 of 8

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. I also asked this question in a different forum and someone replied and said I need to use lisps.

 

  • [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
Accepted solutions (1)
1,474 Views
7 Replies
Replies (7)
Message 2 of 8

devitg
Advisor
Advisor

Edit your ACAD.PGP , type  _alias at the command line and fit it as need . 

 

 

0 Likes
Message 3 of 8

Anonymous
Not applicable

Hi,

 

Thanks for your reply but editing the pgp file doesn't work for custom commands, unless someone can provide a tutorial showing this working. I can only modify existing commands, e.g. changing "C" to "Copy" instead of "Circle" in the 'user defined' area at the bottom of the pgp file (in Notepad).

 

Cheers,
Hamish

0 Likes
Message 4 of 8

devitg
Advisor
Advisor

Hi Hamish , you are right. Maybe you can make , as many LISP  as command

 

0 Likes
Message 5 of 8

devitg
Advisor
Advisor

Mi first two 

 

;;;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


(defun c:gp ()
  (command "_undo"  1 )
)


(defun c:sr ()

  (command  "VSCURRENT" "r")
  )
           
0 Likes
Message 6 of 8

ВeekeeCZ
Consultant
Consultant

@Anonymous wrote:

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. I also asked this question in a different forum and someone replied and said I need to use lisps.

  • SR - shademode, realistic
  • S2 - shademode, 2D
  • S3 - shademode, 3D
  • SX - shademode, XRay

 


 

Here is a pattern for these...

(defun c:SR nil (command "_.vscurrent" "_r") (princ))

To get the rest, change the setting manually in autocad and watch the command line...

Message 7 of 8

ВeekeeCZ
Consultant
Consultant
Accepted solution

@Anonymous wrote:

...

  • GP - get previous

It's not clear what you mean. Fthe follorwng lisp highlights the previous selection set.

(defun c:GP nil (sssetfirst nil (ssget "_P")) (princ))

 

  • SR - shademode, realistic
  • S2 - shademode, 2D
  • S3 - shademode, 3D
  • SX - shademode, XRay

See the previous post.

 

  • UX - Rotate around X axis
  • UY - Rotate around Y axis
  • UZ - Rotate around Z axis

Probably usign the 3drotate command. But not sure how to set that. Need more info how it should work. 

 

  • MC - Mirror Copy
(defun c:MC nil (command "_.select" pause "_.mirror" "_p" "" pause pause "_N") (princ))
  • LO - Layer off

PGP file: set an Alias for LAYOFF command.

 

  • LN - Layer on

Which layer? Or All Layer? Or possible some routine the shower all layers, you pick some and then all the rest hide again.

 

  • CS - Change Space

PGP file.

 

  • CCN - VBA macro for modelling spheres

A macro needs to be rewritten to a LISP routine of that name.

...


 

Message 8 of 8

Anonymous
Not applicable

Thank you! I now have everything working as needed and I know how to customize commands going forward.

 

One thing to note is that the pgp file does not contain "-SHADEMODE" (which is frustrating because when I used "SHADEMODE" in lisp routines, AutoCAD would use "-SHADEMODE" instead... but this was solved by using "VSCURRENT" instead), "LAYOFF" or "CHSPACE".

 

Cheers,

Hamish

0 Likes