We’re always talking about keeping your drawings clean. With just a little AutoLISP knowledge a beginner should be able write their own custom ZE command:ĭo you find yourself using Move Previous often? Automate it! But you still have to enter E to get Extents.
You can alias the command name, but you can’t include any options.įor example, Z is for Zoom. You probably are aware of the limitations of the Command Aliases found in the ACAD.pgp file. You can create your own keyboard short commands. You’ve just automated it! Almost any environment variable you can think of can be set this way. No longer do you need to open the Object Snap dialog and check and uncheck boxes. Not sure what your favorites add up to? Use (getvar “OSMODE”). 679 equates to the running osnaps I like. Make sure your OSNAP settings are always set the way you like them by using (setvar “OSMODE” 679). With just a basic level of AutoLISP knowledge, you should be able to do the following things.Ĭontrol your AutoCAD environment. Which leads us to the next section… Ways a Beginner Can Use AutoLISP To Automate Tasks That may appear to be a lot of stuff to know, but a little goes a long way with AutoLISP.
#PGP FILE AUTOCAD CODE#
There’s some 35 years of experience and code out there, and someone is always willing to help. Whether via AutoCAD’s own Help system or various sites and forums on the internet and Autodesk Knowledge Network, don’t hesitate to reach out.
#PGP FILE AUTOCAD HOW TO#
What else should a beginner know? You should know how to load external AutoLISP files (LOAD, APPLOAD, Drag and Drop), and how to identify the Function name needed to run them at the Command Line.įinally, you should know how to get help.
You should be aware that expressions can be nested, and that you evaluate them from the inside out. Without going into a dissertation on “Functional” languages, just remember that while we may tend to use AutoLISP in a procedural manner within a CAD program, it is much more powerful than that. In the simplest terms, those languages execute a line of code, move on to the next, and so forth until complete. That’s an important point, as it sets AutoLISP apart from other languages that are considered “Procedural” languages. Note: It’s important to note here that every Expression returns a value. Next, is that the function is always the first item (or ATOM) in a list. The basic rules of AutoLISP are that everything is contained within a set of parentheses. Syntax can be defined as the rules that any kind of language uses. Those are the ATOMS that follow the Function call in the expression. The functions that AutoLISP uses are called…FUNCTIONS-that’s easy! And FUNCTIONS sometimes require ARGUMENTS. In fact, the interpreter is built into AutoCAD, so you can run expressions right from the Command Line.Īs for basic Terminology and Syntax, you should know that items within a list are ATOMS. There’s no need to compile your code either. Note: One of the reasons AutoLISP is so easy for non-programmers (people like us) is that you don’t have to manage data types and memory allocation like other languages. Others include STRINGS, REAL numbers, and INTEGERS.
AutoLISP considers a LIST or a CONS as a data type. Of course, there are various data types you’ll need to be familiar with. You’ll need to know about them, whether they’re defined as a LIST, a CONS, a DOTTED PAIR, or an S-EXPRESSION (or just EXPRESSION for short). Everything in the language is a list in some form. I think it’s important for any AutoLISP user to know what it is. Right now, we’ll start at the very beginning.
#PGP FILE AUTOCAD SERIES#
This three-part series will help you become aware of the kinds of things you can do with AutoLISP at three levels of expertise: Beginner, Intermediate, and Advanced. It really doesn’t have to be, and even with just minimal knowledge, you can still accomplish a lot. You may not consider yourself a programmer, or it might just be intimidating. I just love AutoLISP, and I consider it my “home” language.īut I also understand that my love of the language isn’t universal.