2016 acad lisp program returns "to many arguments"

2016 acad lisp program returns "to many arguments"

kevin_smith3
Participant Participant
820 Views
12 Replies
Message 1 of 13

2016 acad lisp program returns "to many arguments"

kevin_smith3
Participant
Participant

i have a lisp program i am constantly updating. after my last update 1 out of 12 designers lisp program returns "to many arguments". i have delt with this message before, but it is only on one machine this time. is there a system variable that could cause this?

0 Likes
Accepted solutions (1)
821 Views
12 Replies
Replies (12)
Message 2 of 13

ВeekeeCZ
Consultant
Consultant
Is it possible to post the code?
0 Likes
Message 3 of 13

kevin_smith3
Participant
Participant

yes, it is a lengthy program. several years of modifications.

 

Thanks,

0 Likes
Message 4 of 13

Kent1Cooper
Consultant
Consultant

Can you narrow it down to the area(s) where you last made changes?

Kent Cooper, AIA
0 Likes
Message 5 of 13

ВeekeeCZ
Consultant
Consultant
When this error happens... on load or run?
Is Visual Editor able to show you the line where is the problem? (Debug/Break on Error... then Last break source).
Did you try to trace that?
0 Likes
Message 6 of 13

kevin_smith3
Participant
Participant

Below are the last two modifications i made. the error occurs when he runs the program. i will have to look at your suggestions when the designer is not here. so monday ealry i will look at that.

 

Thanks,

 

 

     (if (= file2 16)
       (progn
         (setq block12 "C:/Block Viewer2/DATA PLATE BRACKET/DPB1BOM")(setq block13 "SFI DATA PLATE BOM");;;;;;;;;;
         (setq block1 "C:/Block Viewer2/DATA PLATE BRACKET/DPB1FRONT")(setq block14 "SFI DATA PLATE FRONT");;;;;;;
     (setq block2 "C:/Block Viewer2/DATA PLATE BRACKET/DPB1TOP")(setq block15 "SFI DATA PLATE TOP");;;;;;;;;;;
         (setq block3 "C:/Block Viewer2/DATA PLATE BRACKET/DPB1SIDE")(setq block16 "SFI DATA PLATE SIDE");;;;;;;;;
     (setq block4 "C:/Block Viewer2/DATA PLATE BRACKET/DPB2BOM")(setq block17 "ASME DATA PLATE BOM");;;;;;;;;;
      (setq block5 "C:/Block Viewer2/DATA PLATE BRACKET/DPB2FRONT")(setq block18 "ASME DATA PLATE FRONT");;;;;;
         (setq block6 "C:/Block Viewer2/DATA PLATE BRACKET/DPB2TOP")(setq block19 "ASME DATA PLATE TOP");;;;;;;;;;
         (setq block7 "C:/Block Viewer2/DATA PLATE BRACKET/DPB2SIDE")(setq block20 "ASME DATA PLATE SIDE");;;;;;;;
         (setq block8 "C:/Block Viewer2/DATA PLATE BRACKET/DPB3BOM")(setq block21 "SFI/ASME DATA PLATE BOM");;;;;;
         (setq block9 "C:/Block Viewer2/DATA PLATE BRACKET/DPB3FRONT")(setq block22 "SFI/ASME DATA PLATE FRONT");;
         (setq block10 "C:/Block Viewer2/DATA PLATE BRACKET/DPB3TOP")(setq block23 "SFI/ASME DATA PLATE TOP");;;;;
         (setq block11 "C:/Block Viewer2/DATA PLATE BRACKET/DPB3SIDE")(setq block24 "SFI/ASME DATA PLATE SIDE");;;
     (setq block25 "C:/Block Viewer2/DATA PLATE BRACKET/DPB4BOM")(setq block29 "API DATA PLATE BOM");;;;;;;;;;
     (setq block26 "C:/Block Viewer2/DATA PLATE BRACKET/DPB4FRONT")(setq block30 "API DATA PLATE FRONT");;;;;;
     (setq block27 "C:/Block Viewer2/DATA PLATE BRACKET/DPB4TOP")(setq block31 "API DATA PLATE TOP");;;;;;;;;;
     (setq block28 "C:/Block Viewer2/DATA PLATE BRACKET/DPB4SIDE")(setq block32 "API DATA PLATE SIDE");;;;;;;;
         (setq file1 nil)                                        ;;;;;;;;;;
         (mode_tile "next" 0)(setq page3 0)                                 ;;;;;;;;;;
       )                                                ;;;;;;;;;;
     )                                                    ;;;;;;;;;;

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       (if (= file2 16)(progn                                            
         (setq block12 "C:/Block Viewer2/DATA PLATE BRACKET/DPB5BOM")(setq block13 "SFI SHOP NAME PLATE BOM")
         (setq block1 "C:/Block Viewer2/DATA PLATE BRACKET/DPB5FRONT")(setq block14 "SFI SHOP NAME PLATE FRONT")    
     (setq block2 "C:/Block Viewer2/DATA PLATE BRACKET/DPB5TOP")(setq block15 "SFI SHOP NAME PLATE TOP")
     (setq block3 "C:/Block Viewer2/DATA PLATE BRACKET/DPB5SIDE")(setq block16 "SFI SHOP NAME PLATE SIDE")
     (setq block4 "C:/Block Viewer2/DATA PLATE BRACKET/DPB6BOM")(setq block17 "SFI FIELD NAME PLATE BOM")
         (setq block5 "C:/Block Viewer2/DATA PLATE BRACKET/DPB6FRONT")(setq block18 "SFI FIELD NAME PLATE FRONT")    
     (setq block6 "C:/Block Viewer2/DATA PLATE BRACKET/DPB6TOP")(setq block19 "SFI FIELD NAME PLATE TOP")
     (setq block7 "C:/Block Viewer2/DATA PLATE BRACKET/DPB6SIDE")(setq block20 "SFI FIELD NAME PLATE SIDE")
        ))
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

0 Likes
Message 7 of 13

Kent1Cooper
Consultant
Consultant

By the way, unrelated to the question at hand, you can reduce the file size by eliminating a whole batch of (progn) functions, in two ways:

 

1. You can combine multiple variable settings in one (setq) function, so in many of your instances the one (setq) can be the 'then' argument to an (if) function, rather than a bunch of (setq)'s "wrapped" inside a (progn) function.  One short example -- this:

 

(if (= file2 4)
  (progn
    (setq block12 "C:/Block Viewer2/Ferrule Tank Kettle Valve NZ-FER-001/4_in_bom_260")

    (setq block13 "4_IN_BOM")
    (setq block1 "C:/Block Viewer2/Ferrule Tank Kettle Valve NZ-FER-001/4_in_side_260")

    (setq block14 "4_IN_SIDE")
    (setq file1 nil)
  )
)

 

can be done this way:

 

(if (= file2 4)
  (setq

    block12 "C:/Block Viewer2/Ferrule Tank Kettle Valve NZ-FER-001/4_in_bom_260" ;; note right parentheses removed

    block13 "4_IN_BOM"
    block1 "C:/Block Viewer2/Ferrule Tank Kettle Valve NZ-FER-001/4_in_side_260"

    block14 "4_IN_SIDE"
    file1 nil

  ); setq ;; this right parenthesis covers all variable settings
); if

 

2.  In a "satisfied" condition in a (cond) function, you don't need to "wrap" multiple functions inside a (progn) function, the way you do for the 'then' or 'else' argument to an (if) function [even if you were to keep separate (setq) functions as in most of your (cond)/(progn) functions].  You can change this [a shorter example]:

 

((= file3 2)

  (progn
    (setq block12 "C:/Block Viewer2/Lifting Lugs/Lifting lug silo SI-LLG-001/lug_bom_330")

    (setq block13 "LUG_BOM")
    (setq block1 "C:/Block Viewer2/Lifting Lugs/Lifting lug silo SI-LLG-001/lug_side_330")

    (setq block14 "LUG_SIDE")
    (setq block2 "C:/Block Viewer2/Lifting Lugs/Lifting lug silo SI-LLG-001/lug_top_330")

    (setq block15 "LUG_TOP")
    (setq file4 nil)
  ); progn

); file3 = 2 condition

 

to this:

 

((= file3 2)

  (setq
    block12 "C:/Block Viewer2/Lifting Lugs/Lifting lug silo SI-LLG-001/lug_bom_330"

    block13 "LUG_BOM"
    block1 "C:/Block Viewer2/Lifting Lugs/Lifting lug silo SI-LLG-001/lug_side_330"

    block14 "LUG_SIDE"
    block2 "C:/Block Viewer2/Lifting Lugs/Lifting lug silo SI-LLG-001/lug_top_330"

    block15 "LUG_TOP"
    file4 nil
  ); setq

); file3 = 2 condition

 

Kent Cooper, AIA
0 Likes
Message 8 of 13

kevin_smith3
Participant
Participant

i will make this change and try it on his monday before he gets here. this is the bad part about being self taught. just know enough to get by.

 

Thanks,

0 Likes
Message 9 of 13

ВeekeeCZ
Consultant
Consultant

@Anonymous wrote:

i will make this change and try it on his monday before he gets here. this is the bad part about being self taught. just know enough to get by.

 

Thanks,


I would recommend - don't. Honestly, this looks very much like lisp "I taught myself." - No hard feelings 🙂  But it's kind of what it is and it worked. If you begin to rewrite it because of some minor improvements, then there rather chop a lot more mistakes and it does not improve much. Indeed with advanced instruments and greater use of list you'll be able to shorten the code TO maybe 10-20 percent of its present length. (mapcar, eval, cons, wcmatch...)
Once you program the next time, so you know what you can improve.

0 Likes
Message 10 of 13

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

Below are the last two modifications i made. the error occurs when he runs the program. ....


There are certain ways of omitting or misplacing parentheses and/or double-quotes, or having extra ones, that might result in the kind of error message you're seeing, though A) I didn't see any such omissions/misplacements/extras in any of the (if)/(progn)/(setq) functions in what you posted, and B) such an error should affect all Users.  And the (mode_tile) function there has the same number and kinds of arguments as in scores of other places.

 

Could it be something not within the area where you changed things, but downstream somewhere in the use of those settings?  Since it looks like all the Block name settings are in C: drive locations, they must be local to each computer.  Might that one computer be missing a folder, or have a sub-folder shifted to be in the wrong place [we once had a draftsperson who pretty often picked on a folder and held onto it too long while shifting their mouse a little, and a folder would end up moved to end up inside an adjacent one, rather than opened], or some such thing?  Check that User's file structure.  If you can, try having all those things in folders in a shared location such as on a Server, where there can't be differences from one User to another.

Kent Cooper, AIA
0 Likes
Message 11 of 13

kevin_smith3
Participant
Participant

i copied the entire folder from a new backup i created. i thought about moving all the lisp programs to the server, but there are alot of them to fix. i did discover that all the machines are getting this error and then the program runs, but for some reason the one won't run. i will try the suggested changes to simply the program. knowing mine does it as well, i can fix it as soon as i have time. currently looking to see if the dialog box setting is turned off on his machine.

 

Thanks again

0 Likes
Message 12 of 13

kevin_smith3
Participant
Participant
i will apply the shorter programming to the next program i work on. thanks for the advise
0 Likes
Message 13 of 13

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

.... i will try the suggested changes to simply the program. knowing mine does it as well, i can fix it as soon as i have time. currently looking to see if the dialog box setting is turned off on his machine.

....


As BeekeeCZ said, the suggestions I made are not critical, and besides, they won't fix the problem you're having [as I started off in that Post, they're unrelated to the question at hand].  I would concentrate on finding and fixing the problem, and then if you want to tweak things, do it in a copy that you can test thoroughly before replacing a working [if longer] version.

Kent Cooper, AIA
0 Likes