Message 1 of 2
Selecting Blocks if "xxx" specified chars included as attributes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey everyone, I was looking for a LISP that selects blocks includes "XXX" characters as attributes among selected items. I have a LISP in here, but having problem in selecting according to chars.
(defun c:NA001 ( / tag val newlist ss i e foundTagMatch)
;;;selecting and changing first part of selection. No Problem here
(setq tag '("ATTRIBUTE_TAG_01"))
(setq val '("ATTRIBUTE_VALUE_01"))
(setq newlist (mapcar 'cons tag val))
(if (setq ss (ssget "I" '((0 . "INSERT")(66 . 1))))
(repeat (setq i (sslength ss))
(setq e (vlax-ename->vla-object (ssname ss (Setq i (1- i)))))
(foreach itm (vlax-invoke e 'GetAttributes)
(if (setq foundTagMatch (assoc (strcase (Vla-get-tagstring itm))
newlist
))(Vla-put-textstring itm (cdr foundTagMatch)))
)))(princ)
;;;selecting and changing second part of selection. No Problem here
(setq tag '("ATTRIBUTE_TAG_02"))
(setq val '("ATTRIBUTE_VALUE_01"))
(setq newlist (mapcar 'cons tag val))
(if (setq ss (ssget "I" '((0 . "INSERT")(66 . 1))))
(repeat (setq i (sslength ss))
(setq e (vlax-ename->vla-object (ssname ss (Setq i (1- i)))))
(foreach itm (vlax-invoke e 'GetAttributes)
(if (setq foundTagMatch (assoc (strcase (Vla-get-tagstring itm))
newlist
))
(Vla-put-textstring itm (cdr foundTagMatch)))
)))(princ)
;;;selecting and changing last part of selection. Need Help in here
(setq tag '("ATTRIBUTE_TAG_02"))
(setq val '("ATTRIBUTE_VALUE_02"))
(setq newlist (mapcar 'cons tag val))
(if (setq ss (ssget "I" '((0 . "INSERT")(66 . 1)))) ;in here, i need to select "XXX" included attribute values
(repeat (setq i (sslength ss))
(setq e (vlax-ename->vla-object (ssname ss (Setq i (1- i)))))
(foreach itm (vlax-invoke e 'GetAttributes)
(if (setq foundTagMatch (assoc (strcase (Vla-get-tagstring itm))
newlist
))
(Vla-put-textstring itm (cdr foundTagMatch)))
)))(princ)
)