.NET

Reply
Distinguished Contributor
jmaeding
Posts: 954
Registered: ‎12-27-2006
Message 1 of 7 (138 Views)

what is logic to how lispfunctions interpret lists passed in?

138 Views, 6 Replies
06-20-2012 08:03 AM

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.

 

Moderator
Alexander.Rivilis
Posts: 1,398
Registered: ‎04-09-2008
Message 2 of 7 (130 Views)

Re: what is logic to how lispfunctions interpret lists passed in?

06-20-2012 09:30 AM in reply to: jmaeding

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)))


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Distinguished Contributor
jmaeding
Posts: 954
Registered: ‎12-27-2006
Message 3 of 7 (125 Views)

Re: what is logic to how lispfunctions interpret lists passed in?

06-20-2012 09:40 AM in reply to: Alexander.Rivilis

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

Moderator
Alexander.Rivilis
Posts: 1,398
Registered: ‎04-09-2008
Message 4 of 7 (123 Views)

Re: what is logic to how lispfunctions interpret lists passed in?

06-20-2012 09:46 AM in reply to: jmaeding

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).


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Distinguished Contributor
jmaeding
Posts: 954
Registered: ‎12-27-2006
Message 5 of 7 (118 Views)

Re: what is logic to how lispfunctions interpret lists passed in?

06-20-2012 09:52 AM in reply to: Alexander.Rivilis

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.

Valued Mentor
gasty1001
Posts: 448
Registered: ‎04-11-2010
Message 6 of 7 (97 Views)

Re: what is logic to how lispfunctions interpret lists passed in?

06-20-2012 12:48 PM in reply to: jmaeding

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

Distinguished Contributor
jmaeding
Posts: 954
Registered: ‎12-27-2006
Message 7 of 7 (94 Views)

Re: what is logic to how lispfunctions interpret lists passed in?

06-20-2012 12:53 PM in reply to: gasty1001

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...

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community