Search the Community
Showing results for tags 'exist'.
-
Layer Create or Set Current if already existing
clint0577 posted a topic in AutoLISP, Visual LISP & DCL
I have a routine that I've been using but I would like to modify it just a bit. The function is for creating Deed Sketches that allows the user to create a new layer and select a color. It works great but if you happen to exit the command, and need to start again, it still asks for a new layer. I would like to change the code to have the option to first, USE THE CURRENT LAYER. If not then I would have the option I already have, which is to create the new layer but then I need to, if that layer already exists, set it to current. Here is that portion of the code. I've tried tons of different ways but I know just enough about lisp routines to get myself into trouble. ;main program (DEFUN C:deed () (while (or (not (snvalid (setq name (getstring t "\nSpecify Layer Name: ")))) (tblsearch "LAYER" name) ) (princ "\nLayer Name Invalid or Already Exists.") ) (if (setq color (acad_colordlg 7 nil)) (entmake (list (cons 0 "LAYER") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbLayerTableRecord") (cons 2 name) (cons 70 0) (cons 62 color) ) ) ) (command "layer" "s" NAME "")