Jump to content

I need to delete all attributes


Dustyg

Recommended Posts

Thanks for the quick response. I understand I can turn the display of the attributes off. I really just wanted to delete them all. I was hoping it would shrink the size of the drawing. Is there a lisp routine that will do this?

Link to comment
Share on other sites

Thanks for the quick response. I understand I can turn the display of the attributes off. I really just wanted to delete them all. I was hoping it would shrink the size of the drawing. Is there a lisp routine that will do this?

 

For clarification, typically attributes are not in model space themselves per-se, but rather components of individual block instances.

 

That leaves few options, with some pretty severe side effects potentially.

 

More specifically, if one removes all attributed blocks, or steps through to remove all nested attributes respectively, then something [bad?] happens to the drawing output. Does that make sense?

 

So, specifically, what is it you're trying to do?

Link to comment
Share on other sites

Here's a quicky... worked the few times I tried it

you might want to back up prior to use (see post #4). Unless you work for yourself, someone may not like the results. And I kinda doubt if it will affect the size of the file much.

(defun c:test ()
 (vl-load-com)
 (setq ss1 (ssget "X" '((0 . "INSERT")))
   idx -1)
 (repeat (sslength ss1)
   (setq obj (vlax-ename->vla-object (ssname ss1 (setq idx (1+ idx)))))
   (if
     (= (vlax-get-property obj 'HasAttributes) :vlax-true)
     (progn
     (setq var (vlax-invoke-method obj 'getattributes)
           atts (vlax-safearray->list (vlax-variant-value var))
           cnt -1
   )
       (repeat (length atts)
         (setq attref (nth (setq cnt (1+ cnt)) atts))
         (vlax-invoke-method attref 'Delete)
       )
     )
  )
 )
(princ)
)

Link to comment
Share on other sites

If Lpseifert's routine doesn't reduce the file size to your liking, you might try posting the drawing so we can cull it for other information. You may have an extensive amount of object data (OD), extended data (XD), or otherwise...?

Link to comment
Share on other sites

Here's a quicky... worked the few times I tried it

you might want to back up prior to use (see post #4). Unless you work for yourself, someone may not like the results. And I kinda doubt if it will affect the size of the file much.

(defun c:test ()
 (vl-load-com)
 (setq ss1 (ssget "X" '((0 . "INSERT")))
   idx -1)
 (repeat (sslength ss1)
   (setq obj (vlax-ename->vla-object (ssname ss1 (setq idx (1+ idx)))))
   (if
     (= (vlax-get-property obj 'HasAttributes) :vlax-true)
     (progn
     (setq var (vlax-invoke-method obj 'getattributes)
           atts (vlax-safearray->list (vlax-variant-value var))
           cnt -1
   )
       (repeat (length atts)
         (setq attref (nth (setq cnt (1+ cnt)) atts))
         (vlax-invoke-method attref 'Delete)
       )
     )
  )
 )
(princ)
)

 

The routine seemed to have worked and it decreased the size from 49mb to 25mb. When you said I may not like the results did you have anything in mind? Are there errors I should look for?

Link to comment
Share on other sites

The routine seemed to have worked and it decreased the size from 49mb to 25mb. When you said I may not like the results did you have anything in mind? Are there errors I should look for?

 

Not so much error messages, as this, removing all attributes, will obviously remove information from the drawing. That you know, I simply mean to point out that if these drawings are for plans production, then obviously there is information missing, that will no longer be displayed with the resulting plan sheets (assuming the attributed blocks were displayed in the first place). Make sense?

Link to comment
Share on other sites

Thanks for answering for me RenderMan!

When you said I may not like the results did you have anything in mind?

I meant that maybe your colleagues might adamantly ask "Where the f did my attributes go?"

Edited by lpseifert
Link to comment
Share on other sites

As far as I know that won't delete the attributes that are attached.

if you redefine a block by erasing the attributes and then ATTSYNC the block all blocks will be updated with their attributes missing.

Link to comment
Share on other sites

Another option is to explode all the block with the attributes inside them then do a qselect to select them all then delete! If you use the attmode variable in your drawing and you have attribute info on your title blocks they will switch them all off.

 

Andrew

Wales

UK

Link to comment
Share on other sites

yes I have purged the drawing. I also used the routine that lpseifert provided. It worked great and decreased the size of the drawing by more than half.

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