Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Looking for LISP to delete a specific attribute

Hans_Knol
Advocate

Looking for LISP to delete a specific attribute

Hans_Knol
Advocate
Advocate

Hi all,

I'm looking for an LISP routine that search in a drawing for a specific block named "VT0004" and remove the attribute "TAG1" or "TAG1F". Those attributes are in the block but are hidden.

Hope someone is able to create something.

Hans Knol
0 Likes
Reply
282 Views
4 Replies
Replies (4)

Moshe-A
Mentor
Mentor

@Hans_Knol  hi,

 

to remove hidden attributes you can ATTSYNC (or BATTMAN + sync)  the block

 

Moshe

 

0 Likes

hak_vz
Advisor
Advisor

Here is @Lee_Mac 's code for deleting invisible attributes. Hope it works.

 

;;; 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)
)

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes

Simon_Weel
Advisor
Advisor

Like @Moshe-A says - you probably don't need a LISP routine to get rid of them attributes. Just sync (ATTSYNC) the block and they'll be gone.

 

Only Attribute Definitions are part of the block definition. When you insert the block, the attribute values are stored with that block insert. If you make changes to the block definition and delete some Attribute Definitions, then the values of those Attribute Definitions already in the drawing will not be deleted right away. Only if you use ATTSYNC, AutoCAD will replace / update the attributes in blocks already placed.

0 Likes

devitg
Advisor
Advisor

@Hans_Knol despite the block name is VT00004 and not VT0004 , it only had TAG1F  invisible att.

I use the DIA Lee-mac and it erase the TAG1F att , find attached dwg result 

0 Likes