+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 26
  1. #1
    Full Member
    Using
    not specified
    Join Date
    Aug 2005
    Posts
    25

    Default OPEN-PURGE-SAVE-OPEN-PURGE-SAVE

    Registered forum members do not see this ad.

    does anyone know of a lisp or any other method that can be used to purge multiple drawings without opening each one and individually purging them? or, is there a lisp that can be written that will purge all once a file is closed? there are about 20,000 files i'm working with at work right now, and i desperately do not want to open all of these drawings.
    i'm running both 2002 and R14.
    thanks.

  2. #2
    Super Member
    Using
    Architectural DT 2007
    Join Date
    Dec 2002
    Location
    London
    Posts
    1,087

    Default

    Script would be the best option for that.Have a look in the help file or do a search on this forum for scripts.What your asking for is a very common question.

  3. #3
    Full Member
    Using
    not specified
    Join Date
    Aug 2005
    Posts
    25

    Default

    yeah, i see alot of similar questions, but i have two problems,

    1. i believe that if you want to modify multiple drawings at once you must either use some sort of batch process, or MDE(MDI), but i have no idea where to start with that using lisp or otherwise.

    2. i cannot find a code that purges and saves documents. i'm a novice at lisp, having only really written one short code that works for page setups, and i'm not sure exactly how i even got it to work. i've been using autocad for years, but only on a basic draw and edit type level.

    any help would be greatly appreciated.

  4. #4
    Senior Member devitg's Avatar
    Computer Details
    devitg's Computer Details
    Operating System:
    XP
    Monitor:
    VG2021WM VIEW SONIC
    Using
    AutoCAD 2008
    Join Date
    Apr 2005
    Location
    CORDOBA ARGENTINA
    Posts
    107

    Default A SCRIPT IS NOT A LISP , EVEN A LISP IS NOT A SCRIPT

    I do not know why most of CAD user name a SCRIP to be a LISP
    SCRIPT is a text file where you put one by one the same keystroke you would do at the keyboard to do same task.
    Just to test it .
    Code:
      line 0,0 1,1
    copy it and paste on your notepad and save it with this name

    my-first-script.scr
    Now from the command line type

    SCRIPT
    at the dialogbox select my-first-script.scr

    and you will see a line from 0,0 to 1,1

  5. #5
    Senior Member Dommy2Hotty's Avatar
    Using
    AutoCAD 2007
    Join Date
    Mar 2004
    Location
    Homer Glen, IL
    Posts
    350

    Default

    Geez....20,000 drawing files Without knowing if there is a third-party software out there for this that can do it without opening each drawing, a batch file calling a purge script is your best bet. Start it on a computer no one uses or start it on your own when you leave ( be sure to test before! ). If you know the folders, you can hard code them into the batch file. My example batch file will need to reside in the same folder as the drawings you want to run it on.

    Here is the basic batch file that will open AutoCAD, open a drawing, run the script, close AutoCAD, open AutoCAD, open the next drawing, etc...

    Copy the code, paste into Notepad, put your paths to your acad.exe and to the purge.scr (which is listed further down), and save as Purge.bat

    Purge.bat
    Code:
    FOR %%V IN (*.DWG) DO START /W "c" "C:\***PUTPATHHERE***\acad.exe" %%V /nologo /b "C:\***PUTPATHHERE***\Purge.scr"
    FOR %%V IN (*.BAK) DO DEL %%V

    Copy the code, paste into Notepad, hit enter to put a blank line at the end and save as Purge.scr

    Purge.scr
    Code:
    PURGE ALL * NO
    PURGE ALL * NO
    PURGE ALL * NO
    ****MAKE SURE YOU HAVE A BLANK LINE HERE (JUST HIT ENTER AFTER YOU PASTE INTO NOTEPAD****
    Now put a copy of Purge.bat into the folder with your drawings, double click it, and the rest is history! (make sure you test it before you go home!)

    EDIT: I FORGOT TO ADD SAVE AND QUIT....I'LL TAKE CARE OF THAT...SORRY...
    AutoCAD 2005
    ADT 2005

  6. #6
    Full Member
    Using
    not specified
    Join Date
    Aug 2005
    Posts
    25

    Default

    excellent. thank you very, very much. i was making some headway using lisp file, i just could not figure out how to run my lisp on multiple files...

    this script coding seems like the answer then. looks like i have another language to learn. yipee.

    i will look for the save and quit functions online, but i will probably not be that successful, so i anxiously await your reply.

    again, thank you.
    marcus

  7. #7
    Senior Member Dommy2Hotty's Avatar
    Using
    AutoCAD 2007
    Join Date
    Mar 2004
    Location
    Homer Glen, IL
    Posts
    350

    Default

    Final script:
    Code:
    PURGE ALL * NO
    PURGE ALL * NO
    PURGE ALL * NO
    ZOOM EXTENTS
    QSAVE
    QUIT NO
    ****BLANK LINE HERE****
    AutoCAD 2005
    ADT 2005

  8. #8
    Senior Member Dommy2Hotty's Avatar
    Using
    AutoCAD 2007
    Join Date
    Mar 2004
    Location
    Homer Glen, IL
    Posts
    350

    Default

    Quote Originally Posted by msstrang
    this script coding seems like the answer then. looks like i have another language to learn. yipee.
    Scripts aren't another language...just typewriter...anything you can do at the command line, a script file can do. A script file acts like you're sitting there typing in each command, except a lot faster than you can!
    AutoCAD 2005
    ADT 2005

  9. #9
    Full Member
    Using
    not specified
    Join Date
    Aug 2005
    Posts
    25

    Default

    i see, that is good to know.

    i got the program working. for some reason the script you provided didn't work at first (even with the blank line at the bottom) but i got it working using hurricane script generator. i appreciate all the help.

    there is only one final issue. in folders where there are multiple drawings (20+) the process seems to hang up from time to time and get stuck in a file. is that typical with this type of .bat & .scr function, or is there something i might be able to do to fix it?

  10. #10
    Senior Member Teeds's Avatar
    Using
    AutoCAD 2009
    Join Date
    May 2005
    Location
    427 miles ENE of Orla Texas
    Posts
    141

    Default

    Registered forum members do not see this ad.

    A bit off subject, but the code below is a lisp routine that I use to save every time I exit a drawing.

    Code:
    (defun c:cs ()
    (command "_layer"(command "make"(command "0")))
    (command "_purge"(command "a"(command "*"(command "n"))))
    (command "_purge"(command "a"(command "*"(command "n"))))
    (command "_purge"(command "a"(command "*"(command "n"))))
    (command "_purge"(command "a"(command "*"(command "n"))))
    (command "qsave")
    )
    cs meant "clean save" and I set the routine to run 4 times to make sure that it cleaned out all extraneous layers, styles, etc.
    Tony Eeds aka Teeds aka Dad aka Grandpa
    Proud member of the Peanut Gallery and the Pajama Economy
    AutoCAD 2007 - 2008 arrived, and I just got an email that 2009 has shipped


    Quote Originally Posted by Teeds
    Without training, CAD is not drafting ... it only makes you draw bad faster

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