The PICKSTYLE System Variable

Very quick tip to supplement the last post I wrote on Groups, which comes to us thanks to one of my subscribers named Santiago.

I mentioned that the behaviour when selecting a group is controllable using the groups dialog box by modifying the checkbox marked “selectable”. Well this corresponds to the system variable PICKSTYLE, so if you’re more of a keyboard user than a dialog box user, you can use that instead.

Knowing this system variable is also handy if you want to change the way groups work in LISP for example. Using something like:

(setvar “PICKSTYLE” 0) or (setvar “PICKSTYLE” 1)

will toggle group selection mode, so that you can use groups in your LISP routine how you want.

That’s all for today. Thanks again to Santiago, and I’ll post again soon.


How to use acad.lsp and acaddoc.lsp

Lisp is a very useful part of the AutoCAD® application, and one of the first things its good for you to know is how acad.lsp and acaddoc.lsp work. These two lisp files are automatically executed when certain conditions occur in AutoCAD.


Firstly, acad.lsp is by default executed when AutoCAD® first boots up. Therefore, this will run once only. Because of this it is a great place to put startup procedures, or things that you want to do to initialise AutoCAD®. For example, I have mapped commands to various key combinations under my left hand, including SS, DD and DA. The problem is, these are existing built in commands to AutoCAD®. The solution for me was to use the UNDEFINE command to remove the default commands from AutoCAD®, which would then allow my own customisations in acad.pgp to take priority. And acad.lsp is a great place to run these commands, like so:

(command “undefine” “ss”)
(command “undefine” “dd”)
(command “undefine” “ad”)

For those new to lisp, the lisp command at work here is “command”, which basically allows you to invoke any AutoCAD® command from lisp. The text provided in quotes will be executed as if you had entered them into the AutoCAD® command line.


So how does acaddoc.lsp differ? As the name suggests, this has something to do with documents. In fact this lisp file is run every time a document is opened. Therefore this is the perfect place to do anything that is specific to the drawing you are working on. For example, I have a few system variables that I like to be set a certain way. Annoyingly they are drawing specific, but using acaddoc.lsp we can set them to whatever we want when the drawing is opened:

; SKETCH produces polylines
(setvar “SKPOLY” 1)
; suppress “Would you like to convert to a polyline prompt”
(setvar “PEDITACCEPT” 1)
; set linetypes to be continuous on polylines
(setvar “PLINEGEN” 1)

Here are a few. For those learning lisp, the”setvar” lisp command tells AutoCAD® to set the value of a system variable (pretty obvious really!). Again, the arguments passed to it will have to correspond with how you’d enter them into the command line normally.

Where to save acad.lsp and acaddoc.lsp

The location of where to save acad.lsp or acaddoc.lsp depends on what you want to achieve, but it will only be loaded if it is found in one of your support paths, as specified in Options > Files > Support File Search Path. In the beginning, I assumed you could have many of these files in multiple support paths, but AutoCAD® will only load one. If there are many, AutoCAD® will load the first one that it finds in the order specified in your support paths. Support paths higher on the list will be searched before lower ones.

If you are working in a team that use several of the same lisp functions, a good idea is to place acad.lsp and acaddoc.lsp in some networked location, and add that location to you list of support paths. This is a much more manageable way, rather than trying to keep multiple files up to date on many computers. In order for these to run of course, it will have to be the first acad.lsp or acaddoc.lsp file that it finds, so you may have to rename or delete old versions of acad.lsp/acaddoc.lsp that already exist in local support paths.

So hopefully this has helped to understand acad.lsp and acaddoc.lsp. It’s pretty simple really, but knowing that little bit of extra detail can help to get things working the way that you want.

As always, I’d like to encourage newcomers to subscribe below, and you’ll get an email every time I write something new. If I don’t write anything, then you’ll get no email!


The XLine Command and Creating Levels in your Drawing

With the Ortho Mode and Polar Tracking at your disposal, you may be tempted to completely ignore the concept of construction lines. But I certainly still use them, as they are actually really useful for specifying a logical concept in your drawing – for instance, a level.

Basic usage of the XLINE command is simple. Enter XLINE at the command line, followed by two points that define an origin and a direction. There are additional options at the command prompt – H and V constrain the construction line to the Horizontal and Vertical directions respectively. A forces the xline to be drawn at a specific angle, which can also sometimes be useful. The O option is basically the same as the offset command, but forces the new line to be an XLINE rather than imitating whatever you selected. The B option I’ve never actually used before, but this option draws the XLINE that bisects, or is the midpoint of the angle you enclose with three points.

I mentioned that XLINEs are useful for levels, but when drawing a section or elevation with known levels, it can sometimes be clumsy inputting the elevations. For this reason, I always draw sections and elevations at their real world level in the Y direction.



Here for example, we are showing a level of 0, and 4 above some datum. Here it would be good practice to ensure that the level we have shown on the drawing is actually the level in the Y axis of the drawing. That way, we can be more certain that the drawing is correct. It also makes checking very easy using the ID command, by simply looking at whatever it says for the Y axis, and comparing with what we know it should be.

But there still is the problem of inputting the levels in a quick and elegant way. Up until recently, I had been using an XLINE drawn horizontally at a level of 0, and then offsetting upwards the amount required. This works, but it’s not the quickest way. A slight improvement is to invoke the XLINE command, press H for Horizontal, and then input a coordinate manually, using 0 (or any other number) for the X coordinate, and the desired level for the Y coordinate. This works, but still (for me) isn’t as elegant as it could be.

So instead, I decided to create a neat little lisp, for getting an XLINE at a specific level on the drawing:


This simple command asks you for a level, and an XLINE appears in your drawing at that level. It also scales what you enter by a factor of 1000, so that levels displayed in metres are instantly converted to millimetres. I’d suggest having a look at the lisp code, as it is really quite a good example of how a little bit of lisp can get a job done. It also gives you the opportunity to optimise the code for whatever units you are using.

All for now,