too few arguments

Discussion in 'AutoCAD' started by ghiggins457, Mar 2, 2004.

  1. ghiggins457

    ghiggins457 Guest

    I am, somewhat new to this, as you can see by my recent posts online. I am writing a simple routine that will automatically add the correct text styles for another program we use and it is saying I have too few arguments. Can somebody help me with this please? Here is the routine:

    (defun c:textload
    (setvar "cmdecho" 0)
    (command "-style" iso30 txt.shx "" "" "" "" "" "")
    (command "-style" iso330 txt.shx "" "" "" "" "" "")
    (setvar "cmdecho" 1)
    (princ)
    )
     
    ghiggins457, Mar 2, 2004
    #1
  2. ghiggins457

    Chip Harper Guest

    Change:

    (defun c:textload
    (setvar "cmdecho" 0)

    to:

    (defun c:textload ( )
    (setvar "cmdecho" 0)
     
    Chip Harper, Mar 2, 2004
    #2
  3. ghiggins457

    ECCAD Guest

    I think you need a () after the defun:
    Change:
    (defun c:textload
    To:
    (defun c:textload ()

    Bob
     
    ECCAD, Mar 2, 2004
    #3
  4. ghiggins457

    ghiggins457 Guest

    Thanks, I forgot about that. Now, however, when I did that and loaded it. The command line says:

    Unknown command "TEXTLOAD". Press F1 for help.

    Any more suggestions? Thanks.
     
    ghiggins457, Mar 2, 2004
    #4
  5. ghiggins457

    ECCAD Guest

    I think the "-style" statements need a review. Looks like they may have too many "" "" in them. Normally, they will have (7) arguments.


    Bob
     
    ECCAD, Mar 2, 2004
    #5
  6. ghiggins457

    ghiggins457 Guest

    The problem is that, now, there are not too few arguments. Now, AutoCAD is saying that it doesn't know the command "textload". That's the problem now.
     
    ghiggins457, Mar 2, 2004
    #6
  7. ghiggins457

    ECCAD Guest

    How / where are you loading the function ? If you load the function (for the present .dwg), it should be there. IF you load the function, then 'open' another .dwg, then it won't be there, unless you load it in the acad.lsp or startup routine.
    Bob
     
    ECCAD, Mar 2, 2004
    #7
  8. ghiggins457

    ghiggins457 Guest

    I am loading it in the present drawing and when I type in the command "textload", the prompt line is giving me a message about Unknown command Textload. I don't think I've ever seen something like this before.

    Greg
     
    ghiggins457, Mar 2, 2004
    #8
  9. Enclose the style name and font within quotes as well?

    (command "-style" "iso30" "txt.shx" "" "" "" "" "" "")
    (command "-style" "iso330" "txt.shx" "" "" "" "" "" "")
     
    Allen Johnson, Mar 2, 2004
    #9
  10. ghiggins457

    ECCAD Guest

    Sorry, didn't see this the first time. You need a " around both
    iso30 and txt.shx -- like:

    (defun c:textload ()
    (setvar "cmdecho" 0)
    (command "-style" "iso30" "txt.shx" "" "" "" "" "" "")
    (command "-style" "iso330" "txt.shx" "" "" "" "" "" "")
    (setvar "cmdecho" 1)
    (princ)
    )

    Bob
     
    ECCAD, Mar 2, 2004
    #10
  11. I think your porblem is that autolisp is assuming iso33 and txt.shx to be
    variables (which, unless you define them evaluate to nil).
    When you supply nil to a command line argument, it thinks you clicked return
    and its trying to start your command again.
     
    Allen Johnson, Mar 2, 2004
    #11
  12. ghiggins457

    ghiggins457 Guest

    That worked. Thanks. I have one more question for you. I want another lisp program to run that program inside itself. Do you know how to do that?

    Thanks again for your help.

    Greg
     
    ghiggins457, Mar 2, 2004
    #12
  13. ghiggins457

    ECCAD Guest

    Greg,
    First example: assumes that the function 'c:textload' is in a stand-alone .lsp program called textload.lsp.
    Do:
    (load "textload.lsp")
    (c:textload)
    -----------
    Second example: assumes that the function 'c:textload' is within a utilities.lsp or such, or loaded on startup in acad.lsp.
    Do:
    (c:textload)

    Bob
     
    ECCAD, Mar 2, 2004
    #13
  14. ghiggins457

    ghiggins457 Guest

    Thanks, Bob. That worked perfectly. I shouldn't be bothering you any more, but I really do appreciate the help. Thanks again.

    Greg
     
    ghiggins457, Mar 2, 2004
    #14
  15. ghiggins457

    ECCAD Guest

    Greg,
    Glad to be of help. Anytime.

    Bob
     
    ECCAD, Mar 3, 2004
    #15
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.