+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Full Member
    Using
    AutoCAD 2016
    Join Date
    Jul 2008
    Posts
    63

    Default ; error: too many arguments

    Registered forum members do not see this ad.

    This is happening after I post the name of the lisp to the command line. I can't spot the error in it. It has always worked before. The lisp is supposed to search out text and attribute values and replace them. Can anyone spot the error?

    (defun c:BUBBLER01 ()

    (setq ss_blk (ssget "x" '((0 . "INSERT") (66 . 1))))

    (if ss_blk
    (progn

    (setq lst_blk (sel2lst ss_blk))

    (foreach en_blk lst_blk

    (setq lst_atts (att2lst en_blk))
    (setq str_line "")
    (foreach en_atts lst_atts
    (setq str_line (getval 1 en_atts))
    (if (not (wcmatch str_line "*/*/*"))
    (progn

    (setq str_line (strchg str_line *01* * 5555501*))
    (setq str_line (strchg str_line *02* * 5555502*))
    (setq str_line (strchg str_line *03* * 5555503*))
    (setq str_line (strchg str_line *04* * 5555504*))
    (setq str_line (strchg str_line *05* * 5555505*))
    (setq str_line (strchg str_line *06* * 5555506*))
    (setq str_line (strchg str_line *07* * 5555507*))
    (setq str_line (strchg str_line *08* * 5555508*))
    (setq str_line (strchg str_line *09* * 5555509*))
    (setq str_line (strchg str_line *10* * 5555510*))
    (setq str_line (strchg str_line *11* * 5555511*))
    (setq str_line (strchg str_line *12* * 5555512*))
    (setq str_line (strchg str_line *13* * 5555513*))
    (setq str_line (strchg str_line *14* * 5555514*))
    (setq str_line (strchg str_line *15* * 5555515*))
    (setq str_line (strchg str_line *16* * 5555516*))
    (setq str_line (strchg str_line *17* * 5555517*))
    (setq str_line (strchg str_line *18* * 5555518*))
    (setq str_line (strchg str_line *19* * 5555519*))
    (setq str_line (strchg str_line *20* * 5555520*))
    (setq str_line (strchg str_line *21* * 5555521*))
    (setq str_line (strchg str_line *22* * 5555522*))
    (setq str_line (strchg str_line *23* * 5555523*))
    (setq str_line (strchg str_line *24* * 5555524*))
    (setq str_line (strchg str_line *25* * 5555525*))
    (setq str_line (strchg str_line *26* * 5555526*))
    (setq str_line (strchg str_line *27* * 5555527*))
    (setq str_line (strchg str_line *28* * 5555528*))
    (setq str_line (strchg str_line *29* * 5555529*))
    (setq str_line (strchg str_line *30* * 5555530*))
    (setq str_line (strchg str_line *31* * 5555531*))
    (setq str_line (strchg str_line *32* * 5555532*))
    (setq str_line (strchg str_line *33* * 5555533*))
    (setq str_line (strchg str_line *34* * 5555534*))
    (setq str_line (strchg str_line *35* * 5555535*))
    (setq str_line (strchg str_line *36* * 5555536*))
    (setq str_line (strchg str_line *37* * 5555537*))
    (setq str_line (strchg str_line *38* * 5555538*))
    (setq str_line (strchg str_line *39* * 5555539*))
    (setq str_line (strchg str_line *40* * 5555540*))
    (setq str_line (strchg str_line *41* * 5555541*))
    (setq str_line (strchg str_line *42* * 5555542*))
    (setq str_line (strchg str_line *43* * 5555543*))
    (setq str_line (strchg str_line *44* * 5555544*))
    (setq str_line (strchg str_line *45* * 5555545*))
    (setq str_line (strchg str_line *46* * 5555546*))
    (setq str_line (strchg str_line *47* * 5555547*))
    (setq str_line (strchg str_line *48* * 5555548*))
    (setq str_line (strchg str_line *49* * 5555549*))
    (setq str_line (strchg str_line *50* * 5555550*))
    (setq str_line (strchg str_line *51* * 5555551*))
    (setq str_line (strchg str_line *52* * 5555552*))
    (setq str_line (strchg str_line *53* * 5555553*))
    (setq str_line (strchg str_line *54* * 5555554*))
    (setq str_line (strchg str_line *55* * 5555555*))
    (setq str_line (strchg str_line *56* * 5555556*))
    (setq str_line (strchg str_line *57* * 5555557*))
    (setq str_line (strchg str_line *58* * 5555558*))
    (setq str_line (strchg str_line *59* * 5555559*))
    (setq str_line (strchg str_line *60* * 5555560*))
    (setq str_line (strchg str_line *61* * 5555561*))
    (setq str_line (strchg str_line *62* * 5555562*))
    (setq str_line (strchg str_line *63* * 5555563*))
    (setq str_line (strchg str_line *64* * 5555564*))
    (setq str_line (strchg str_line *65* * 5555565*))
    (setq str_line (strchg str_line *66* * 5555566*))
    (setq str_line (strchg str_line *67* * 5555567*))
    (setq str_line (strchg str_line *68* * 5555568*))
    (setq str_line (strchg str_line *69* * 5555569*))
    (setq str_line (strchg str_line *70* * 5555570*))
    (setq str_line (strchg str_line *71* * 5555571*))
    (setq str_line (strchg str_line *72* * 5555572*))
    (setq str_line (strchg str_line *73* * 5555573*))
    (setq str_line (strchg str_line *74* * 5555574*))
    (setq str_line (strchg str_line *75* * 5555575*))
    (setq str_line (strchg str_line *76* * 5555576*))
    (setq str_line (strchg str_line *77* * 5555577*))

    (setval 1 str_line en_atts)
    ))))))

    (setq ss_txtlines (ssget "x" '((0 . "TEXT"))))

    (if ss_txtlines
    (progn

    (setq lst_txtlines (sel2lst ss_txtlines))
    (setq str_line "")

    (foreach en_txtlines lst_txtlines

    (setq str_line (getval 1 en_txtlines))
    (if (not (wcmatch str_line "*/*/*"))
    (progn

    (setq str_line (strchg str_line *01* * 5555501*))
    (setq str_line (strchg str_line *02* * 5555502*))
    (setq str_line (strchg str_line *03* * 5555503*))
    (setq str_line (strchg str_line *04* * 5555504*))
    (setq str_line (strchg str_line *05* * 5555505*))
    (setq str_line (strchg str_line *06* * 5555506*))
    (setq str_line (strchg str_line *07* * 5555507*))
    (setq str_line (strchg str_line *08* * 5555508*))
    (setq str_line (strchg str_line *09* * 5555509*))
    (setq str_line (strchg str_line *10* * 5555510*))
    (setq str_line (strchg str_line *11* * 5555511*))
    (setq str_line (strchg str_line *12* * 5555512*))
    (setq str_line (strchg str_line *13* * 5555513*))
    (setq str_line (strchg str_line *14* * 5555514*))
    (setq str_line (strchg str_line *15* * 5555515*))
    (setq str_line (strchg str_line *16* * 5555516*))
    (setq str_line (strchg str_line *17* * 5555517*))
    (setq str_line (strchg str_line *18* * 5555518*))
    (setq str_line (strchg str_line *19* * 5555519*))
    (setq str_line (strchg str_line *20* * 5555520*))
    (setq str_line (strchg str_line *21* * 5555521*))
    (setq str_line (strchg str_line *22* * 5555522*))
    (setq str_line (strchg str_line *23* * 5555523*))
    (setq str_line (strchg str_line *24* * 5555524*))
    (setq str_line (strchg str_line *25* * 5555525*))
    (setq str_line (strchg str_line *26* * 5555526*))
    (setq str_line (strchg str_line *27* * 5555527*))
    (setq str_line (strchg str_line *28* * 5555528*))
    (setq str_line (strchg str_line *29* * 5555529*))
    (setq str_line (strchg str_line *30* * 5555530*))
    (setq str_line (strchg str_line *31* * 5555531*))
    (setq str_line (strchg str_line *32* * 5555532*))
    (setq str_line (strchg str_line *33* * 5555533*))
    (setq str_line (strchg str_line *34* * 5555534*))
    (setq str_line (strchg str_line *35* * 5555535*))
    (setq str_line (strchg str_line *36* * 5555536*))
    (setq str_line (strchg str_line *37* * 5555537*))
    (setq str_line (strchg str_line *38* * 5555538*))
    (setq str_line (strchg str_line *39* * 5555539*))
    (setq str_line (strchg str_line *40* * 5555540*))
    (setq str_line (strchg str_line *41* * 5555541*))
    (setq str_line (strchg str_line *42* * 5555542*))
    (setq str_line (strchg str_line *43* * 5555543*))
    (setq str_line (strchg str_line *44* * 5555544*))
    (setq str_line (strchg str_line *45* * 5555545*))
    (setq str_line (strchg str_line *46* * 5555546*))
    (setq str_line (strchg str_line *47* * 5555547*))
    (setq str_line (strchg str_line *48* * 5555548*))
    (setq str_line (strchg str_line *49* * 5555549*))
    (setq str_line (strchg str_line *50* * 5555550*))
    (setq str_line (strchg str_line *51* * 5555551*))
    (setq str_line (strchg str_line *52* * 5555552*))
    (setq str_line (strchg str_line *53* * 5555553*))
    (setq str_line (strchg str_line *54* * 5555554*))
    (setq str_line (strchg str_line *55* * 5555555*))
    (setq str_line (strchg str_line *56* * 5555556*))
    (setq str_line (strchg str_line *57* * 5555557*))
    (setq str_line (strchg str_line *58* * 5555558*))
    (setq str_line (strchg str_line *59* * 5555559*))
    (setq str_line (strchg str_line *60* * 5555560*))
    (setq str_line (strchg str_line *61* * 5555561*))
    (setq str_line (strchg str_line *62* * 5555562*))
    (setq str_line (strchg str_line *63* * 5555563*))
    (setq str_line (strchg str_line *64* * 5555564*))
    (setq str_line (strchg str_line *65* * 5555565*))
    (setq str_line (strchg str_line *66* * 5555566*))
    (setq str_line (strchg str_line *67* * 5555567*))
    (setq str_line (strchg str_line *68* * 5555568*))
    (setq str_line (strchg str_line *69* * 5555569*))
    (setq str_line (strchg str_line *70* * 5555570*))
    (setq str_line (strchg str_line *71* * 5555571*))
    (setq str_line (strchg str_line *72* * 5555572*))
    (setq str_line (strchg str_line *73* * 5555573*))
    (setq str_line (strchg str_line *74* * 5555574*))
    (setq str_line (strchg str_line *75* * 5555575*))
    (setq str_line (strchg str_line *76* * 5555576*))
    (setq str_line (strchg str_line *77* * 5555577*))

    (setval 1 str_line en_txtlines)
    ))))))

  2. #2
    Senior Member Jef!'s Avatar
    Using
    AutoCAD 2008
    Join Date
    Sep 2010
    Posts
    274

    Default

    Hi Buster. Please use code tags.

    On my side there is functions for which I don't have the definition (sel2lst, att2lst, getval, strchg, setval), so it is hard to debug a code without having it.
    strchg also use a protected symbol which is *. If it meant as a string, it should be "*". If the idea is to pass the multiply operator, you have to use '*. Also good for the other arguments (like "*01*" and "5555501*")

    Also note that even if it would be different symbols defined by your huge lists in between the progn statements

    Code:
                (setq str_line (strchg str_line *01* * 5555501*))
                (setq str_line (strchg str_line *02* * 5555502*))
                (setq str_line (strchg str_line *03* * 5555503*))
                (setq str_line (strchg str_line *04* * 5555504*))
                (setq str_line (strchg str_line *05* * 5555505*))
                (setq str_line (strchg str_line *06* * 5555506*))
                (setq str_line (strchg str_line *07* * 5555507*))
                (setq str_line (strchg str_line *08* * 5555508*))
                (setq str_line (strchg str_line *09* * 5555509*))
                (setq str_line (strchg str_line *10* * 5555510*))
                (setq str_line (strchg str_line *11* * 5555511*))
                (setq str_line (strchg str_line *12* * 5555512*))
                (setq str_line (strchg str_line *13* * 5555513*))
    for sure there would exist better alternatives (repeat, while, foreach). But as it seems, not only it would not be optimal, but if i interpret correctly "strchg" for stringchange, it seems you just change the value of the variable strline again and again maybe without doing anything with it?
    Different goal also quite often means different path...

  3. #3
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    802

    Default

    There are subfunctions missing that are required to run the code .. oops too late

    Example to format code in posts.

  4. #4
    Full Member
    Using
    AutoCAD 2016
    Join Date
    Jul 2008
    Posts
    63

    Default

    Still getting the same error

  5. #5
    Full Member
    Using
    AutoCAD 2016
    Join Date
    Jul 2008
    Posts
    63

    Default

    Registered forum members do not see this ad.

    Got rid of asteriks and added code and /code. Works now. Thanks

Similar Threads

  1. Too many arguments error
    By LosGirk in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 16th Oct 2014, 09:57 pm
  2. Error: Too few arguments ?
    By Xelathrone in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 3rd Apr 2014, 05:13 am
  3. Error: too few arguments
    By arunr_18 in forum AutoLISP, Visual LISP & DCL
    Replies: 14
    Last Post: 20th Jul 2013, 09:49 pm
  4. ; error: too few arguments
    By satishrajdev in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 7th Feb 2013, 12:22 pm
  5. too many arguments error on lsp anyone know why
    By chelsea1307 in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 17th Jun 2009, 09:34 pm

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts