I'm out of my depth - please help!

Discussion in 'AutoCAD' started by devon, Oct 28, 2004.

  1. devon

    devon Guest

    Hello,

    I have a tricky one about some customisation I have.

    I run a batch file in windows called "drawing-list.bat"
    it is very simple and creates a list of dwg's of the folder you are in. I have it added to my right click menu so i do'nt need to copy the bat file all over the show.
    CODE:
    dir *.dwg /b /s > C:\Scripts\DWG-List.txt

    Second part:
    I have a routine which I execute from autocad called "archive.scr"
    This script is just full of lisp. It binds/purges & saves my list of drawings into the "archive" folder.

    Problem/Question:
    How would I go about making the drawing list from within autocad?
    I also want to have the drawing list created in the folder it's just listed. eg. project/drawings/DWG-List.txt
    Then I want the list to open in notepad for editing.
    I have code which defines each project path used which is
    CODE:
    (strcat projpref (nth project_val projnm_sym)
    This expands to my project path.

    My question is 2 fold.
    1. Is it possible to get acad to make a dwg list if it knows my project directory?
    2. Can i choose somehow (eg doslib) the files I want written to file? this would cut out the need to edit the txt file.

    I am trying to minimise the back and forth after creating a dwg list.txt file, both removing dwg's which i don't want archived and also to simplify for other users.

    I can attach files if needed, but am interested in your views.

    Thanks
    Devon
     
    devon, Oct 28, 2004
    #1
  2. devon

    GTVic Guest

    DOSLIB has a function called DOS_DIR which can return a list of files in a specific folder. You could use the DOS_GETFILED function to locate the first file and then use DOS_DIR to return all the rest. Then you could use the DOS_CHECKLIST function to list all the drawings and uncheck the drawings you don't want.

    Or you could use the DOS_GETFILEM function to directly pick multiple dwg files if that would be faster.

    If you did it this way then your entire routine would be in LISP and you could put the text file in any folder you want.
     
    GTVic, Oct 28, 2004
    #2
  3. devon

    Dave Jones Guest

    specific folder. You could use the DOS_GETFILED function to locate the first
    file and then use DOS_DIR to return all the rest. Then you could use the
    DOS_CHECKLIST function to list all the drawings and uncheck the drawings you
    don't want.
    could put the text file in any folder you want.

    DosLib is how I've done it for years. Available free at www.mcneel.com .
    Here's a start

    (dos_chdir (getvar "dwgprefix"))
    (setq scrfile (open "MYNAME.SCR" "w"))
    (foreach dwgfile (setq dir (dos_dir "*.dwg"))
    (write-line (strcat "open " (dos_pwdir) dwgfile) scrfile)

    Dave
    DDP
     
    Dave Jones, Oct 28, 2004
    #3
  4. devon

    BTO Guest

    hi,

    (setq Path_selected (acet-ui-pickdir "Sélectionnez le dossier concerné"
    "C:\\"))
    (setq List_files (vl-directory-files Path_selected "*.dwg"))
    (setq List_files_sorted (acad_strlsort List_files ))

    you need express tools, or remove first line

    Bruno Toniutti
     
    BTO, Nov 17, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.