LISP not loading

Discussion in 'AutoCAD' started by Patrick Weaver, Dec 14, 2004.

  1. Help!

    I can't get a certain lisp routine to load via a macro. The other routines I
    have work fine, so I'm at a loss to find the problem.

    Here's the macro:
    ^C^C(if (not c:NZX)(load "NZX.lsp"))
    NZX^C^C_select;!NZS;;_mirror3d;p;;0,0,0;0,1,0;1,0,0;Y;

    Here's the routine:
    (defun c:NZX () ;Negative Z eXtrusion
    (setq nzs (ssadd))
    (setq a (ssget "X"))
    (setq b 0)
    (repeat (sslength a)
    (setq c (ssname a b))
    (setq d (entget c))
    (setq e (cadddr (assoc 210 d)))
    (if (equal e -1.0 0.000001)
    (setq nzs (ssadd c nzs))
    )
    (setq b (1+ b))
    )
    (setq nzslength (sslength nzs))
    (princ "\nThere are ")
    (princ nzslength)
    (princ " entities with -1 Z-extrusion in this drawing.")
    (princ "\nThat selection set is named !NZS.")
    (princ)
    )

    The lsp file is in the support directory, and the whole thing works fine
    when loaded from VLISP. I just can't get it to load via the macro.

    Thanks
     
    Patrick Weaver, Dec 14, 2004
    #1
  2. Patrick Weaver

    dth Guest

    I just looked quickly on screen, but I think it might be the ! in front of
    the NZS
     
    dth, Dec 14, 2004
    #2
  3. Patrick Weaver

    Dommy2Hotty Guest

    If it's just not loading the lisp file, try this:
    Code:
    ^C^C(if (not c:NZX)(load "NZX.lsp"));NZX^C^C_select;!NZS;;_mirror3d;p;;0,0,0;0,1,0;1,0,0;Y;
     
    Dommy2Hotty, Dec 14, 2004
    #3
  4. Patrick Weaver

    Tom Smith Guest

    I can't get a certain lisp routine to load

    It's got to be a problem with the macro. Take it apart and find the part
    that's broken.

    I don't like having a menu cluttered up with multiple lines of "(if (not
    c:whatever)(load "whatever"));whatever;" where the only thing that varies is
    <whatever>, and the if test gets performed every time the macro is run.

    You can eliminate all of this by loading the lisps in an associated mnl
    file. The intent of mnl's is to get much of the inline lisp out of the menu,
    and to ensure that any lisps used by the menu are available.

    If your mnl contained the line (autoload "nzx" '("nzx")), then your menu
    macro could simply begin with ^c^cNZX.
     
    Tom Smith, Dec 15, 2004
    #4
  5. I was not aware of the mnl file. That solved the problem. Thanks Tom.
     
    Patrick Weaver, Dec 15, 2004
    #5
  6. Patrick Weaver

    Tom Smith Guest

    I was not aware of the mnl file. That solved the problem. Thanks Tom.

    The mnl can have lots of handy uses, since it loads automatically along with
    the associated menu. We use a custom partial menu, and when it loads the mnl
    initializes all of our other customizations. It can serve the same purpose
    as an acaddoc.lsp file.
     
    Tom Smith, Dec 15, 2004
    #6
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.