0 Members and 1 Guest are viewing this topic.
(defun delInvisAtts (bname / )(if (tblsearch "BLOCK" bname)(progn(vl-load-com)(setq blk (vla-item(vla-get-blocks(vla-get-activedocument(vlax-get-acad-object)))bname))(vlax-for ent blk(if (and (eq (vla-get-objectname ent) "AcDbAttributeDefinition")(eq (vla-get-invisible ent) :vlax-true))(vla-delete ent))))))
(defun c:DIA nil (c:DeleteInvisibleAttributes))(defun c:DeleteInvisibleAttributes ( / ss ) (vl-load-com) ;; Example by Lee Mac 2010 - www.lee-mac.com (if (ssget '((0 . "INSERT") (66 . 1))) (progn (vlax-for obj (setq ss (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-acad-object)) ) ) (mapcar (function (lambda ( attrib ) (if (eq :vlax-true (vla-get-Invisible attrib)) (vla-delete attrib) ) ) ) (vlax-invoke obj 'GetAttributes) ) ) (vla-delete ss) ) ) (princ))
Something like this?
Try erasing them from the definition, and the insert. Run the code in the first post, and then Lee's ( either order, doesn't really matter ).
Quote from: T.Willey on December 17, 2010, 06:41:39 PMTry erasing them from the definition, and the insert. Run the code in the first post, and then Lee's ( either order, doesn't really matter ).Or perhaps use AttSync I suppose after running the first code I would have thought one could alter the attributes for a single reference though
Quote from: Lee Mac on December 17, 2010, 06:46:40 PMQuote from: T.Willey on December 17, 2010, 06:41:39 PMTry erasing them from the definition, and the insert. Run the code in the first post, and then Lee's ( either order, doesn't really matter ).Or perhaps use AttSync I suppose after running the first code I would have thought one could alter the attributes for a single reference though I think the problem is with Acad's logic when it comes to attributes. There is nothing referencing the definition ( of an attribute ) once you insert a block. I have wondered how it happens before, and could only come up with the idea that is just goes in order, as it appears it does. So if you erase the invisible attributes from the definition and the insert, then they should be in the same order.
Sidenote: I wonder why they didn't just put a prompt dxf code with attributes references. They are only stored in attribute definitions.
(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:test ( / bn ) (delInvisAtts (setq bn (getstring t "\nBlock Name: "))) (vl-cmdf "_.attsync" "_N" bn) (princ))