;;;Change a selection of attributes to user-specified layer. ;;; ;;; WRITTEN FOR STEVE AT RKA TO BE ABLE TO CHANGE THE LAYER OF A SET OF ;;; ATTRIBUES TO A USER-SPECIFIED LAYER. ;;; ;;; ;;; IT CAN BE EASILY MODIFIED TO CHANGE ANY OTHER PROPERTY ALTHOUGH LAYER IS ;;; PROBABLY THE MOST PRACTICAL ONE. ;;; ;;; Written by: Kanwar Anand ;;; KETIV Technologies, Inc. Fullerton ;;; June 1989 ;;; ;;; Modified for Cooper at CDM September 1990 ;;; (defun c:attlay () (setq blnam (strcase (getstring "\nName of block to change : "))) (setq attnam (strcase (getstring "\nAttribute tag to change layer for : "))) (setq lay (strcase (getstring "\nNew layer name: "))) (while (= (tblsearch "layer" lay) nil) (prompt "Layer ") (princ lay) (princ) (setq lay (strcase (getstring " does not exist. Try again: "))) ) (setq newlay (cons '8 lay)) (setq set nil) (prompt "\nSelect the occurences of " ) (princ attnam)(princ) (prompt " to edit : ") (setq set (ssget)) (if (= set nil) (setq set (ssget "X" (list (cons 2 blnam)))) (progn (setq setlen (sslength set)) (setq count 0) (setq setnew (ssadd)) (while (< count setlen) (setq entnam (ssname set count)) (if (and (= (cdr (assoc 0 (entget entnam))) "INSERT") (= (cdr (assoc 2 (entget entnam))) blnam) ) (setq setnew (ssadd entnam setnew)) ) (setq count (+ 1 count)) ) (setq set setnew ) ) ) (setq setnlen (sslength set)) (setq cnt 0) (while (< cnt setnlen) (setq entnnam (ssname set cnt)) (setq entatt (entnext entnnam)) (while (/= (cdr (assoc 2 (entget entatt))) attnam) (setq entatt (entnext entatt)) ) (setq entn (entget entatt)) (setq entn (subst newlay (assoc 8 entn) entn)) (setq entn (entmod entn)) (setq entatt (entupd entatt)) (setq cnt (+ 1 cnt)) ) (setq blnam nil attnam nil lay nil newlay nil attnam nil entatt nil entnnam nil entn nil) (princ) )