Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

bad argument type: numberp: nil

7 REPLIES 7
Reply
Message 1 of 8
claycarr
22623 Views, 7 Replies

bad argument type: numberp: nil

using visual lisp editor can i find my error that is causing this message from autocad: bad argument type: numberp: nil?
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: claycarr

Hi,

You don't need the editor, this is kind of error is kind of basic. It means
that you are passing an argument that contains nothing, which is void,
(thus nil) to some function that expects a number as argument. So check your
variables and try to see which one is empty and why...

Constantin



a écrit dans le message de news:
5407425@discussion.autodesk.com...
using visual lisp editor can i find my error that is causing this message
from autocad: bad argument type: numberp: nil?
Message 3 of 8
Anonymous
in reply to: claycarr

I believe the same can happen if the value it is supplying is not necessarily nil, but not a number (for example, a text string, or a list). I think the "numberp: nil" message means that the numberp 'test' of the variable value is returning nil rather than True, which would be the case whether the value is itself nil or is just some non-numerical value. If I'm right, the variable at fault might not be empty.
--
Kent Cooper
Message 4 of 8
claycarr
in reply to: claycarr

but can i load in visual lisp editor and find it if the program is long?
Message 5 of 8
Anonymous
in reply to: claycarr

Hi Kent,

Here are two simple tests showing that the error message is about the value
itself and not about the data type:

Command: (/ 2 "text_string")
; error: bad argument type: numberp: "text_string"

Command: (/ 2 (list 1 2 3))
; error: bad argument type: numberp: (1 2 3)

Regards,

Constantin



a écrit dans le message de news:
5407607@discussion.autodesk.com...
I believe the same can happen if the value it is supplying is not
necessarily nil, but not a number (for example, a text string, or a list).
I think the "numberp: nil" message means that the numberp 'test' of the
variable value is returning nil rather than True, which would be the case
whether the value is itself nil or is just some non-numerical value. If I'm
right, the variable at fault might not be empty.
--
Kent Cooper
Message 6 of 8
Anonymous
in reply to: claycarr

From the thread "stringp nil error" at the next link:

http://discussion.autodesk.com/thread.jspa?messageID=5404144

"Re: stringp nil error
The VLIDE can really help you here.

Open your code in the editor, and load it from within the editor. Then go to
the Debug menu, and make sure the Break On Error option is selected. Now
execute your code, either from AutoCAD's command prompt, or the Visual LISP
Console window.

When the error occurs, the VLIDE should pop up. And you can use the button
that looks like a red dot with parens around it and an arrow pointing into
it (Last break). This will highlight the statement where the error occurs.
You will find on of your variables is set to nil, instead of some value (a
string) your code expects.

While in break mode you can use Inspect to see what variables or even
statements evaluate to. To take the debugging a step further, set a break
point (F9) somewhere above the problem statement and execute the function
again. When the code reaches the break point, the VLIDE will become active
and you can step thru each statement using F8. Inspect what is happening
with your code.

That ought to help you find the source of the issue.

--
R. Robert Bell"


HTH,

Constantin



a écrit dans le message de news:
5407425@discussion.autodesk.com...
using visual lisp editor can i find my error that is causing this message
from autocad: bad argument type: numberp: nil?
Message 7 of 8
Anonymous
in reply to: claycarr

This might help:

Vlide Editor > Debug > Break On Error

Load/run the code

Vlide Editor > Debug > Last Break Source


--
Autodesk Discussion Group Facilitator


wrote in message news:5407610@discussion.autodesk.com...
but can i load in visual lisp editor and find it if the program is long?
Message 8 of 8
Gary_Braun
in reply to: Anonymous

Nearly ten-years late to the game, but I found this helpful. Thanks.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost