Adding aliases for custom AutoCAD commands
I had an interesting question come in by email and thought I'd share it via this post. To summarise the request, the developer needed to allow command aliasing for their custom commands inside AutoCAD. The good news is that there's a standard mechanism that works for both built-in and custom commands: acad.pgp.
acad.pgp is now found in this location on my system:
C:\Documents and Settings\walmslk\Application Data\Autodesk\AutoCAD 2008\R17.1\enu\Support\acad.pgp
We can edit this text file to add our own command aliases at the end:
NL, *NETLOAD
MCC, *MYCUSTOMCOMMAND
Here we've simply created an alias for the standard NETLOAD command (a simple enough change, but one that saves me lots of time when developing .NET modules) and for a custom command called MYCUSTOMCOMMAND. If I type NL and then MCC at the AutoCAD command-line, after saving the file and re-starting AutoCAD, I see:
Command: NL
NETLOAD
Command: MCC
Unknown command "MYCUSTOMCOMMAND". Press F1 for help.
Now the fact that MCC displays an error is fine - I don't actually have a module loaded that implements the MYCUSTOMCOMMAND command - but we can see that it found the alias and used it (and the MYCUSTOMCOMMAND name could also be used to demand-load an application, for instance).

Subscribe via RSS
Mr. Walmsley,
I hope you don’t mind if I post this question for you. I'm the CAD Manager of a Civil Engineering firm. We're currently using Civil 3D 2008 and Land Desktop Companion 2008 with service pack 2. An employee that used to work with us still helps out when available. He is a programmer. He has written an application which he installed on the 2002 products and upgraded to the 2006 products. He has come across a problem trying to tweak this application and get it to work with our 2008 products. Programming is not my strong point. Is there anyway I could email you the document where he describes in programming language his issues, and hopefully you can lead us in the right direction? I'm not sure how to attach it here. Any help is greatly appreciated.
Thanks
Jason
Posted by: Jason Fox | January 31, 2008 at 02:09 PM
Hi Jason,
Frankly, I doubt I'll be able to help: I have little to no knowledge of either LDT or Civil 3D development.
The best source of help is likely to be the Civil 3D Customization Discussion Group, or the ADN website - where you can submit your questions if you happen to be an ADN member.
You can certainly email me the document, in case I happen to be able to help off the top of my head, but unfortunately I don't have the luxury of being able to spend time working on this type of issue, myself.
Regards,
Kean
Posted by: Kean | January 31, 2008 at 02:52 PM
Good morning Kean.
You can also use the REINIT command to reload the PGP file after you change it. I use this command quite a lot, which saves me from closing all my drawings and restarting Autocad after I make some changes.
Have a good day.
Jason
Posted by: Jason | January 31, 2008 at 03:26 PM
Very cool - thanks for the tip, Jason!
Kean
Posted by: Kean | January 31, 2008 at 03:42 PM
Mr. Walmsley,
Thanks for your quick response. I have posted on the dicussion group and am waiting for responses. I totally understand you not having enough time to dig in to this problrm. I still appreciate your feedback. Even though programming is not my strong point, I think you have an interesting blog. Again, thanks. Take it easy.
Jason
Posted by: Jason Fox | January 31, 2008 at 04:19 PM
Starting in 2006?, the pgp file can be edited from Express/ Tools/ Command Alias Editor. Not only does this allow edits on the fly, but when the ap closes it updates your current session. Also changes made to your pgp in a text editor do not migrate to new versions, saving time in getting started out of the box. Personally I find it much easier to use. The Command Alias Editor also allows you to scroll lists of available commands and abbreviatons/ aliases to add/ modify/ or remove.
Posted by: Clint | February 07, 2008 at 04:14 PM
Interesting - thanks, Clint.
Kean
Posted by: Kean | February 07, 2008 at 05:25 PM
hellllllllllo
Posted by: engr. juhairy | May 26, 2008 at 02:02 PM