todouble22 Posted December 17, 2009 Posted December 17, 2009 Hi all, I wrote a script so that I could automate the process of updating title blocks for the company I work for. Basically just -attedit for each of the attributes to change. I tried writing a batch file so that I could run it on specific folders of drawings for instance if I just needed to update the revision of a hundred drawings within a folder. I made a test folder and put some drawings in it to make sure it works. The script works on individual drawings , so thats all set. When I run the batch file I get the Autocad Message that it cant find the specified drawing file and to verify that it exists.. Am I missing something here? Do I need to have the script call to a lisp program that gets the drawing names? I've attached the script and .bat file if it helps . I appreciate any assistance in advance. tsi-D_borderrev.scr test.txt Quote
fixo Posted December 17, 2009 Posted December 17, 2009 Hi all, I wrote a script so that I could automate the process of updating title blocks for the company I work for. Basically just -attedit for each of the attributes to change. I tried writing a batch file so that I could run it on specific folders of drawings for instance if I just needed to update the revision of a hundred drawings within a folder. I made a test folder and put some drawings in it to make sure it works. The script works on individual drawings , so thats all set. When I run the batch file I get the Autocad Message that it cant find the specified drawing file and to verify that it exists.. Am I missing something here? Do I need to have the script call to a lisp program that gets the drawing names? I've attached the script and .bat file if it helps . I appreciate any assistance in advance. Place this bat file: ECHO OFF md BatchTestFolder FOR %%F IN (*.DWG) DO "C:\Program Files\Autodesk\Acade 2008\acad.exe" %%F /B P:\autocad\acad-lisps\tsi-B_borderrev.scr ECHO in the folder you want to process then run from there This .bat will create BatchTestFolder with edited drawings to make sure that your parent drawings would not be changed Then after you can check files you can replace them with parents And also if you have a blank space(s) in the file path then enclose this path in the double quotes like this: "C:\Program Files\Autodesk\Acade2008\acad.exe" ~'J'~ Quote
Lee Mac Posted December 17, 2009 Posted December 17, 2009 Todd, You would be far better off writing a LISP file to perform the attribute tasks, and calling the LISP function through the script. I leave the batch part up to you, as that is outside of my "field" But with a LISP, you can include far more error trapping, and it will be a much much more robust method. Just my 2 cents, Lee Quote
todouble22 Posted December 17, 2009 Author Posted December 17, 2009 Place this bat file: ECHO OFF md BatchTestFolder FOR %%F IN (*.DWG) DO "C:\Program Files\Autodesk\Acade 2008\acad.exe" %%F /B P:\autocad\acad-lisps\tsi-B_borderrev.scr ECHO in the folder you want to process then run from there This .bat will create BatchTestFolder with edited drawings to make sure that your parent drawings would not be changed Then after you can check files you can replace them with parents And also if you have a blank space(s) in the file path then enclose this path in the double quotes like this: "C:\Program Files\Autodesk\Acade2008\acad.exe" ~'J'~ Thanks for the reply and I will give it a try and see how it goes. Quote
todouble22 Posted December 17, 2009 Author Posted December 17, 2009 Todd, You would be far better off writing a LISP file to perform the attribute tasks, and calling the LISP function through the script. I leave the batch part up to you, as that is outside of my "field" But with a LISP, you can include far more error trapping, and it will be a much much more robust method. Just my 2 cents, Lee Lee, I would love to be able to write the code for a lisp for this cut I am a novice at best.. I'll try and put something together and perhaps you can take a look at it and help me learn a bit. the stuff you do is very impressive.. Quote
Lee Mac Posted December 17, 2009 Posted December 17, 2009 Not a problem Todd, I'd be happy to help write a LISP, just describe your task Quote
todouble22 Posted December 17, 2009 Author Posted December 17, 2009 Not a problem Todd, I'd be happy to help write a LISP, just describe your task Thank you Lee! I have been studying this thread http://www.cadtutor.net/forum/showthread.php?t=33971&highlight=block+attribute+update+lisp and my task is basically along the same lines. I want to be able to update my titleblocks in an automated way like if I just needed to change the rev date on 100 drawings instead of opening each drawing and changing it. All of the information in the title block are attributes. I figured I would try learning from what you have done in the thread and try it. I'll send you what I come up with if you wouldnt mind giving me some tips as to what i did and where i could do better or different. Give me a day or two though haha. Quote
Lee Mac Posted December 17, 2009 Posted December 17, 2009 Thank you Lee! I have been studying this thread http://www.cadtutor.net/forum/showthread.php?t=33971&highlight=block+attribute+update+lisp and my task is basically along the same lines. I want to be able to update my titleblocks in an automated way like if I just needed to change the rev date on 100 drawings instead of opening each drawing and changing it. All of the information in the title block are attributes. I figured I would try learning from what you have done in the thread and try it. I'll send you what I come up with if you wouldnt mind giving me some tips as to what i did and where i could do better or different. Give me a day or two though haha. Certainly Todd - as you intend to use it in a script the way that I would approach it is to make a sub-function taking a blk and a list of attribute changes, say an associative dotted pair, that way, you could use it in several situations, and also feed it to your script something like: (function "block_name" '(("tag1" . "new value") ("tag2" . "new value"))) Just a few ideas for you Quote
todouble22 Posted December 22, 2009 Author Posted December 22, 2009 hello again, I got my script to work and open the drawings when I run a test on it but the problem I have is that it opens autocad every time, for instance if I have 3 drawings in the folder to perform the script on it opens autocad 3 times. Is there a way to only make it open autocad once and open the drawings and perform the script then proceed to the next drawing and not open up autocad again? Quote
dbroada Posted December 22, 2009 Posted December 22, 2009 that may just be an affect of having SDI set on or off. Whatever you have at the moment, try it the otehr way. Quote
todouble22 Posted December 22, 2009 Author Posted December 22, 2009 that may just be an affect of having SDI set on or off. Whatever you have at the moment, try it the otehr way. I have sdi set to zero which means that autocad will open multiple files while running just one application correct? I tried it set to one and I get the same results. when I run the script with autocad open it works but when I try running it from the batch file it opens autocad as many times as the drawings that are in the designated folder. I get this message also "C:\Program Files\Autodesk\Acade 2008\Acade\acade.arx cannot find a dll or other file that it needs." I'm trying to get the batch file to work so that I can update the attributes in the title blocks with the script in an automated process.. I dont know why its not working with the batch file? Quote
dbroada Posted December 22, 2009 Posted December 22, 2009 I have only skimmed this topic so far. We use a script creation program which creates a long script something like... open "H:\Design_Office\E343\E343_T\00-COMMON\E343-00-BD-0001-01-T.dwg" layer s 0 off cloud* attsync s 0,0 y qsave open "H:\Design_Office\E343\E343_T\00-COMMON\E343-00-BD-0001-02-T.dwg" layer s 0 off cloud* attsync s 0,0 y qsave that way the script opens each drawing in turn, does what it has to, saves the file and opens the next file. While I am quite good with scripts I don't do batches the way others do so can't really answer your question. I just thought SDI mode might be contributing to your problem. At least you can elimnate it from your enquireries Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.