Return value from APPLOAD

Discussion in 'AutoCAD' started by dean_bourke, Jan 31, 2005.

  1. dean_bourke

    dean_bourke Guest

    hi,
    Basically, I want to load one lisp file via a getfiled type dialog and have it load specific files in relative paths without having those folders in the acad path.

    Can it be done?

    Dean
     
    dean_bourke, Jan 31, 2005
    #1
  2. Laurie Comerford, Jan 31, 2005
    #2
  3. dean_bourke

    dean_bourke Guest

    would you like to tell me how?
     
    dean_bourke, Jan 31, 2005
    #3
  4. dean_bourke

    YoungerMan Guest

    Hi. I too would like to know how it can be done.
     
    YoungerMan, Jan 31, 2005
    #4
  5. Hi Dean,

    More or less straight out of the help system.

    (setq xx (getfiled "Select a Lisp File" "c:/program files/AutoCAD
    2005/support/" "lsp" 8))
    (setq fil (findfile xx))

    "fil" is a fully qualified path and file name for the selected file.

    You can manipulate the string as you like to create the relative paths.

    You will probably be limited to finding files on the AutoCAD path, but your
    relative can go anywhere from there.

    --

    Regards,


    Laurie Comerford
    www.cadapps.com.au
     
    Laurie Comerford, Jan 31, 2005
    #5
  6. dean_bourke

    dean_bourke Guest

    Loading the files from outside my acadpath was the whole point of the question.
     
    dean_bourke, Jan 31, 2005
    #6
  7. Assuming that you select a file using the
    (getfiled) function, you can then compose
    a path relative to same, manually. If you
    seek an automatic means of loading files
    not on the search path, forget it. You have
    to do it by hand.

    You will need to manipulate the path string,
    as needed to compose the relative path:

    Given

    (setq base "d:\\level1\\level2\\filename.lsp")

    If you want to load a file in a subdirectory
    of the folder that contains the above file
    (let's call the subdirectory "level3"):

    (setq newpath
    (strcat
    (vl-filename-directory base)
    "\\level3"
    )
    )

    Which returns:

    "d:\\level1\\level2\\level3"

    So, you can then append filenames to that
    to pass to (load):

    (load (strcat newpath "\\" "myfile.lsp"))
     
    Tony Tanzillo, Feb 1, 2005
    #7
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.