Jump to content

remove all fields inserted on each text & block attributes


Recommended Posts

Posted

hi, is there any lisp routine that can automatically remove all fields inserted on text & titleblock attribiutes without opening each sheet file one by one.

 

Your help is much appreciated.

 

thanks.

Posted

Not impossible to write, but so limited in purpose that I'm guessing it doesn't already exist.

Posted

I'd be interested to see how this is approached, my first thought would be to remove the ACAD_FIELD dictionary object from the object in question, but with a quick test, this does not seem to be successful.

Posted

hi leemac, it sounds not clear to me, if you don't mind can you explain it further more please. sorry for this.

 

thanks

Posted

I can't find where I got this from, AND it doesn't work across layouts for some reason, but just a start:

(defun C:Remove_Fields ( / del-field ss1 index item)
 (vl-load-com)
 (defun del-field (ent / edic elist etype obj val)
  (if
    (and
     (setq edic (cdr (assoc 360 (setq elist (entget ent)))))
     (dictsearch edic "ACAD_FIELD")
    )
    (progn
      (setq obj (vlax-ename->vla-object ent)
            etype (cdr (assoc 0 elist)) 
     )
     (cond
       ((= etype "DIMENSION")
        (setq val (vla-get-textoverride obj))
        (dictremove edic "ACAD_FIELD")
        (vla-put-textoverride obj val)
       )
       ((= etype "MTEXT")
        (setq val (vla-get-textstring obj))
        (dictremove edic "ACAD_FIELD")
        (vla-put-textstring obj val)
       )
       (T (dictremove edic "ACAD_FIELD"))
     )
   )
  )
 )
 (if
   (setq ss1
     (ssget "X"
       (list
         (cons 0 "TEXT,MTEXT,MULTILEADER,DIMENSION")
         (cons 67 1)
       )
     )
   )
   (progn
    (setq index 0)
    (repeat (sslength ss1)
      (setq item (ssname ss1 index))
      (if (del-field item) (entupd item))
      (setq index (+ 1 index))
    )
   )
 )
 (if 
  (setq ss1
    (ssget "X"
      (list (cons 0 "INSERT")
            (cons 67 1)
            (cons 66 1)
      )
    )
  )
  (progn
    (setq index 0)
    (repeat (sslength ss1)
      (setq item (ssname ss1 index))
      (while (= (cdr (assoc 0 (entget (setq item (entnext item))))) "ATTRIB")
        (if (del-field item) (entupd item))
      )
      (setq index (+ 1 index))
    )
  )
 )
 (princ)
)

  • Thanks 1
Posted

hi SteveK, your lisp works perfect. thanks so much.

Posted
hi SteveK, your lisp works perfect. thanks so much.

Great!

I just want to clarify it's not mine. :)

 

And I didn't think it works perfect, I remember last time I used it it saved the same value of an attribute tag on the current layout throughtout all the layouts :( So just beware if you have multiple layouts.

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