clear tag contents from multiple blocks in folder

clear tag contents from multiple blocks in folder

Anonymous
Not applicable
1,105 Views
9 Replies
Message 1 of 10

clear tag contents from multiple blocks in folder

Anonymous
Not applicable

Woe is me! I have 700 blocks with a default value in one of the tags that I would like to delete without having to manually open each block in AutoCAD and then save it. I'm guessing it's not possible and even if it was to open 700 blocks and save them back down would be an awful strain on the program and the computer? You need some program running outside AutoCAD that can delete the value without using AutoCAD.

0 Likes
1,106 Views
9 Replies
Replies (9)
Message 2 of 10

devitg
Advisor
Advisor

Try ATTOUT, handle the xls , and do a ATTIN 

 

 

0 Likes
Message 3 of 10

Anonymous
Not applicable

If I insert each file into autoCAD I have a lisp that clears that tag or I could clear the tag manually but saving the file reverses the order of the tags. The only way to do it is to open a file into autoCAD clear the tag and save it then the tags stay in the same order but repeating that 700 times is not an option. I don't know of any way it could be done outside of AutoCAD unless. You would have to use some sort of programming language that could open an AutoCAD file clear the tag and save it. No doubt the AutoCAD programmers would be able to do it.

0 Likes
Message 4 of 10

ВeekeeCZ
Consultant
Consultant

For multiple ATTRIBUTE setting is Lee Mac's BATTE routine HERE

 

In general try SCRIPT PRO HERE

0 Likes
Message 5 of 10

Anonymous
Not applicable

I just realised I have a list of the files in my menu

 

^C^C^P-insert LED-IN-GND-UP \!userr5 ;\;;;;;;;;;;;;;;;;;;;;;;;;;;^P
^C^C^P-insert LED-MICRO-INS \!userr5 ;\;;;;;;;;;;;;;;;;;;;;;;;;;;^P
^C^C^P-insert LED-INDICATOR \!userr5 ;\;;;;;;;;;;;;;;;;;;;;;;;;;;^P
^C^C^P-insert LED-STEALTH \!userr5 ;\;;;;;;;;;;;;;;;;;;;;;;;;;;^P
^C^C^P-insert LED-TRIPLE-DL \!userr5 ;\;;;;;;;;;;;;;;;;;;;;;;;;;;^P
^C^C^P-insert LED-DOUBLE-DL \!userr5 ;\;;;;;;;;;;;;;;;;;;;;;;;;;;^P
^C^C^P-insert LED-SINGLE-DL \!userr5 ;\;;;;;;;;;;;;;;;;;;;;;;;;;;^P

 

Perhaps I could write a script to process the files? and if I opened and closed them the tags would not reverse. If I turn off prompting for attribute tags that would be even better. At least now I know which files need to be worked on.

0 Likes
Message 6 of 10

Anonymous
Not applicable

Ah yes that is sounding like a solution I will look into both options thank you very much

0 Likes
Message 7 of 10

Ranjit_Singh
Advisor
Advisor

Object DBX is just another way. Try below code.

Spoiler
(defun somefunc  (x y / dbxObj directorypath filepath)
    (setq directorypath (vl-filename-directory (getfiled "Select any one block in directory" "" "dwg" 0))
          dbxObj        (vlax-get-or-create-object (strcat "objectDBX.AxDbDocument." (itoa (atoi (getvar 'acadver))))))
    (mapcar '(lambda (z)
                 (vla-open dbxObj (setq filepath (strcat directorypath "\\" z)))
                 (vlax-for i  (vla-get-modelspace dbxObj)
                     (if (and (= (vla-get-ObjectName i) "AcDbAttributeDefinition") (= (vla-get-TagString i) (strcase x)))
                         (progn (vla-put-TextString i y) (vla-saveas dbxObj filepath)))))
            (vl-directory-files directorypath "*.dwg" 1))
    (vlax-release-object dbxObj)
    (princ))
It needs arguments for tagname and new default value. Since you want to clear the tag call (somefunc "yourtagname" "")

0 Likes
Message 8 of 10

Anonymous
Not applicable

Wow that looks interesting I'll give it a go thanks

0 Likes
Message 9 of 10

Anonymous
Not applicable

Well that does work nicely but then you have to save them and it just does one at a time although its better than the other option of having to make a list of block name, tag etc. I'll try and find a quick way of doing that.

0 Likes
Message 10 of 10

Ranjit_Singh
Advisor
Advisor

Your original post said "one of the tags" so the function is coded to accept that tag. So I am not exactly sure what you mean by one at a time. Also the drawings are saved by the routine. You don't have to save them. Explain in more detail and I can see how the code can be modified. 

0 Likes