popping a "select file" dialog box

Discussion in 'AutoCAD' started by kemp, Jul 21, 2004.

  1. kemp

    kemp Guest

    I wrote a lisp that works fine, but I would like to give the user the
    ability to navigate to a file and select it to perform my lisp on using
    a dialog box. Is this simple to do?

    I do have objectdcl over here if this is the route I should take....

    thanks for any tips!
    kemp
     
    kemp, Jul 21, 2004
    #1
  2. kemp

    Jon Guest

    (setq ascfile (getfiled "ASCII Convert" (getvar "dwgprefix") "as4;asc" 2)

    The above line is from a programme I have.
    The Lisp command is getfiled, the heading on the dialogue box is "ASCII
    Convert", (getvar "dwgprefix") sets the initial directory to look in,
    "as4;asc" sets the extensions I want to allow, and the 2 is a flag that says
    the file must exist.

    Jon
     
    Jon, Jul 21, 2004
    #2
  3. kemp

    ECCAD Guest

    Only a slight modification..
    (setq dwgfile (getfiled "Select Drawing" (getvar "dwgprefix") "dwg" 8)

    Bob
     
    ECCAD, Jul 21, 2004
    #3
  4. kemp

    ECCAD Guest

    Forgot the ) on the end..add one.

    Bob
     
    ECCAD, Jul 21, 2004
    #4
  5. kemp

    kemp Guest

    getfiled is exactly what I needed. Thanks for the tip, ive been trying
    to make things much more difficult than needed, thanks for stopping me!

    (getfiled title default ext flags)

    This brings up one more question -
    Now how do I make the "default" portion of the command retain the
    directory value of the last time I ran the command (similar to how open
    works)? As it stands now it defaults to "my documents" or will only
    default to one specified directory...

    Thanks for the help!

    kemp
     
    kemp, Jul 21, 2004
    #5
  6. kemp

    ECCAD Guest

    First time into the routine, set the 'default' to "C:\\". When the user selects a dwg, the 'Path' will be attached to var 'dwgfile' in my example..you need to strip the .dwg and the drawingname with a llittle routine, and save it for the next 'default'. Can be done.

    Bob
     
    ECCAD, Jul 22, 2004
    #6
  7. kemp

    T.Willey Guest

    (setq dl1 (getfiled "Select drawing" "" "dwg" 16))
    (setq dl2 (vl-filename-directory dl1))

    "dl2" is the directory, and you could put that back into you (getfiled so next time it will go to that spot.

    This is how I do it. I have a question though, I use the flag 16 instead of 8. I had a problem of it stripping the directory away if the drawing was in my search path directory. Is there and problems with using 16 instead of 8. I didn't really get what the help file was talking about. If anyone could explain it a little better it would be much appreciated.

    Tim
     
    T.Willey, Jul 22, 2004
    #7
  8. kemp

    ECCAD Guest

    Tim,
    Neat.
    :)
     
    ECCAD, Jul 22, 2004
    #8
  9. kemp

    T.Willey Guest

    WOOOOHOOOOOO.... someone (that is good at programing) liked the way I wrote something.
    But I still don't know about the (getfiled.. function. If anyone has a good understanding of it, can you post a little something.
    =)
    Tim
     
    T.Willey, Jul 22, 2004
    #9
  10. kemp

    MP Guest

    The help pretty much covers it.

    good understanding of it, can you post a little something.
     
    MP, Jul 22, 2004
    #10
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.