A robust SteLayer call needs to include a god bit off error trapping
- ;++++++++++++ Make Layer Current +++++++++++++++++++++++++++++++++(defun SetLayer (name / ldef flag) (cond ((or (not name) (not (snvalid name)))(princ "\nBad Aurgment Passed To SetLayer - ")(prin1 name)(exit))) (command "_.LAYER") (if (not (tblsearch "LAYER" name)) (command "_Make" name) (progn (setq ldef (tblsearch "LAYER" name) flag (cdr (assoc 70 ldef))) (and (= (logand flag 1) 1) (command "_Thaw" name)) (and (minusp (cdr (assoc 62 ldef))) (command "_On" name)) (and (= (logand flag 4) 4) (command "_Unlock" name)) (and (= (logand flag 16) 16) (princ "\nCannot Set To XRef Dependent Layer") (quit)) (command "_Set" name))) (command "") name)
The (exit) call is totally up to you and your style of coding.
-David |