how to load a lisp file within a lisp

Discussion in 'AutoCAD' started by molokaiboy, Oct 21, 2004.

  1. molokaiboy

    molokaiboy Guest

    How do I load and execute a lisp file within another lisp?

    TIA

    Collin
     
    molokaiboy, Oct 21, 2004
    #1
  2. molokaiboy

    Rick Keller Guest

    I think you just type: (load "lisp name")

    Then you run it by typing the function name in ().

    (function name) <--- could be a regular function or c: function if it is a
    c: make sure you include it in the ().

    Rick
     
    Rick Keller, Oct 21, 2004
    #2
  3. molokaiboy

    Tom Smith Guest

    How do I load and execute a lisp file within another lisp?

    Let's say the file is named dostuff.lsp, it's on your search path, and it
    contains a "command" function (c:dostuff). The calling function would be
    something like:

    (if (not c:dostuff) ;if c:dostuff isn't yet defined
    (load "dostuff") ;then load it
    )
    (c:dostuff) ;call the function

    If dostuff is going to be part of your function "library," which you call in
    various other routines, then you should probably go ahead and load (or
    autoload) it on startup. Then you could simply call the function (c:dostuff)
    without worrying about whether it's loaded.
     
    Tom Smith, Oct 21, 2004
    #3
  4. molokaiboy

    molokaiboy Guest

    that did it. Thanks
     
    molokaiboy, Oct 21, 2004
    #4
  5. molokaiboy

    Matt W Guest

    (load "MyLisp.lsp")
    (c:MyLisp) or (MyLisp) ...depending upon what comes after "DEFUN" within
    MyLisp.

    --
    I support two teams: the Red Sox and whoever beats the Yankees.


    | How do I load and execute a lisp file within another lisp?
    |
    | TIA
    |
    | Collin
     
    Matt W, Oct 21, 2004
    #5
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.