Lisp in a lisp...

Discussion in 'AutoCAD' started by calpolyarc, Mar 18, 2005.

  1. calpolyarc

    calpolyarc Guest

    I have an existing routine called XX. How can I create a new routine, called FF that does the following:

    (defun C:FF ()
    (command "._fillet" "r" "0")
    (command "._fillet")
    ***Now I want to run the XX routine***
    (prince)
    )

    Thanks!
     
    calpolyarc, Mar 18, 2005
    #1
  2. calpolyarc

    Paul Turvill Guest

    Assuming you defun'd the XX function as C:XX, it's

    (defun C:FF ()
    (command "._fillet" "r" "0")
    (command "._fillet")
    ;;;The following 3 lines allow the fillet command to finish:
    (while (= (logand (getvar "cmdactive") 1) 1)
    (command pause)
    );;while
    ;;;The following calls the XX function:
    (c:xx)
    (princ)
    )
    ___
     
    Paul Turvill, Mar 18, 2005
    #2
  3. calpolyarc

    Tom Smith Guest

    Assuming that there's a (c:xx) function in a file xx.lsp, available on the search path:

    (defun C:FF ()
    (command "._fillet" "r" "0")
    (command "._fillet")
    (if (not c:xx)
    (load "xx.lsp"))
    (c:xx)
    (princ)
    )
     
    Tom Smith, Mar 18, 2005
    #3
  4. calpolyarc

    Tom Smith Guest

    Paul, good catch on finishing the fillet command.
     
    Tom Smith, Mar 18, 2005
    #4
  5. calpolyarc

    calpolyarc Guest

    yeah that's the problem I was running into. I kept skipping right to the XX routine. Thanks guys! Now to try it....
     
    calpolyarc, Mar 18, 2005
    #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.