lisp problem..

Discussion in 'AutoCAD' started by C Witt, Jul 25, 2003.

  1. C Witt

    C Witt Guest

    I have this lisp file, that opens/runs a dialog box.. my problem is
    that I need to change it so that it can be "run" just by loading the
    lisp. I tried to remove the "defun c:dss" part.. but after the program
    runns.. it spits out an error.. "; error: bad argument type: numberp: nil"

    Now I know that it's not any other lisp or the dcl file that causes
    this.. since it works fine with the "defun c:dss" in it.. but i NEED
    it without.. (unless someone can tell me how to invoke a lisp from
    inside a lisp with just the "command").

    thanks

    (setq dstyle 0)
    (defun press ()
    (if (= (get_tile "US24x36") "1")(setq dstyle 1))
    (if (= (get_tile "US11x17") "1")(setq dstyle 2))
    (if (= (get_tile "US8-1/2x11") "1")(setq dstyle 3))
    (if (= (get_tile "Can24x36MET") "1")(setq dstyle 4))
    (if (= (get_tile "Can11x17IMP") "1")(setq dstyle 5))
    (if (= (get_tile "Can11x17MET") "1")(setq dstyle 6))
    )

    (defun check ()
    (if (= dstyle 1)(load "US-IMP.lsp"))
    (if (= dstyle 2)(load "US-IMP.lsp"))
    (if (= dstyle 3)(load "US-IMP.lsp"))
    (if (= dstyle 4)(load "MET.lsp"))
    (if (= dstyle 5)(load "CA-IMP.lsp"))
    (if (= dstyle 6)(load "MET.lsp"))
    )

    (defun c:dss ( / dcl_file msg )
    (setq dcl_file (load_dialog "DimensionStyles"))
    (new_dialog "DimensionStyles" dcl_file)
    (action_tile "accept" "(press)(done_dialog 1)")
    (setq what_now (start_dialog))
    (cond
    ((= what_now 1)(check))
    )
    (princ)
    )
    (command "'graphscr")
     
    C Witt, Jul 25, 2003
    #1
  2. C Witt

    Michel Guest

    Well the last line (command "'graphscr") is not valid should be (graphscr)
    ....and you can invoke a lisp within a lisp....(c:dss).....but i dont see where
    your error come from...maybe from the check result


    C Witt a écrit :
     
    Michel, Jul 25, 2003
    #2
  3. C Witt

    R.K. McSwain Guest

    Did you also remove the corresponding closing parenthesis?
     
    R.K. McSwain, Jul 25, 2003
    #3
  4. C Witt

    C Witt Guest

    - i didn't remove the starting parenthesis.. why would I remove the
    closing?.. They are still needed to "group" the commands.. yes?..

    On a side note, I have found another way of doing what I need (thus
    being able to leave this as-is).. though I would still like to know the
    solution incase i have to do it on another occasion.
     
    C Witt, Jul 25, 2003
    #4
  5. C Witt

    R.K. McSwain Guest

    To quote your original post:
    "I tried to remove the "defun c:dss" part.. "

    So I was simply asking if you removed the "(defun c:dss", that if you also removed the closing ")"
     
    R.K. McSwain, Jul 25, 2003
    #5
  6. C Witt

    C Witt Guest

    Yes I did remove "defun c:dss".. but not "(defun c:dss" the "(" remained.
     
    C Witt, Jul 25, 2003
    #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.