Hi,
I'm working on a LISP function that adds a predeterminated string to each layername in the dwg.
I came up with this:
(SETQ prefix "A-_82-_")
(TBLNEXT "LAYER" T)
(WHILE (SETQ la (TBLNEXT "LAYER"))
(SETQ old (ASSOC 2 la)
new (CONS 2 (STRCAT prefix (CDR old)))
);setq
(SETQ la (SUBST new old la))
(princ "\nla is: ")(princ la) (princ "\n")
(ENTUPD la)
(ENTMOD la)
);while
(TBLNEXT "LAYER" T)
The line (princ "\nla is: ")(princ la) (princ "\n") is thrown in to enable me to see the result of the while function, and is to be removed from the final version.
Now, everything seems to work fine, as the princ shows on the acad textstcreen.
Yet, when I check the layer palette, all layernames remain unchanged.
My guess is that I should use some other function then ENTMOD or ENTUPD to change the layertable, but I'm at a bit of a loss as to which function is required.
Any ideas anyone?
Cheers,
Steven
This may help .....
(setq prefix "A-_82-_") (While (setq la (TBLNEXT "LAYER" (null la))) (setq lay (entget (tblobjname "LAYER" (setq Nme (cdr (assoc 2 la)))))) (if (not (eq Nme "0")) (entmod (subst (cons 2 (strcat prefix (setq old (cdr (assoc 2 lay))))) (assoc 2 lay) lay ) ) ) )
Tharwat