Jump to content

Batch replace the attribute value


DuanJinHui

Recommended Posts

Dear.All

 

Before, I had requested a thread at here:

http://www.cadtutor.net/forum/showthread.php?90216-Replace-the-attribute-value&highlight=DuanJinHui

 

(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 helped me.

But this can only replace one attribute value (TAG=“DR_DATE”)

If I want replace another attribute value . I need modify the source code. :(

 

I have a idea. use dialog to choose Tag and modify attribute.

 

Batch Replace Attribute.png

 

Here is DCL code . I don't know coding this .

I need help ! I really appreciate it.

 

BRA:dialog {
   label = "Batch Replace Attribute" ;
   :boxed_row {
       label = "TAG" ;
       :column {
           :radio_button {
               key = "K1" ;
               label = "TAG1" ;
           }
           :radio_button {
               key = "K2" ;
               label = "TAG2" ;
           }
           :radio_button {
               key = "K3" ;
               label = "TAG3" ;
           }
           :radio_button {
               key = "K4" ;
               label = "TAG4" ;
           }
           :radio_button {
               key = "K5" ;
               label = "TAG5" ;
           }
           :radio_button {
               key = "K6" ;
               label = "TAG6" ;
           }
           :radio_button {
               key = "K7" ;
               label = "TAG7" ;
           }
           :radio_button {
               key = "K8" ;
               label = "TAG8" ;
           }
       }
   }
   :spacer {}
   :edit_box {
       key = "Val" ;
       label = "Value:" ;
   }
   :spacer {}
   :row {
       ok_cancel;
   }
}

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...