+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Senior Member Small Fish's Avatar
    Using
    AutoCAD 2010
    Join Date
    May 2009
    Location
    Tauranga
    Posts
    282

    Default batch script for dwgs with more than one tab

    Registered forum members do not see this ad.

    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


    Code:
    (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

  2. #2
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2011
    Join Date
    Apr 2008
    Posts
    5,998

    Default

    are you talking about wanting to switch b/w each layout and zoom extents?
    Code:
    (foreach x (layoutlist)
     (setvar "ctab" x)
     (command "_.zoom" "_extents"))
    and yes, you can put lisp in scr files.

    Quote Originally Posted by Small Fish View Post
    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


    Code:
    (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

  3. #3
    Senior Member Small Fish's Avatar
    Using
    AutoCAD 2010
    Join Date
    May 2009
    Location
    Tauranga
    Posts
    282

    Default

    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?

  4. #4
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2011
    Join Date
    Apr 2008
    Posts
    5,998

    Default

    Quote Originally Posted by Small Fish View Post
    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:
    Code:
    (write-line ".ZOOM EXTENTS" scrFile)
    with:
    Code:
    (write-line "(foreach x (layoutlist) (setvar \"ctab\" x) (if (zerop (getvar \"tilemode\")) (command \"_.pspace\")) (command \"_.zoom\" \"_extents\"))" scrFile)
    Last edited by alanjt; 5th Sep 2009 at 11:06 pm.

  5. #5
    Senior Member Small Fish's Avatar
    Using
    AutoCAD 2010
    Join Date
    May 2009
    Location
    Tauranga
    Posts
    282

    Default

    Beautiful! and thank you thank you!!! and the fast reply!
    So that's how it's done

  6. #6
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2011
    Join Date
    Apr 2008
    Posts
    5,998

    Default

    Quote Originally Posted by Small Fish View Post
    Beautiful! and thank you thank you!!! and the fast reply!
    So that's how it's done
    happy to help.
    you barely got a response, we were just about to walk out the door to meet my parents for dinner.

  7. #7
    Forum Newbie
    Using
    Civil 3D 2012
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    5

    Default Batch script on drawing with multiple layout tabs

    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?

    Code:
    (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...
    Last edited by miff; 2nd Jul 2012 at 01:44 am.

  8. #8
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x86
    CPU:
    Pentium(R) Dual-Core CPU E5500 @ 2.80GHz
    RAM:
    4 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    ThinkVision 22"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2011
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    9,102

    Default

    Registered forum members do not see this ad.

    miff,

    Please read the CODE POSTING GUIDELINES and edit your post.
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



Similar Threads

  1. Batch change xref names and repath dwgs
    By JeepMaster in forum AutoLISP, Visual LISP & DCL
    Replies: 31
    Last Post: 15th Jun 2010, 02:26 am
  2. stop New layers in xrefs from showing up in dwgs viewports of exisitng dwgs
    By Dale Bechtel in forum AutoCAD Drawing Management & Output
    Replies: 10
    Last Post: 21st Dec 2007, 03:34 pm
  3. Batch Attribute changer & forgiving batch plot program?
    By muck in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 30th Jul 2006, 04:07 pm
  4. running a batch script
    By ariel in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 27th Jul 2006, 05:04 pm
  5. How to batch plot with a script
    By TTALBOT in forum AutoCAD General
    Replies: 2
    Last Post: 5th Jul 2006, 05:56 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts