Command aliases in AutoCAD

AutoCAD 12 and higher versions


In support folder under AutoCAD install directory ( After AutoCAD 2005, directory is c:\Program Files\AutoCAD200x\Support ), there is a file named as acad.pgp. Short aliases that are used for AutoCAD commands are listed inside this file.
 
Fig.1
Fig. 1

Aliases of most of the commands can be found here. You can also edit this file, but you should definitely take a backup first. However, definitions here are aliases of standard commands and I suggest that you should not change the alias definitions. By this way, you can form up a common language with your friends in group works and computer sharing. Below, you can find alias definition format that is used in this file:
ALIASE, *COMMAND

It has a simple file structure. You can also add new lines to this file for your own aliases. You can assign more than one alias to a command. Thus, you don’t have to delete the original. Following set of commands is a good example for this:
L, *LINE
LI, *LINE

However, PGP file will be inadequate for the commands that have options. For example, you might think that, it would be a great idea to use ZE for ZOOM/EXTENTS command. You might even be using your own files. In order to make these kinds of aliases, we can use AutoLISP(TM). You can learn more about AutoLISP by looking at AutoLISP part of our website that is prepared by Orhan TOKER. Here, I will simply explain about ‘how to make a new command in AutoCAD’. First of all, we need an AutoLISP page. As this stage, you can get use of any text editor program( NOTEPAD.EXE ). Create a new file named as
"c:\Program Files\AutoCAD200x\Support\aliases.lsp".

Now, add the following code into this file:
(defun c:ze() (command “_.ZOOM” “_E”) (princ))

If I roughly explain the logic, then it will be like this:
(defun c:ALIAS() (command “_.COMMAND” “OPTIONAL”) (princ))

If some certain commands, you have to press ENTER or SPACE buttons to complete the command. In order to achieve this, you have to use  “” as an option. For example, for ERASE/ALL ( it is a dangerous command), you have to use the following code:
(defun c:EA() (command “_.ERASE” “_ALL” “”) (princ))

I would like to remind you once more that the code that is used in this example will delete all of the entities inside the drawing. By using this methodology, you can create aliases that is most suitable for your work style. (You can download the example file from here). Now, let’s take a look at how the file that we created will be automatically loaded when AutoCAD first opens:

Fig.2
Fig. 2

If you are not comfortable with this operation, then I suggest that you should take help from an expert. First of all, take a backup of the
"c:\Program Files\AutoCAD200X\Support\Acad200Xdoc.lsp"

file. Now, add the code that you can see in Fig. 2 at the end of this file ( Note: Download tal_macro.lsp file from here and copy into the
"c:\Program Files\AutoCAD200X\Support"

directory ). After this stage, save and close the file. From now on, every time you open AutoCAD, then you command aliases will be ready. In the following example, I am giving you the complete list of all of the aliases. Please try to understand the logic by using the tal_macro.lsp file, and make up your own list. The way of learning does not go though copying :)

Files : tal_macro.lsp

Technorati Tags: , , ,

Related Posts with Thumbnails
blog comments powered by Disqus

blogroll

Connect