Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to loop through block and retrieve attributes into a list of dotted pairs (tag . value).
In row 20 the code runs into an error "error: bad function: "VALUE"" where VALUE is the attribute value. However if I do this row by row from command prompt I'm able to store these values without any errors. While loop and cond seems to work fine. What am I missing here?
(defun c:listAttributes (/ attributes endseq currentBlock entTemp keyword attTag attValue)
(setq currentBlock (entget (car (entsel))))
(setq endseq nil)
(setq entTemp currentBlock)
(while (null endseq)
(setq entTemp (entget (entnext (cdr (assoc -1 entTemp)))))
(setq keyword (cdr (assoc 0 entTemp)))
(cond
( (= keyword "ATTRIB")
(
(setq attValue ((cdr (assoc 1 entTemp))))
(setq attTag (cdr (assoc 2 entTemp)))
(setq attributes (append attributes (list (cons attTag attValue))))
)
)
( (= keyword "SEQEND")
(setq endseq T)
)
(t nil)
)
)
)
Solved! Go to Solution.