Page 3 of 3 FirstFirst 123
Results 21 to 25 of 25

Thread: Batch/Script automation of Autocad

  1. #21
    100 Club
    Join Date
    2005-06
    Location
    CORDOBA-ARGENTINA
    Posts
    152

    Default Re: Batch/Script automation of Autocad

    Quote Originally Posted by RobertB View Post
    Please see TS21336 on Autodesk's website.
    Thanks I just understand .

  2. #22
    AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    2,320

    Default Re: Batch/Script automation of Autocad

    Quote Originally Posted by Terry Cadd View Post
    Here's a Script Creator that runs your script on a drawing or drawings in a folder.
    You edit it on the fly as required, and may also just test it in the current drawing,
    before you run it on a folder of drawings.
    .....
    That's pretty sweet Terry!
    I just did a bat/scr/lsp method on a bunch of drawings to clean up, purge and e-transmit, but your program doesn't require starting AutoCAD everytime.

    Here's what mine looked like:
    RECORD.BAT
    Code:
    FOR %%f in (T:\5053301\Sheets\"BUILDING"\*.dwg) do start /wait C:\"Program Files"\Autodesk\"AutoCAD Structural Detailing 2011"\acad.exe "%%f" /b "C:\lisp\RECORD\RECORD.scr"
    RECORD.SCR
    Code:
    (load "C:\\lisp\\record\\record.lsp")
    deleterev
    adupurge
    -etransmit
    choose
    RECORD
    C
    A
    quit
    y
    And RECORD.LSP
    Code:
    ;;deletes the layer G-ANNO-REVN and everything on it!
    (defun c:deleterev (/ lr1)
    (command "layer" "s" "0" "")
    (setq lr1 (tblsearch "layer" "G-ANNO-REVN"))
    (setq lr2 (tblsearch "layer" "G-ANNO-REVS"))   
      (if (= lr1 nil)
    (command "layer" "s" "0" "")
    (command "-laydel" "name" "G-ANNO-REVN" "" "y"))
      (if (= lr2 nil)
    (command "layer" "s" "0" "")
    (command "-laydel" "name" "G-ANNO-REVS" "" "y"))
    (princ)
    )
    ;;purge routine
    (defun c:adupurge ()
    (setq ce (getvar "cmdecho"))
        (setvar "cmdecho" 0)
     (command "layer" "s" "0" "")
     (command "zoom"  "e"  "zoom"  ".9x" ) 
     (repeat 3 
     (command "._purge" "_A" "*" "_N")
     (command "purge" "regapps" "" "n"))
       (setvar "cmdecho" ce)
    (command "_qsave")
    (princ)
    )
    But all I needed to do was apply the script commands on your program and it took care of them all wile AutoCAD remained open...much faster!

    Thanks.
    Ted
    ____________________________________________________________________________________
    AutoCAD 2012 - REVIT Structure 2012 - MicroStation V8i - Windows 7 Professional - (dabble with Inventor 2012)

  3. #23
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,348

    Default Re: Batch/Script automation of Autocad

    Ted, just as a suggestion: You don't need to quote each foldername individually. You can quote the entire path in one go: "C:\Program Files\Autodesk\AutoCAD Structural Detailing 2011\acad.exe"

    Oh! Edit ... that's what was generated?
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  4. #24
    AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    2,320

    Default Re: Batch/Script automation of Autocad

    Quote Originally Posted by irneb View Post
    Ted, just as a suggestion: You don't need to quote each foldername individually. You can quote the entire path in one go: "C:\Program Files\Autodesk\AutoCAD Structural Detailing 2011\acad.exe"

    Oh! Edit ... that's what was generated?
    No I didn't know that, I will give it a try.
    I can't remember why I needed to do that, maybe because the folder names with spaces?

    Thanks I'll look into your suggestion.
    Ted
    ____________________________________________________________________________________
    AutoCAD 2012 - REVIT Structure 2012 - MicroStation V8i - Windows 7 Professional - (dabble with Inventor 2012)

  5. #25
    Member
    Join Date
    2010-07
    Posts
    5

    Default Re: Batch/Script automation of Autocad

    Quote Originally Posted by jason.145418 View Post
    I would like Autocad to run without any user input from a scheduled routine. I have a *.bat file that starts autocad and open files in a folder...

    chdir c:\ptc\ilinktrail
    dir /B /S *.dwg > list_dwg.txt

    for /f "delims=" %%f in (list_dwg.txt) do (
    %startw% "C:\PTC\Ilinktrail\run_acad" "%%f"
    )

    Once autocad is open I want ot run the following *.scr file

    ZOOM
    Extents
    overkill
    all
    scr-saveas-2000
    scr-quit

    I do not want to have to manually start Autocad or have manual inputs once autocad opens a file.

    Is there a way to get the acaddoc.lsp to open a script file once a drawing file has been opened?

    Thanks

    jason
    Dear Jason,

    Try this in your *.scr file

    hope it will help.

    regen
    zoom
    extents
    -overkill
    al


    qsave
    quit



    Thank you,


    Regards,


    Asad

Page 3 of 3 FirstFirst 123

Similar Threads

  1. script file batch for aectoacad
    By dsolak in forum AutoLISP
    Replies: 2
    Last Post: 2008-07-14, 05:13 AM
  2. Help writing a clean-up script to batch run on a set of DWG files
    By sumulong in forum AutoCAD Customization
    Replies: 3
    Last Post: 2007-01-29, 04:53 AM
  3. Batch open and save script
    By cadkiller in forum AutoCAD General
    Replies: 3
    Last Post: 2006-02-01, 01:07 AM
  4. Batch Print script
    By gen2_proton in forum AutoCAD Customization
    Replies: 2
    Last Post: 2005-04-14, 09:46 AM

Posting Permissions

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