PDA

View Full Version : Attribute not update why?



avinash patil
2016-03-15, 09:21 AM
Hi!

I want to update attribute thru autolisp. my code is not working. pls. help.

(ssget ":L" '((0 . "INSERT")))
(vlax-map-collection (setq ss (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))))
(function (lambda (b)
(foreach at (vlax-invoke b 'getattributes)
(if
(eq (vla-get-tagstring at) "3")
(setq strpld (vla-get-textstring at))
)
(setq strX (vl-string-search "x" strpld))
(setq strspace (vl-string-search " " strpld))
(setq oldt (substr strplD (+ strspace 2) (- strx STRSPACE 1))) ;Old text
(setq NewText (strcat (substr strpld 1 (+ strspace 1)) "1200" (substr strpld (+ strx 1) (strlen strpld))))
(if
(eq (vla-get-tagstring at) "3")
(vla-put-textstring at NewText )
)))))
(vla-delete ss)(princ)



Thanks,

Avinash

cadhelp Van
2016-03-17, 03:38 PM
It works fine on my PC. Check the attribute name. Or attach your drawing for a test.