So let’s break down how AutoCAD ObjectARX interprets atoms and lists. ObjectARX sees lisp types as a resbuf, essentially a container that has a type code and a value. I.e. (5000 . “Gile”) where the type code describes the type of the value. In C#, the basic type for getting and returning values to lisp is called a TypedValue, it’s essentially the same as ObjectARX’s resbuf as it contains a type code and an Object.
So a real number would look like
(LispDataType.Double . 3.33333)
And a String
(LispDataType.Text . “Gile”)
Keep in mind that C# knows nothing of parenthesis or the dot in the dotted pair.
When returning custom lists to lisp, you must explicitly construct them
I.e
(LispDataType.ListBegin . null)
(LispDataType.Double . 3.33333)
(LispDataType.DottedPair . null)
(LispDataType.Text . “Gile”)
(LispDataType.ListEnd , null)
Would return (3.3333 . “Gile”) to lisp
A ResultBuffer in C# is a container for TypedValue types. Its unmanaged type is a resbuf or resbuf chain
an example
[LispFunction("Lisp1")]
public static Object Lisp1(ResultBuffer resBuf)
{
//++-- A new buffer to return
ResultBuffer buf = new ResultBuffer();
//make a list
buf.Add(new TypedValue((int)LispDataType.ListBegin));
buf.Add(new TypedValue((int)LispDataType.Double , 3.3333));
buf.Add(new TypedValue((int)LispDataType.DottedPair));
buf.Add(new TypedValue((int)LispDataType.Text, "Gile"));
buf.Add(new TypedValue((int)LispDataType.ListEnd));
return buf;
}
Sorry, I haven’t had my coffee yet, so I’m probably not doing this well