Please help?!

Discussion in 'AutoCAD' started by Holly, Dec 1, 2004.

  1. Holly

    Holly Guest

    Can someone please help?!
    Have had this warning using visual lisp editor:

    warning: too many arguments

    Have attached txt file with selected area of part of routine that is being flagged up - can anyone please advise?
    The more I look at it the more confused I'm getting!!

    Is there any software to help on this kind of thing? I know the visual lisp editor is useful, but is there anything that actually highlights the "actual" error? Or does VLE do this, but I just don't know how to?! (more the case!!!)

    Thanks in advance,
    HOLLY x
     
    Holly, Dec 1, 2004
    #1
  2. Holly

    C Witt Guest

    <snip> (if (tblsearch "layer" "Hid") nil <snip>
    should be..
    <snip> (if (= (tblsearch "layer" "Hid") nil) <snip>

    same for your other tblsearch if's.
     
    C Witt, Dec 1, 2004
    #2
  3. Holly

    Holly Guest

    Thanks for the post C Witt

    Will give it a shot and keep you posted!

    HOLLY x
     
    Holly, Dec 1, 2004
    #3
  4. Holly

    Tom Smith Guest

    I loaded it into VLIDE, hit "check text in editor" and it highlighted the
    first line starting with (action_tile etc.

    The problem is, you've hidden a necessary closing parenthesis behind a
    comment in the sixth line:

    ;;;strcat );;;action_tile

    Once you straighten out that and any other simlar glitches, you might have a
    mismatched parentheses issue.

    Some people do it, but I dislike the business of commenting closing
    parentheses. It can lead to silly errors like this, and IMHO doesn't help
    anything. The indentation level should be enough to show you what is being
    closed. Once I have my code debugged, I do away with all the lines which
    contain nothing but trailing parentheses, and wind up with something like:

    (action_tile
    "accept"
    (strcat
    "(progn
    (setq siz (atof (get_tile \"selections\")))
    (done_dialog)(setq userclick T))"))

    At a quick glance, there are some other oddities in here, like why would you
    ever need to (setq p1 p1)? When you get the thing running, and if you don't
    mind constructive criticism, post your code again and folks might suggest
    ways to improve it.
     
    Tom Smith, Dec 1, 2004
    #4
  5. Holly

    C Witt Guest

    you should attach all the files being used.. (prevents "us" from missing
    /seeing errors were they may or may not be).
     
    C Witt, Dec 1, 2004
    #5
  6. Holly

    Tom Smith Guest

    Not necessarily.

    Mathematical equality and nullness don't really go together.

    (if (not <whatever>) ...) or (if (null <whatever>) ...) are better form than
    (if ( = nil <whatever>) ... ).

    Better yet, turn it around so you make the opposite test, and save an
    operation, e.g. (if <whatever> ...). That's what Holly is doing, and I see
    no error in the code as far as the tblsearch portions. Example:

    (if (tblsearch "layer" "Text")
    nil
    (command "-layer" "new" "Text" "colour" "green" "Text" "")
    )

    This correctly does nothing, and returns nil, if the layer exists, otherwise
    it creates the layer. It could be reconstructed as you suggest:

    (if (not (tblsearch "layer" "Text"))
    (command "-layer" "new" "Text" "colour" "green" "Text" "")
    ;nil is implied here
    )

    That's one line shorter, if you eliminate the implied nil, but it adds an
    operation to the test, and doesn't accomplish anything different. It could
    be argued that the second version is a smidgen more intuitive, and that the
    difference is efficiency is in significant, but my point is, they're equally
    "correct" in doing what the code's supposed todo.
     
    Tom Smith, Dec 1, 2004
    #6
  7. Holly

    ECCAD Guest

    (action_tile
    "accept"
    (strcat
    "(progn (setq siz (atof (get_tile \"selections\")))"
    "(done_dialog)(setq userclick T))"
    );;;strcat );;;action_tile
     
    ECCAD, Dec 1, 2004
    #7
  8. Holly

    C Witt Guest

    I was only trying to fix the error.. nothing else.. you read to much
    into my reply..
     
    C Witt, Dec 1, 2004
    #8
  9. Holly

    Tom Smith Guest

    Okay, short version, that wasn't the error.
     
    Tom Smith, Dec 2, 2004
    #9
  10. Holly

    C Witt Guest

    and now i know that. thank you.
     
    C Witt, Dec 2, 2004
    #10
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.