
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am the new to LISP coding. So I used @Lee_Mac's code https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dwgprefix-and-dwgname-to-attribute-t... to make a code to update attribute according to layout (tab) name. However, all the attribute will change to one single tab name, depending on which tag I will run the script.
(command "TILEMODE" "0")
(defun c:dwgatt ( / e f i s v x )
(setq v (strcase (getvar "ctab")))
(if (setq s (ssget "_X" '((0 . "INSERT") (2 . "BLOCK") (66 . 1))))
(repeat (setq i (sslength s))
(setq e (entnext (ssname s (setq i (1- i))))
x (entget e)
f nil
)
(while (and (not f) (= "ATTRIB" (cdr (assoc 0 x))))
(if (= "TAG" (strcase (cdr (assoc 2 x))))
(setq f (entmod (subst (cons 1 v) (assoc 1 x) x)))
)
(setq e (entnext e)
x (entget e)
)
)
)
)
(princ)
)
(c:dwgatt)
How do I simplify the script so it will change the attribute in one single layout?
I tried to edit the code but nothing shows up.
(command "TILEMODE" "0")
(defun c:dwgatt ( / v s x )
(setq v (strcase (getvar "ctab")))
(setq s (ssget "_X" '((0 . "INSERT") (2 . "BLOCK") (66 . 1))))
(setq x (entget (ssname s 0)))
(if (= "ATTRIB" (cdr (assoc 0 x)))
(= "TAG" (strcase (cdr (assoc 2 x))))
)
(princ)
)
(c:dwgatt)
Thanks,
Charlie
Solved! Go to Solution.