Here's a doosie....

Discussion in 'AutoCAD' started by Jason Wilder, May 26, 2004.

  1. Jason Wilder

    Jason Wilder Guest

    * i think * cause I'm stuck....

    I need to 'mirror' the directory tree of the drawing I'm printing, such as:

    Open - F:\\dwg\\job\\file.dwg

    Print - R:\\record\\job\\file.dwf

    So, the F: location exists, however, I need the tree mimiced on the R:
    drive, with the change in root name. The path names could get a bit longer
    but the bottom line is that I am changing 'F:\\dwg' with 'R:\\record', but
    obviously this won't process through a script if the path doesn't exist on
    the R: drive.

    I'm thinking perhaps there might be a 'smoother' way of doing this through
    VBA, but this entire routine is in LISP atm.

    Any takers? :D
     
    Jason Wilder, May 26, 2004
    #1
  2. Jason Wilder

    Jason Wilder Guest

    Ok, went and got a drink, dislodged the block.... crude, but here is what I
    came up with.

    dwfdir = R:\\record\\job\\

    (if (/= (findfile dwfdir) NIL)
    (command ".script" (strcat #LOCAL "dwfprint"))
    (progn
    (command "sh" (strcat "mkdir " (chr 34) dwfdir (chr 34)))
    (command ".script" (strcat #LOCAL "dwfprint"))
    )
    )

    Willing to entertain better versions. :)
     
    Jason Wilder, May 26, 2004
    #2
  3. Jason Wilder

    Steve Doman Guest

    Jason,

    You've got it, but I think this might be simpler...

    (vl-mkdir "R:\\record\\job")
    (command ".script" (strcat #LOCAL "dwfprint"))

    vl-mkdir makes the directory if it doesn't exist. Returns nil if it
    does exist.


    Steve Doman
     
    Steve Doman, May 26, 2004
    #3
  4. Jason Wilder

    Jason Wilder Guest

    True, but (vl-mkdir) won't create the tree if it doesn't exist. Unless
    R:\\record already exists, it won't create the job folder.

    That's why I'm using the DOS mkdir, it will create the folder, and any
    pieces of the path that don't already exist.
     
    Jason Wilder, May 26, 2004
    #4
  5. Jason Wilder

    Walt Engle Guest

    Ever try 2xExplorer or Winfile? Both are excellent for making directories,
    sub-directories and also for deleting them (not to mention the capability of
    copying from one drive to another).
     
    Walt Engle, May 26, 2004
    #5
  6. Jason Wilder

    Jason Wilder Guest

    Are either of those easy to operate out of LISP?
     
    Jason Wilder, May 26, 2004
    #6
  7. Jason Wilder

    Walt Engle Guest

    No. They are programs that allow copying, moving, making directories, changing
    names of directories and/or files. You said that you use dos to mkdir and I was
    merely pointing out two programs that work ten - no twenty times easier.
     
    Walt Engle, May 26, 2004
    #7
  8. Jason Wilder

    Jürg Menzi Guest

    Jason
    or visit my homepage -> Free Stuff and search for 'VxMakeDirectory'...

    Cheers
     
    Jürg Menzi, May 26, 2004
    #8
  9. Jason Wilder

    Jason Wilder Guest

    Well, agreed, but no an as needed basis, not really. And I need it to be
    done via LISP at this point, not a separate process, on demand. I don't
    need to copy an entire directory structure just for fun.

    I've got my solution, but appreciate the pointer to the other programs.
     
    Jason Wilder, May 26, 2004
    #9
  10. Have you looked at the free programs DOSlib?
    There are many Drive, Path, Directory and File functions available from
    AutoLISP.

    Robert McNeel & Associates
    3670 Woodland Park Avenue North
    Seattle, WA 98103
    Phone: (206) 545-7000
    FAX: (206) 545-7321
    Internet: www.mcneel.com

    Alan Henderson
     
    Alan Henderson @ A'cad Solutions, May 26, 2004
    #10
  11. Jason Wilder

    Jason Wilder Guest

    heh, forgot about doslib! :)

    basically the same thing, and don't have to use the command shell, duh! hehe
     
    Jason Wilder, May 26, 2004
    #11
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.