Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Command alias only works after going into the ALIAS command

15 REPLIES 15
Reply
Message 1 of 16
Anonymous
3087 Views, 15 Replies

Command alias only works after going into the ALIAS command

I created a command alias, UCSF (just to shorten UCSFOLLOW). When I type in UCSF I get the "Unknown command 'UCSF'." message in the command prompt. If I go into the Alias Editor, the command alias is already set up in there. If I just hit the 'close' button, the alias still won't work. But if I hit the 'OK' button (where it brings up the message telling you the aliases have been saved), the UCSF command will then work. This happens every time a new session of AutoCAD is started (ie. opening ACAD at the start of the day, restarting my computer, closing and opening a new session of ACAD, etc.).

 

Also, the pgp file shows the UCSF - UCSFOLLOW alias saved in there.

15 REPLIES 15
Message 2 of 16
drjohn
in reply to: Anonymous

After editing the alias listing, you need to REINIT after saving and closing the PGP file.

 

Typ REINIT at the command line and select the PGP file selection.

 

That should do it for you.  No reboot.

 

 

Regards,

DJ

 

Message 3 of 16
rkmcswain
in reply to: drjohn

drjohn wrote:

After editing the alias listing, you need to REINIT after saving and closing the PGP file.

 

Typ REINIT at the command line and select the PGP file selection.

 

That should do it for you.  No reboot.

It funny that you still have to do that in 2015 when we've been on AutoCAD for Windows for almost ±20 years.

Back in the days when you had to "shell out to DOS", edit the file in EDLIN or EDIT, then jump back into AutoCAD - that made a little sense.

I guess since all the "Edit Aliases" button does is open Notepad, you don't have much choice.

To be fair, it is still documented fairly well. 

R.K. McSwain     | CADpanacea | on twitter
Tags (2)
Message 4 of 16
nestly2
in reply to: rkmcswain

I must be reading the problem differently.  My understanding is the OP us using ALIASEDIT, which should automatically REINIT, and it apparently does, but the changes only persist for the current session.  It sounds to me like a different acad.pgp is being loaded at startup than the one ALIASEDIT is finding.

 

@Anonymous  Did you know that you can also use the TAB key to cycle through all commands that match what you've already typed?  Your Alias is UCSF, but if you type USCF + Tab, you'll also get USCFOLLOW.

Message 5 of 16
rkmcswain
in reply to: nestly2

nestly2 wrote:

My understanding is the OP us using ALIASEDIT, which should automatically REINIT, and it apparently does, but the changes only persist for the current session.  It sounds to me like a different acad.pgp is being loaded at startup than the one ALIASEDIT is finding.

Yes, I think you're right since OP mentioned an OK and Close button which Notepad does not have.

I wonder how ALIASEDIT would read the wrong PGP file? Doesn't it open the same one that (findfile "Acad.pgp") [and AutoCAD] would find/use?

R.K. McSwain     | CADpanacea | on twitter
Tags (3)
Message 6 of 16
Anonymous
in reply to: nestly2


@nestly2 wrote:

I must be reading the problem differently.  My understanding is the OP us using ALIASEDIT, which should automatically REINIT, and it apparently does, but the changes only persist for the current session.  It sounds to me like a different acad.pgp is being loaded at startup than the one ALIASEDIT is finding.

 

@Anonymous  Did you know that you can also use the TAB key to cycle through all commands that match what you've already typed?  Your Alias is UCSF, but if you type USCF + Tab, you'll also get USCFOLLOW.




 

This is correct. I'm using the ALIAS (or ALIASEDIT as you say, both work the same way) command to enter my aliases. Although, I did use the REINIT command and that made it work. But then I closed AutoCAD and opened a new one, and the alias doesn't work again.

And yes, I did know you could use the tab button to scroll through past commands. I've just never grew accustomed to using that method.

Message 7 of 16
rkmcswain
in reply to: Anonymous

@Anonymous - try this.

 

Copy and paste this to the command line (including the parenthesis)

 

(startapp "Notepad" (findfile "acad.pgp"))

That will open the "acad.pgp" file that AutoCAD should be currently reading. Search this file for the shortcut you added.

Is it there?

 

Repeat this step *after* you run the ALIAS command too. Any differences?

 

 

R.K. McSwain     | CADpanacea | on twitter
Message 8 of 16
Anonymous
in reply to: rkmcswain


@rkmcswain wrote:

@Anonymous - try this.

 

Copy and paste this to the command line (including the parenthesis)

 

(startapp "Notepad" (findfile "acad.pgp"))

That will open the "acad.pgp" file that AutoCAD should be currently reading. Search this file for the shortcut you added.

Is it there?

 

Repeat this step *after* you run the ALIAS command too. Any differences?

 

 


Did it. Didn't notice any differences though.

Message 9 of 16
shujath36
in reply to: rkmcswain

I tried the same.  My case is is more mysterious, the opened file and the info from the ALIASEDIT command both shows my custom command in that but does not work. Like my left hand custom commands like R for line and C for Copy is mentioned in the .pgp file but does not work. The C works for circle and R gives "nil" return. 

 

In some cad sessions luckily it works but most of the time it gives up. My AutoCAD is 2017. (Windows 10, 64bit)

Message 10 of 16
ekJPG2Z
in reply to: drjohn

A command ... that requires you to ... RE-initialize the program???  Whatever that is.  Why?   Time moving backwards.  AND it doesn't tell you to do that.  It also pops the window behind the main ACAD window.  So you don't even know it's still running.  Wha?  what happened?  Oh.  

Message 11 of 16
Patchy
in reply to: ekJPG2Z

Back in 2000, Autodesk supplied this as a bonus tool for people with subscription

it wasn't written by Autodesk but it was handy for many people.

That's why you don't see any of the commands in Express Tools get updated.

 

Express.JPG

Message 12 of 16
Kent1Cooper
in reply to: ekJPG2Z

Could this all somehow be related to the fact that UCSFOLLOW is really a System Variable, not a command ?  For many years now, you've been able to type in System Variable names as if  they were command names [you couldn't always do that], but they're really not.  If the .pgp file is made to provide aliases for commands, maybe it shouldn't be expected to work with something that's not a command name.

Kent Cooper, AIA
Message 13 of 16
dany_rochefort
in reply to: Anonymous

As mentionned by @Kent1Cooper , UCSFOLLOW is a variable and not a command.  It's normal to get an error message saying "unkown command" ; because its not a command.

 

You can however control variables using a basic Lisp command like this: 

-------------------------------------

(DEFUN c:uu (/)
(setvar "ucsfollow" 1) ;Changing the UCS does not affect the current view
(princ)
)

(DEFUN c:uuu (/)
(setvar "ucsfollow" 0) ;Changing the UCS does not affect the current view
(princ)
)

---------------------------------

uu = ucsfollow set to 1

uuu = ucsfollow set to 0

Message 14 of 16
rkmcswain
in reply to: dany_rochefort

You could also toggle it with one command.

 

(DEFUN c:uf (/)
  (setvar "UCSFOLLOW"(boole 6 1(getvar "UCSFOLLOW")))
  (princ)
)
R.K. McSwain     | CADpanacea | on twitter
Message 15 of 16
Kent1Cooper
in reply to: rkmcswain


@rkmcswain wrote:

You could also toggle it with one command.

(DEFUN c:uf (/)
  (setvar "UCSFOLLOW"(boole 6 1(getvar "UCSFOLLOW")))
  (princ)
)

Or, in the case of a System Variable with only 0 and 1 values like this one, just subtract the current value from 1 to get the other value:

 

(defun C:UF ()
  (setvar 'UCSFOLLOW (- 1 (getvar 'UCSFOLLOW)))
  (princ)
)

Kent Cooper, AIA
Message 16 of 16
jmerod58
in reply to: Anonymous

  1. Enter OPTIONS on the command line or click Options under the application menu.
  2. Click the Open and Save tab.
  3. Change "Demand load ObjectARX apps" to "Object Detect & Command Invoke."
  4. Click OK on the Options window.

This worked for me today....

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta