Hi,
This routine has to change the value of a label if it is equal to the old value.
I can not figure out what to write to store the new value.
I hope someone help me to understand ...
Attached dwg files and lsp
Thanks.
bb
Code:
;;This routine should look for attributes in blocks with the tag specified by the operator.
;;;If the label is the law and if its value is equal to old_value changes with the new value.
;;NAME TAG: NAME, SURNAME, NATION, CITY
;;example if value of city is equalk to york change value in tokio
(defun c:chValue ()
(vl-load-com)
(setq tag (getstring "\n Enter name tag: "))
(setq old_value (getstring "\n Enter old value: "))
(setq new_value (getstring "\n Enter new value: "))
(if (setq ss (ssget "X" (list (cons 0 "INSERT") (cons 66 1)
(if (getvar "CTAB")
(cons 410 (getvar "CTAB"))
(cons 67 (- 1 (getvar "TILEMODE"))))))
);setq
(progn
(setq eLst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
(foreach e eLst
(setq bEnt (cdr (assoc 2 (entget e))))
(setq aEnt (entnext e))
(while (= "ATTRIB" (cdr (assoc 0 (setq aEntLst (entget aEnt)))))
(if (= (cdr (assoc 2 aEntLst)) tag)
(progn
(setq aVal (cdr (assoc 1 aEntLst)))
(if ( = aVal old_value)
(alert "What should I write to store the new value?")
);if
);progn
);if
(setq aEnt (entnext aEnt))))
);while
(progn
(princ "\n No block with attribute.")
);progn
);if
(alert "ok changed values")
(princ)
);def