Friday, June 26, 2009

Them there pesky variables

I'm now working on another computer, and I have just realised how many things Autocad sets a certain way, which mostly I want to change.

For instance, VTENABLE. Hmm.....let me see...do I want pretty zooms or fast zooms? Set to 3 huh? Let's just chop that down to 0. That's better!

That is an example of a variable you can set once and it stays that way. There are others, which appear to be related to the drawing at hand, and for these I have a "blast 'em all" lisp that knocks them into the way I like them, at the same time sets all the layers that I use as standard.

I call this one Layset.lsp (It sets the layers!)- It does the extra task of creating variables for the layer names. You can see the variables, just at the top of the routine.

The plan here is that if you want to force something onto the "Medium" layer, then another lisp is used, mm.lsp and this makes use of the variable set up in Layset to change the item chosen to the preferred layer.

A full explanation of this system can be found on my website, http://www.bilroCAD.com

Notice it does not have to worry about what that layer might be called. The ; marks are ignored by Autocad, ie they are used for comments. Here it is:

;Program written by Bill Le Couteur
;Auckland NZ
;Rev 0 date 18/8/97
;This program sets up layers
;the idea is that layer names are set ONLY
;by this routine...and this routine is run every time you open a drawing
;so if as a contractor you change employers, YOU ONLY
;HAVE TO CHANGE THIS ROUTINE
(defun c:layset()
(setvar "CMDECHO" 0) ;just hides the display related to this routine
(setvar "HIDEPRECISION" 1);when plotting, if this is set to 0, sometimes cylinders are missing
;a vertical line
(setvar "facetratio" 1); improves the quality of meshes for cylinders etc
(setvar "dispsilh" 1);suppresses the mesh display of solids
(setvar "facetres" 7);improves the smoothness of shaded objects etc
(setq the_layer (getvar "clayer"))
(setq laycentre "cl")
(setq laydim "dim")
(setq layhid "hid")
(setq laymedium "MED")
(setq laylight "LGT")
(setq layheavy "HVY")
(setq layphantom "pha")
(setq laytext "text")
(command "viewres" "" 50)
(command "-layer" "m" laycentre "c" "6" laycentre "lt" "centerx2" laycentre
"m" laydim "c" "1" laydim
"m" layhid "c" "6" layhid "lt" "hiddenx2" layhid
"m" laymedium "c" "2" laymedium
"m" laylight "c" "7" laylight
"m" layheavy "c" "4" layheavy
"m" layphantom "c" "252" layphantom "lt" "phantomx2" layphantom
"m" laytext "c" "4" laytext
"s" the_layer "")
(setvar "blipmode" 0)
(setvar "ltscale" 4)
(command "regenall")
(setvar "CMDECHO" 1)
(princ)
)

No comments: