.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

what is logic to how lispfunctions interpret lists passed in?

6 REPLIES 6
Reply
Message 1 of 7
JamesMaeding
368 Views, 6 Replies

what is logic to how lispfunctions interpret lists passed in?

I had thought this was fixed in 2012, but it seems that lists passed in to a lispfunction, get interpreted as if the first items was a dotted pair code.

I first noticed this on a tool that takes three integers as an rgb color.

On some values, it shows null for the args in.

On some, it reinterprets as if I am passing in a point.

If I pass in '(1 2 3), I get (5009, (1,2,3)) in .net so that is a 3d point.

Note that this alone is a bug, as its a list of three integers, not a point.

 

If I pass in '(10 20 30), I get (10, (20, 30, 0)) in .net

If I pass in '(228 27 185), I get null in .net

 

I cannot see how this could be described as good behavior.

If there is going to be any interpretation going on, it should be because I sent in a dotted pair list.

I am convinced this is a bug so please chime in if there is a purpose behind it, and how Autodesk wants us to pass in lists so they come in as just a list of values sent in.

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

6 REPLIES 6
Message 2 of 7


jmaeding wrote:
[...]

If I pass in '(10 20 30), I get (10, (20, 30, 0)) in .net

If I pass in '(228 27 185), I get null in .net

[...]


This is well-known behavior. Such list is interpreted as a DXF-list. If you wrap your list into a list - there is no bug. E.g. instead of  '(10 20 30) you may pass '((10 20 30)) or even '(((10 20 30)))

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 3 of 7

that was my first thought also, but it does not work.

I just tried it now with

'((228 27 185))

and got null.

For other values, it simply wraps the result in whatever level of lists I added.

I couild deal with this if it was predictable, and never converted list to null.

 

Do you get different behavior on my example above if you test?

Not sure if you were commenting based on a test or memory, as I did not believe it would not work until I tested.

thx


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 4 of 7

Provide a simple code which I can be tested.

P.S.: I've encountered this behavior in 1992 with AutoCAD R12. At that time there was not .NET or ObjectARX - only the ADS (the ancestor of ObjectARX).

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 5 of 7

I had a feeling that was the case with ADS, since .net is just an arx wrapper.

Here would be a sample function:

[LispFunction("test")]
public static ResultBuffer TestMe(ResultBuffer args) {
	ResultBuffer retList = new ResultBuffer();
	return retList;
}

 

 set a breakpoint at return statement, and watch or hover over args, you will see the value it interpreted to.

This is in VS 2010 using .net 4 of course.

It sounds like you say the solution is simply to wrap the incoming list with another list. That would be fine if I could get it to work.

 

Thanks for your help so far.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 6 of 7
hgasty1001
in reply to: JamesMaeding

Hi,

 

This is a very old problem in the lisp interpreter, a workarraound is not use integers in the assoc list as dxf codes are all integers, also this happen only with some "magic" numbers in a range i don't recall now, so using ('(228.0 27.0 185.0) should work, but I don't know if that fit as solution in your case.

 

Gaston Nunez

Message 7 of 7
JamesMaeding
in reply to: hgasty1001

oh, never thought of that!

My workaround so far is to serialize inlist to xml, unserialize in .net to arraylist, use, then serialize return arraylist and unserialize in lisp. I posted on this a long time ago but never realized the first num was being handled like a dxf code...

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost