AutoLISP: Delete Invisible Attributes

Link to AutoCADtips

There are times when sending or submitting drawings to client or another drafter when the blocks in your drawings contain many attributes – some of which may be set to Invisible. And if you have ever wanted to delete invisible attributes, this routine is for you.

Warning: this does not work when trying to delete ALL attributes even if they are all set to invisible. At least one attribute has to be set to visible for this routine to work.

In case you are wondering how to set Attribute Visibility:

When creating an attribute you can toggle the visibility (as seen below)

Or when using the BATTMAN command you can edit which attributes are visible or invisible (seen below)

Another LISP routine [found here] allows you to select different instances of a block and toggle the visibility. Note: the DIA.lsp routine uses the command ATTSYNC which will synchronize all instances of a block based on the one you select.

Here’s how:

  • DIA <enter> to start
  • Type in the name of the block <enter>

that’s it

;;; By Lee-Mac http://www.theswamp.org/index.php?topic=36280.0
(defun delInvisAtts ( bname ) (vl-load-com)
(if (tblsearch "BLOCK" bname)
(vlax-for obj
(vla-item
(vla-get-blocks
(vla-get-activedocument (vlax-get-acad-object))
)
bname
)
(if (and (eq (vla-get-objectname obj) "AcDbAttributeDefinition")
(eq (vla-get-invisible obj) :vlax-true)
)
(vla-delete obj)
)
)
)
)
(defun c:DIA ( / bn )
(delInvisAtts (setq bn (getstring t "\nBlock Name: ")))
(vl-cmdf "_.attsync" "_N" bn)
(princ)
)
Advertisements

About AutoCAD Tips

This blog serves as a knowledge base for myself (and anyone else) so that I can reference tips & tricks that I have learned and also refer others to it as well. I hope that this blog helps you learn at least one tip to make your drafting/design experience better.
This entry was posted in Attributes, AutoLISP, AutoLISP: Attributes, AutoLISP: Modify, Blocks, Modifying. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s