<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: sending lispfunction list of 3 ints fails, shows null input in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3185192#M58871</link>
    <description>&lt;P&gt;I don't know the answer but maybe this might help. My plan&amp;nbsp;is&amp;nbsp;to pass arguments to .NET is to use one single string argument&amp;nbsp;that contains an unlimited number of arguments delineated by the character |. The single argument will be split into the intended arguments. The scheme intends to provide flexibility in the number actual arguments being passed. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;aks&lt;/P&gt;</description>
    <pubDate>Sun, 09 Oct 2011 20:00:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-10-09T20:00:37Z</dc:date>
    <item>
      <title>sending lispfunction list of 3 ints fails, shows null input</title>
      <link>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3185170#M58870</link>
      <description>&lt;P&gt;I have only tested this on 2009, since I dont have VS 2010 yet to test on 2012.&lt;/P&gt;&lt;P&gt;I was trying to make a function to show the acad color selection dialog, so the incoming argument would be a list of 3 intergers for RGB.&lt;/P&gt;&lt;P&gt;But .net is not taking it.&amp;nbsp; It will take a list of any other integers, but when I send in 3, it shows the resultbuffer as null.&lt;/P&gt;&lt;P&gt;Here is the code to test:&lt;/P&gt;&lt;PRE&gt;[LispFunction("TestRB")]
public static ResultBuffer ShowAcColorDialog(ResultBuffer args) {
  MessageBox.Show("wow");
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;the body is empty, because we are just testing to see what args is during debug.&lt;/P&gt;&lt;P&gt;If you call it with (TestRB (list 1 2)) in acad, the args shows typical items.&lt;/P&gt;&lt;P&gt;If you call it with (TestRB (list 1 2 3)) in acad, the args shows null.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Seems like some kind of bug.&amp;nbsp; I can work around if so but am wondering if its fixed in higher versions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2011 18:41:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3185170#M58870</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2011-10-09T18:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: sending lispfunction list of 3 ints fails, shows null input</title>
      <link>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3185192#M58871</link>
      <description>&lt;P&gt;I don't know the answer but maybe this might help. My plan&amp;nbsp;is&amp;nbsp;to pass arguments to .NET is to use one single string argument&amp;nbsp;that contains an unlimited number of arguments delineated by the character |. The single argument will be split into the intended arguments. The scheme intends to provide flexibility in the number actual arguments being passed. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;aks&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2011 20:00:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3185192#M58871</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-10-09T20:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: sending lispfunction list of 3 ints fails, shows null input</title>
      <link>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3186048#M58872</link>
      <description>&lt;P&gt;yah, what I used to do before I knew about lispfuction attribute (way back) was write args to a text file, then have whatever tool read that file for them.&amp;nbsp; All we are doing is what the internet does and .net makes easy - serialization.&lt;/P&gt;&lt;P&gt;Its very easy to serialize and deserialize an object in .net, but what about lisp?&lt;/P&gt;&lt;P&gt;So&amp;nbsp;I wrote funtions in lisp to take a lisp list, and convert to xml.&amp;nbsp; I had to make sure I had the corresponding object in .net, but did not always want to make one to deserialize into, so I also made functions to take in any incoming list as a resultbuffer and convert to arraylist in .net.&amp;nbsp; Sounds trivial until you get into nested lists.&amp;nbsp; Its not too hard to convert the linear resultbuffer into a nested structure though.&amp;nbsp; I also made the reverse - arraylist to resultbuffer so I can pass lists back and forth between lisp and .net.&lt;/P&gt;&lt;P&gt;Sounds like more effort than just switching to .net completely, I know.&lt;/P&gt;&lt;P&gt;But I have a huge lisp library and about 20 significant progs, beyond the little ones, that I must maintain.&lt;/P&gt;&lt;P&gt;Now that I can pass lists easily though, the conversion will happen much faster.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This list of three integers is throwing me off though.&amp;nbsp; Talk about a wierd bug if so.&lt;/P&gt;&lt;P&gt;Note that another wierd thing is when you send in a list of three reals from lisp,&amp;nbsp;.net treats them as a 3d point.&lt;/P&gt;&lt;P&gt;That tells me there is some conversion mechanism that has funny rules.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2011 15:54:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3186048#M58872</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2011-10-10T15:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: sending lispfunction list of 3 ints fails, shows null input</title>
      <link>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3186056#M58873</link>
      <description>&lt;P&gt;I just noticed same thing happens with list of 4 integers.&lt;/P&gt;&lt;P&gt;This is really whacko.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2011 16:03:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3186056#M58873</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2011-10-10T16:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: sending lispfunction list of 3 ints fails, shows null input</title>
      <link>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3186384#M58875</link>
      <description>&lt;P&gt;I am not a AutoLisp guy but does'nt List(1 2)&amp;nbsp; or List(1 2 3) create a point?&lt;/P&gt;&lt;P&gt;If so I would not expect it to act any different.&lt;/P&gt;&lt;P&gt;Using List(.........) is creating a nested list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The color black is what was entered in command line and blue is what is returned&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Command: (TestRB (list 1 2))&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;Point2d X: 1 Y: 2&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;Returned from function (nil)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Command: (TestRB (list 1 2 3))&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;Point3d X: 1 Y: 2 Z: 3&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;Returned from function&amp;nbsp; (nil)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Command: (TestRB (list 1 2 3 4))&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;***List Begin****&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;1&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;2&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;3&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;4&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;***List End****&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;Returned from function&amp;nbsp; (nil)&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Command: (TestRB 2 3 4)&lt;BR /&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;2&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;Returned from function&amp;nbsp; (nil)&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Command: (TestRB (list 1 2 3 4) 14 2)&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;***List Begin****&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;1&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;2&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;3&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;4&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;***List End****&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;14&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;2&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000ff"&gt;Returned from function&amp;nbsp; (nil) &lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Here is the code that was thrown together quickly just for testing.﻿&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        [LispFunction("TestRB")]
        public ResultBuffer TestRB(ResultBuffer args)
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            TypedValue[] tvs = args.AsArray();           

            for (int i = 0; i &amp;lt; tvs.Length; i++)
            {
                if (tvs[i].TypeCode == (short)LispDataType.ListBegin)
                {
                    ed.WriteMessage("\n***List Begin****");
                    i++;
                    while (tvs[i].TypeCode != (short)LispDataType.ListEnd)
                    {
                        ed.WriteMessage("\n" + tvs[i].Value.ToString());
                        i++;
                    }
                    ed.WriteMessage("\n***List End****");
                }

                else if (tvs[i].TypeCode == (short)LispDataType.Point2d)
                {
                    Point2d pnt = (Point2d)tvs[i].Value;
                    ed.WriteMessage("\nPoint2d X: {0} Y: {1}", pnt.X.ToString(), pnt.Y.ToString());
                }

                else if (tvs[i].TypeCode == (short)LispDataType.Point3d)
                {
                    Point3d pnt = (Point3d)tvs[i].Value;
                    ed.WriteMessage("\nPoint3d X: {0} Y: {1} Z: {2}", pnt.X.ToString(), pnt.Y.ToString(), pnt.Z.ToString());
                }

                else
                {
                    ed.WriteMessage("\n" + tvs[i].Value.ToString());

                }

            }

            ed.WriteMessage("\n\nReturned from function  ");

            return new ResultBuffer(new TypedValue((int)LispDataType.Nil));
        }&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Oct 2011 19:07:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3186384#M58875</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2011-10-10T19:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: sending lispfunction list of 3 ints fails, shows null input</title>
      <link>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3186398#M58876</link>
      <description>&lt;P&gt;Jeff, which acad version and vertical?&amp;nbsp; I am on 2009 Civil 3D.&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2011 19:12:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3186398#M58876</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2011-10-10T19:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: sending lispfunction list of 3 ints fails, shows null input</title>
      <link>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3186428#M58877</link>
      <description>&lt;P&gt;I tested that on 2012 Vanilla and 2011 MEP&amp;nbsp;but looks like that would not help confirm if it is a 2009 issue.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2011 19:28:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3186428#M58877</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2011-10-10T19:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: sending lispfunction list of 3 ints fails, shows null input</title>
      <link>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3186470#M58878</link>
      <description>&lt;P&gt;thx, sounds like it will go away in time.&lt;/P&gt;&lt;P&gt;Note that a list of three integers is nothing special to lisp.&amp;nbsp; For acad to decide they represent a 3d point is not useful when passing data around so no idea why its done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2011 20:08:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sending-lispfunction-list-of-3-ints-fails-shows-null-input/m-p/3186470#M58878</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2011-10-10T20:08:00Z</dc:date>
    </item>
  </channel>
</rss>

