First of all, I have to step in... Once ATTRIBUTE is added to BLOCK, there is no way you can restore it to the state it was before - without flag (66 . 1)... BLOCK is permanently polluted... Yes you can EXPLODE and recreate and be avare that you should firstly choose block with 0.0 rotation and 1 1 1 scale factors and store it's insertion point in variable so when recreating you pick exactly the same spot, but you SHOULDN'T do it that way, as, when you redefine block (CAD will ask if the name is the same Yes/No) all other References will still have attributes attached to them - there is actually no relation between references and definition... So my only advice is that you go with @hak_vz method and (vla-delete) all both "AcDbAttributeDefinition" from block collection of definitions and "AcDbAttribute" from coresponding references - all of ATTRIBUTES (for each ATTRIBUTE you have to remove single "AcDbAttributeDefinition" from block definition and all "AcDbAttribute" from all INSERT references of that same block)... Then you should do ATTSYNC, but still blocks will be polluted : you will get DXF data similar to this :
(
(-1 . <Entity name: 20fc4d099e0>)
(0 . "INSERT")
(330 . <Entity name: 20fb6aa41f0>)
(5 . "24E")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbBlockReference")
(66 . 1)
(2 . "x")
(10 26.205 13.2273 0.0)
(41 . 1.0)
(42 . 1.0)
(43 . 1.0)
(50 . 0.0)
(70 . 0)
(71 . 0)
(44 . 0.0)
(45 . 0.0)
(210 0.0 0.0 1.0)
)
(
(-1 . <Entity name: 20fc4d09a10>)
(0 . "SEQEND")
(330 . <Entity name: 20fc4d099e0>)
(5 . "251")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(-2 . <Entity name: 20fc4d099e0>)
)
All in all, you will remove attrubutes and clean references, but only partially - like I said, DXF data will stay polluted...
So to conclude, you'll have to collect all block names - iterate through definition block collection and gather names and store it in list... Iterate through blocks and for each block remove "AcDbAttributeDefinition"s : (vlax-for o (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) "blockname") (if (= (vla-get-objectname o) "AcDbAttributeDefinition") (vla-delete o)) )... Then select all references of that block (ssget "_:L" '((0 . "INSERT") (66 . 1) (2 . "blockname"))), then : (vlax-for r (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))) (vlax-for o (append (vlax-invoke r 'getconstantattributes) (vlax-invoke r 'getattributes)) (vla-delete o) ) )
Finally you ATTSYNC...
Marko Ribar, d.i.a. (graduated engineer of architecture)