Auto/Visual Lisp

Oct 17, 2003 1 Replies

Lookin for some help with a routine that i would like to create so when the user is prompt to select a type of Pline to draw, the routine will set the layer, linetype, color and other variables.. I'm a newbie to programming so tryin to work on somethin small to wet my feet as per say into this deep pool of confusion.. any help with how to set the routine, coding and just general programming would be greatly appreciated? Also i'm lookin for a used copy of " Autolisp in Plain English" by George O. Head, a newer revised copy would be great thanks..



Thanks for any help.. Andre


Retrieving/setting variables is quite simple. If you haven't yet, start looking through all of the variables. Check the following, because I may mispell a few.

;store current settings (setq clay (getvar "CLAYER") cltp (getvar "CELTYPE") ccol (getvar "CECOLOR") );setq ;set to desired values (setvar "CLAYER" "MyLayer") (setvar "CELTYPE" "HIDDEN") (setvar "CECOLOR" 120)

;your pline creation code here ;this can actually be a little complicated

;being polite, set them back to their old setting (setvar "CLAYER" clay) (setvar "CELTYPE" cltp) (setvar "CECOLOR" ccol)

A note on layers: If you want to make sure a layer is available, use the command line layer command's make option. This will create the layer if it doesn't yet exist. Not very elegant code, but extremely effective.........which (IMO) should be the point.

(command "-layer" "M" "MyNewLayer" "")

You could/should probably set color/ltype options for the layer here as well.

Great (actually an understatement) book for a beginner. If I could find mine, I'd send it.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required