Small Fish Posted September 4, 2009 Posted September 4, 2009 I have a question when making a script file for a batch process. How can I allow for a drawing with multiple tabs? Below is the standard code for making a script file and running. It works fine if there is only one tab per drawing file, but not if there is more than one tab. Thanks if anyone can help (foreach file DwgtoCleanLst (setq dwgName (strcat "\"" DirPath file "\""));path and drawing of drawing to be processed in loop (write-line "OPEN" scrFile) (write-line dwgName scrFile) ;;Below are commands to run on each drawing... (write-line "-PURGE ALL * NO" scrFile) (write-line ".ZOOM EXTENTS" scrFile) (write-line ".QSAVE" scrFile) (write-line "_.CLOSE" scrFile) );foreach (close scrFile) (command ".script" (strcat DirPath "BatchDwgs.scr")) ;run script Quote
alanjt Posted September 4, 2009 Posted September 4, 2009 are you talking about wanting to switch b/w each layout and zoom extents? (foreach x (layoutlist) (setvar "ctab" x) (command "_.zoom" "_extents")) and yes, you can put lisp in scr files. I have a question when making a script file for abatch process. How can I allow for a drawing with multiple tabs? Below is the standard code for making a script file and running. It works fine if there is only one tab per drawing file, but not if there is more than one tab. Thanks if anyone can help (foreach file DwgtoCleanLst (setq dwgName (strcat "\"" DirPath file "\""));path and drawing of drawing to be processed in loop (write-line "OPEN" scrFile) (write-line dwgName scrFile) ;;Below are commands to run on each drawing... (write-line "-PURGE ALL * NO" scrFile) (write-line ".ZOOM EXTENTS" scrFile) (write-line ".QSAVE" scrFile) (write-line "_.CLOSE" scrFile) );foreach (close scrFile) (command ".script" (strcat DirPath "BatchDwgs.scr")) ;run script Quote
Small Fish Posted September 5, 2009 Author Posted September 5, 2009 thanks alanjt - yes I meant zoom extents on each tab. The problem is that DwgtoCleanLst list does not list dwg tabs. I have tried your piece of code but it doesn't work. Do I place the foreach x (layoutlist) etc in the (foreach file DwgtoCleanLst....or something else? Quote
alanjt Posted September 5, 2009 Posted September 5, 2009 thanks alanjt - yes I meant zoom extents on each tab.The problem is that DwgtoCleanLst list does not list dwg tabs. I have tried your piece of code but it doesn't work. Do I place the foreach x (layoutlist) etc in the (foreach file DwgtoCleanLst....or something else? sorry, i forgot to state where to place it replace: (write-line ".ZOOM EXTENTS" scrFile) with: (write-line "(foreach x (layoutlist) (setvar \"ctab\" x) (if (zerop (getvar \"tilemode\")) (command \"_.pspace\")) (command \"_.zoom\" \"_extents\"))" scrFile) Quote
Small Fish Posted September 5, 2009 Author Posted September 5, 2009 Beautiful! and thank you thank you!!! and the fast reply! So that's how it's done:D Quote
alanjt Posted September 6, 2009 Posted September 6, 2009 Beautiful! and thank you thank you!!! and the fast reply!So that's how it's done:D happy to help. you barely got a response, we were just about to walk out the door to meet my parents for dinner. Quote
miff Posted June 29, 2012 Posted June 29, 2012 (edited) Hi, Could someone help with a similar problem? I want to run a long script over drawings with many tabs. I have a lisp to switch tabs that runs the script, but when it finishes running the script on the first tab it stops? (foreach lay (layoutlist) (setvar "CTAB" lay) (command "filedia" "0" "script" "C:/Users/MN11706/Documents/Script/Old_drg_fix-Text.scr" (C:Old_drg_fix-Text))) Can anyone tell me why? I thought the thread above might help, but when I tried listing all the commands in the lisp itself, it stopped at the SSX command and asked me to select objects on screen... Edited July 2, 2012 by miff Quote
SLW210 Posted June 29, 2012 Posted June 29, 2012 miff, Please read the CODE POSTING GUIDELINES and edit your post. 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.