Jump to content

Replace the attribute value


DuanJinHui

Recommended Posts

Hello! everybody. Merry Christmas!

 

I've done a little bit of searching for this, but have not found what I've needed.

but would like to know if anyone has come up with a lisp solution.

 

in modelspace . some attribute block, one attribute tag is "DR_DATE" , I want replace value of this tag .

 

PS. Not replace all attribute block, only selection area . the new value I need input.

 

 

Thanks!

Link to comment
Share on other sites

Something like this ?

 

(defun c:TesT (/ st ss)
 ;; Tharwat 25.12.2014    ;;
 (if (and (/= "" (setq st (getstring t "\n Specify new value :")))
          (princ "\n Select Attributed blocks ...")
          (ssget "_:L" '((0 . "INSERT") (66 . 1)))
     )
   (vlax-for x (setq
                 ss (vla-get-ActiveSelectionSet
                      (vla-get-ActiveDocument (vlax-get-acad-object))
                    )
               )
     (mapcar '(lambda (a)
                (if (eq (strcase (vla-get-tagstring a)) "DR_DATE")
                  (vla-put-textstring a st)
                )
              )
             (vlax-invoke x 'getattributes)
     )
   )
 )
 (if ss
   (vla-delete ss)
 )
 (princ)
)(vl-load-com)

Link to comment
Share on other sites

Something like this ?

 

(defun c:TesT (/ st ss)
 ;; Tharwat 25.12.2014    ;;
 (if (and (/= "" (setq st (getstring t "\n Specify new value :")))
          (princ "\n Select Attributed blocks ...")
          (ssget "_:L" '((0 . "INSERT") (66 . 1)))
     )
   (vlax-for x (setq
                 ss (vla-get-ActiveSelectionSet
                      (vla-get-ActiveDocument (vlax-get-acad-object))
                    )
               )
     (mapcar '(lambda (a)
                (if (eq (strcase (vla-get-tagstring a)) "DR_DATE")
                  (vla-put-textstring a st)
                )
              )
             (vlax-invoke x 'getattributes)
     )
   )
 )
 (if ss
   (vla-delete ss)
 )
 (princ)
)(vl-load-com)

 

Mr.Tharwat. It's good . very very very good! Thank you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...