See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Older Lisp Code Not Working in AutoCAD 2018.....Please Help

  1. #1
    I could stop if I wanted to
    Join Date
    2015-09
    Posts
    420
    Login to Give a bone
    0

    Default Older Lisp Code Not Working in AutoCAD 2018.....Please Help

    Hi AUGI Members,

    The list code below2 worked fine in AutoCAD 2013......however, we migrated to AutoCAD 2018 and the code does not run and I get a "Too Many Arguments" error.

    Can anyone identify what might be causing the problem..??

    Code:
      (if (= Xxsf nil)
        (setq Xxsf 30.0)
      )
      (if (= Yysf nil)
        (setq Yysf Xxsf)
      )
    
      (initget 6)
      (Prompt "\n...")
      (setq xsf (getdist  (strcat "\n...Enter X-Axis Drop Panel Size in Inches... <" (rtos Xxsf 2) ">: ")))
      (if (= xsf nil)
        (setq xsf Xxsf)
      )
      (setq Xxsf xsf)
      (initget 6)
      (Prompt "\n...")
      (setq ysf (getdist  (strcat "\n...Enter Y-Axis Drop Panel Size in Inches... <" (rtos Yysf 2) ">: " )))
      (if (not ysf)
        (setq ysf Yysf)
      )
      (setq Yysf ysf)

    Thank you in advance for your assistance..!!
    Vince

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Older Lisp Code Not Working in AutoCAD 2018.....Please Help

    There is no reason that shouldn't work in 2018. Is that all of your routine? Could it be failing somewhere else?

    Have you loaded the code in the VLIDE and checked to see what line the code fails on?

    Also, make sure QAFLAGS = 0
    R.K. McSwain | CAD Panacea |

  3. #3
    I could stop if I wanted to
    Join Date
    2015-09
    Posts
    420
    Login to Give a bone
    0

    Default Re: Older Lisp Code Not Working in AutoCAD 2018.....Please Help

    I commented out all of the other code so what I am posting is creating the "too many arguments..." error.

    I also made sure QAFLAGS = 0 and still received the error..!

    I did test it out on a couple other computers and the code ran OK......so the problem seems to be specific to my workstation.

    Is there any other settings, variables, etc. that I might have accidentally changed that would cause this error..??

    Thank you for your help,
    Vince

  4. #4
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Older Lisp Code Not Working in AutoCAD 2018.....Please Help

    But what line of code is it failing on?
    Do you know how to load the code in the VLIDE and then view the error, after it fails?
    R.K. McSwain | CAD Panacea |

  5. #5
    I could stop if I wanted to
    Join Date
    2015-09
    Posts
    420
    Login to Give a bone
    0

    Default Re: Older Lisp Code Not Working in AutoCAD 2018.....Please Help

    I did load it into the Visual Lisp Editor and did a check.......but it did not indicate any errors..!!

    The line I believe it is failing on is this one:

    (setq xsf (getdist (strcat "\n...Enter X-Axis Drop Panel Size in Inches... <" (rtos Xxsf 2) ">: ")))

    I tried to play with it a little and used this line

    (setq xsf (getreal (strcat "\n...Enter X-Axis Drop Panel Size in Inches... <" (rtos Xxsf 2) ">: ")))

    Then it seems to work but I have used this loop of code in many routines and I do not want to spend a lot of time to update them if this could be resolved.

    Any other ideas or suggestions..??


    Thanks,
    Vince

  6. #6
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    1

    Default Re: Older Lisp Code Not Working in AutoCAD 2018.....Please Help

    I think there is something else that is causing the too many arguments error. This code does not have that problem.

    RK was suggesting you open this in the VLIDE and check it there. Once it is loaded and executed, the VLIDE can point you to the line of code where the error occurs. In the View menu, select Error Trace option. This will open another window. The upper left icon is for Refresh. If you have an error, it should show up here.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  7. #7
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Older Lisp Code Not Working in AutoCAD 2018.....Please Help

    Do you get the error "Too Many Arguments" after you run the lisp command?

    If there are sub-functions on your code and its global [ outside your defined function ] and another lisp file has the same sub functin name but with one or two less required arguments

    Code:
    ;;    The questionable lisp file                ;;;
    
    (defun _banana ( a b )
            (strcat a " and " b))
    
    (defun c:test ( / please check your subfunc)
      
      (setq one (getstring "\nEnter something: "))
      (setq two (getstring "\nEnter something: "))
      (princ (_banana one two))
      (princ)
      )
    Code:
    Command: TEST
    Enter something: 12
    Enter something: 45
    12 and 45
    Code:
    ;;    Lisp file loaded AFTER the questionable lisp file    ;;;
    
    (defun _banana ( a )
            (strcat a " is something you type"))
    
    
    (defun c:test2 ( / please check your subfunc)
      (setq three (getstring "\nEnter something: "))
      
      (princ (_banana three))
      (princ)
      )

    Code:
    Command: TEST2
    Enter something: 34
    34 is something you type
    BUT

    Code:
    Command: TEST
    Enter something: ant
    Enter something: seb
    ; error: too many arguments
    Code:
    ;;    prefered way is localizing the sub            ;;;
    
    
    (defun c:test ( / _banana please_check your_subfunc)
      (defun _banana ( a b )
            (strcat a " and " b))
      (setq please_check (getstring "\nEnter something: "))
      (setq your_subfunc (getstring "\nEnter something: "))
      (princ (_banana please_check your_subfunc))
      (princ)
      )
    If the subfunction is the same company-wide, you can make it global but use a unique like PBE:MySubForThis,

  8. #8
    I could stop if I wanted to
    Join Date
    2015-09
    Posts
    420
    Login to Give a bone
    0

    Default Re: Older Lisp Code Not Working in AutoCAD 2018.....Please Help

    Here is the entire code string:

    Code:
    (DEFUN c:IDP ( LN xsf ysf Xxsf Yysf  / )
      (SetVar "CMDECHO" 0)
    
      (Setq LN (GETVAR "CLAYER"))
      (Command "COLOR" "BYLAYER")
    
      (if (= Xxsf nil)
        (Setq Xxsf 30.0)
      )
      (if (= Yysf nil)
        (Setq Yysf Xxsf)
      )
    
      (initget 6)
      (Prompt "\n...")
      (Setq xsf (getdist  (strcat "\n...Enter X-Axis Drop Panel Size in Inches... <" (rtos Xxsf 2) ">: ")))
    
      (if (= xsf nil)
        (Setq xsf Xxsf)
      )
      (Setq Xxsf xsf)
      (initget 6)
      (Prompt "\n...")
      (Setq ysf (getdist  (strcat "\n...Enter Y-Axis Drop Panel Size in Inches... <" (rtos Yysf 2) ">: ")))
    
      (if (not ysf)
        (Setq ysf Yysf)
      )
      (Setq Yysf ysf)
    
      (Prompt "\n...")
      (Prompt "\n...Select Drop Panel Insert Point......then......Define Rotation")
      (COMMAND "-INSERT" "D-PANEL" PAUSE xsf ysf PAUSE)
    
      (SetVar "CMDECHO" 1)
      (Command "-Layer" "S" LN "")
    
      (PRINC)
    )

  9. #9
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Older Lisp Code Not Working in AutoCAD 2018.....Please Help

    Good one.

    That works here in 2019.
    I just had to change this: (Command "COLOR" "BYLAYER") to this: (Command ".-COLOR" "BYLAYER")

    So how far does it get for you again. Do you get the first prompt? Does it allow you to answer it?
    Same for the second prompt?
    Does it start to insert the block?
    R.K. McSwain | CAD Panacea |

  10. #10
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Older Lisp Code Not Working in AutoCAD 2018.....Please Help

    Code:
    (DEFUN c:IDP ( LN xsf ysf Xxsf Yysf  / )
    should be

    Code:
    (DEFUN c:IDP ( / LN xsf ysf Xxsf Yysf   )
    That is what's causing that error as "; error: too few arguments" when you invovke the command.

    I'm guessing it was just :

    Code:
    (Defun IDP  (LN xsf ysf Xxsf Yysf  / )
    before somebody decided to edit the function

    EDIT: I was totally off on my previous post

Page 1 of 2 12 LastLast

Similar Threads

  1. Quadro M1200 for Autocad 2018 and Revit 2018
    By fredrik.schlau in forum Hardware
    Replies: 8
    Last Post: 2018-03-19, 09:09 PM
  2. Replies: 1
    Last Post: 2018-03-16, 08:16 PM
  3. 2018 Autocad Lisp routines (new ones) not loading
    By jhein759286 in forum AutoLISP
    Replies: 8
    Last Post: 2017-11-30, 04:25 AM
  4. Replies: 2
    Last Post: 2017-11-15, 07:08 PM
  5. UCS LISP macros not working in AutoCAD 2007
    By pwilson.112560 in forum AutoLISP
    Replies: 3
    Last Post: 2006-11-30, 12:16 PM

Posting Permissions

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