Jump to content

batch script for dwgs with more than one tab


Recommended Posts

Posted

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

Posted

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 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

Posted

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?

Posted
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)

Posted

Beautiful! and thank you thank you!!! and the fast reply!

So that's how it's done:D

Posted
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.

  • 2 years later...
Posted (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 by miff

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...