I have a lisp that selects a block and gets all the attribute tags and values and writes them to a list.
I would also like to write the Prompt string to a list, but there does not appear to be a entity group code for Prompt like there is for Tag and Value. Anyone have any ideas ?
Here is my code:
Code:
(defun c:attlist (/ taglist vallist blkatt BORSS ename ATTAG ATTVAL
attcurtag attcurval get_blk blkename)
(setq get_blk
(car (entsel "\nPick a BLOCK to find the Attribute Tag and Value: "))
)
(setq BORSS (entget get_blk))
(if (= (cdr (assoc 0 BORSS)) "INSERT")
(progn
(setq blkatt BORSS)
(setq blkename (cdr (assoc -1 blkatt)))
(if (= (cdr (assoc 66 blkatt)) 1)
(progn
(while (/= "SEQEND" (cdr (assoc 0 blkatt)))
(setq ATTAG (cdr (assoc 2 blkatt))) ;Definition
(setq ATTVAL (cdr (assoc 1 blkatt))) ;value
(setq attcurtag (list ATTAG))
(setq attcurval (list ATTVAL))
(setq taglist (append attcurtag taglist))
(setq vallist (append attcurval vallist))
(setq blkatt (entget (setq blkename (entnext blkename))))
)
)
(princ)
)
(princ)
)
(princ)
)
(if vallist (setq vallist (cdr (reverse vallist))))
(if taglist (setq taglist (cdr (reverse taglist))))
(princ "\nValues: ")
(print vallist)
(princ "\nTags: ")
(print taglist)
(princ)
)