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

What fixnump ?

9 REPLIES 9
Reply
Message 1 of 10
Anonymous
5372 Views, 9 Replies

What fixnump ?

I want to know what is the "fixnump" or fix number ....p ???...-->
parameter?

_$
; error: bad argument type: fixnump: nil
_$
9 REPLIES 9
Message 2 of 10
Anonymous
in reply to: Anonymous

Adesu wrote:
> I want to know what is the "fixnump" or fix number ....p ???...-->
> parameter?
>
> _$
> ; error: bad argument type: fixnump: nil
> _$


That error message means actually that you have called the function
fixnump with one argument, which has as its value nil, and the function
didn't accept it.

Typical in Lisp culture is to name functions returning a truth value
with a "p" as the last letter (for "predicate"), so "fixnump" is a
function that checks whether something is a fixnum, in other words an
integer.

Fixnump is not a user-accessible function in VisualLisp, but evidently
in the internals of the VisualLisp system it exists.

So, somewhere in your program you are having nil in a place where there
should be an integer.

--
Message 3 of 10
Anonymous
in reply to: Anonymous

Hi Martti,thanks a lot for your info,i like that.

"Martti Halminen" wrote in message
news:4984631@discussion.autodesk.com...
Adesu wrote:
> I want to know what is the "fixnump" or fix number ....p ???...-->
> parameter?
>
> _$
> ; error: bad argument type: fixnump: nil
> _$


That error message means actually that you have called the function
fixnump with one argument, which has as its value nil, and the function
didn't accept it.

Typical in Lisp culture is to name functions returning a truth value
with a "p" as the last letter (for "predicate"), so "fixnump" is a
function that checks whether something is a fixnum, in other words an
integer.

Fixnump is not a user-accessible function in VisualLisp, but evidently
in the internals of the VisualLisp system it exists.

So, somewhere in your program you are having nil in a place where there
should be an integer.

--
Message 4 of 10
Anonymous
in reply to: Anonymous

I am currently having a similar issue. This is a similar message to "bad argument type stringp" that I came across earlier with one of my programs. This is an error that pops up when the incorrect data type is being used. With the string case, I was able to use the atoi function to convert the data to an integer (required for my if statement). I am currently looking for a solution to the fixnump conversion. 

 

Below is a chunk of code I used. This tests the data type (in case of future ACAD change) and converts if necessary.

 

(setq FMTdwgNum (c:wd_is_cur_dwg_in_proj))
(setq FMTdwgNumTy (type FMTdwgNum))
(if (= FMTdwgNumTy string)
  (progn
    (setq FMTdwgNumstr FMTdwgNum)
    (setq FMTdwgNum (atoi FMTdwgNumstr))
  )
  (progn
    (setq FMTdwgNumstr (itoa FMTdwgNum))
) )

Message 5 of 10
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

....
(if (= FMTdwgNumTy string)
....


That should be:

 

(if (= FMTdwgNumTy 'STR)

 

with apostrophe prefix, and only the first three letters [not case-sensitive].

 

But I confess to being curious as to why you don't know what type of result you're going to get from (c:wd_is_cur_dwg_in_proj), so that you don't have to test for it.  Is that written in such a way that it can sometimes return a string and sometimes an integer?

Kent Cooper, AIA
Message 6 of 10
Anonymous
in reply to: Kent1Cooper

I can try to test this with the 'str instead of string, but the program works fine while testing against string. I did switch to a test on this after finding different data type on this one of the test runs I was doing (I honestly don't know if it was a glitch or possibly something in my program that caused the issue, so made a basic test function to ensure no future issues). 

Message 7 of 10
Anonymous
in reply to: Anonymous

 

*Adesu

 

I was able to find that the data type on my program was showing up with this error was LIST. I found this by adding a line with the "type" function after creating the variable, and then entering !VARIABLENAME in the command line. this is my work around for this data error. if this code bit doesn't help, feel free to post a copy of your code and we might be able to help a bit more.

 

 


(setq FMTpdNumstr1 (vl-prin1-to-string FMTpdNumlst))
(setq FMTpdNumlen (- (strlen FMTpdNumstr1) 2))
(setq FMTpdNumstr (substr FMTpdNumstr1 2 FMTpdNumlen))
(setq FMTpdNum (atoi FMTpdNumstr))

Message 8 of 10
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

.... the program works fine while testing against string. .... 


If it has worked fine, I assume that (c:....) command must be returning an integer, because [using 12 arbitrarily here]:

 

(= (type 12) string)
nil
(= (type 12) 'str)
nil
(= (type "12") string)
nil
(= (type "12") 'str)
T

 

The first one is probably equivalent to what you were getting, even without the correct Type designation, and since that just returns nil, it went ahead with the 'else' expression and made a string from the integer, just as it would with the correct Type designation [the second one].

 

If it were working with a string returned by (c:....) [the 3rd and 4th ones], you should have gotten the equivalent of the third one, in which case it would also have tried to make a string out of an integer, but you should have gotten an error about the string "12" not being an integer.

Kent Cooper, AIA
Message 9 of 10
Anonymous
in reply to: Kent1Cooper

thanks for the tip! I wouldn't want this to crash while in operation. 

Message 10 of 10
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

 

@Anonymous

... if this code bit doesn't help, feel free to post a copy of your code and we might be able to help a bit more.

....


[Watch dates -- this is a 12-year-old thread, and I don't recall seeing Adesu participating lately.]

Kent Cooper, AIA

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

Post to forums  

Forma Design Contest


Autodesk Design & Make Report