Hi guys,
I wrote some code to change attributed value in all blocks in a drawing. While executing command Acad perform the operation only for first block of selection set and gives error.
Error is - ; error: bad argument type: lentityp ((-1 . <Entity name: 7ef0fc90>) (0 . "ATTRIB") (330 . <Entity name: 7ef0fc78>) (5 . "37A") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "G-ANNO-TEXT") (100 . "AcDbText") (10 209.177 -1.01067 -4.91332e-047) (40 . 0.860742) (1 . "54") (50 . 0.0) (41 . 1.0) ..................
code is -
(setq ss (ssget "_X" '((0 . "INSERT") (66 . 1))))
(while (/= (sslength ss) 0)
(setq ssfi (ssname ss 0))
(setq ssx (entnext ssfi))
(setq ssy (entget ssx))
(while (/= (cdr (assoc 1 (entget ssx))) "XYZ")
(setq ssx (entnext ssx))
)
(if (= (cdr (assoc 1 (entget ssx))) "XYZ")
(progn
(setq ssx (entget ssx))
(setq newVal "54")
(setq ssx (subst (cons 1 newVal) (assoc 1 ssx) ssx))
)
)
(entmod ssx)
(entupd ssx)
(ssdel ssfi ss)
)
Drawing file attached.
I dont know where I made mistake.
Please help.