<?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: Crash: adding vector3d into ResultBuffer. in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/5792875#M63603</link>
    <description>&lt;P&gt;I know I am very late to the party, but still I came across the same problem and decided to put in my experience as well, also to indicate that the bug (?) persists till today:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;...
Vector3d nv3d= new Vector3d(1.1, 2.2, 3.3);
...
int anint = 112;
TypedValue tv = new TypedValue(anint, nv3d);
ResultBuffer rb = new ResultBuffer(tv);      &amp;lt;- this is where I crash with the errors mentioned in the original post&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried with various values for anint (as you see even with 112) but to no avail,&lt;/P&gt;&lt;P&gt;so now I am (too) going for the Point3d approach&lt;/P&gt;</description>
    <pubDate>Fri, 28 Aug 2015 11:14:52 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-08-28T11:14:52Z</dc:date>
    <item>
      <title>Crash: adding vector3d into ResultBuffer.</title>
      <link>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/2790452#M63597</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to write a vector3d into entity extended data.&lt;/P&gt;&lt;P&gt;a crash is&amp;nbsp;occurred&amp;nbsp;in the following snippet.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Vector3d vec3d = new Vector3d(1,2,3);&lt;/P&gt;&lt;P&gt;aResultBuffer.Add(new TypedValue((int)DxfCode.ExtendedDataXCoordinate , vec3d)); (Crash in this line.)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Crash Message:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;System.NullReferenceException&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN&gt;Object&amp;nbsp;reference&amp;nbsp;not&amp;nbsp;set&amp;nbsp;to&amp;nbsp;an&amp;nbsp;instance&amp;nbsp;of&amp;nbsp;an&amp;nbsp;object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at&amp;nbsp;Autodesk.AutoCAD.DatabaseServices.ResultBuffer.TypedValueToResbuf(TypedValue&amp;nbsp;value)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at&amp;nbsp;Autodesk.AutoCAD.DatabaseServices.ResultBuffer.Add(TypedValue&amp;nbsp;value)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried changing DxfCodes, but no luck.&lt;/P&gt;&lt;P&gt;Could some one tell me where am I going wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj Kumar V.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2010 05:08:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/2790452#M63597</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-10-07T05:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: Crash: adding vector3d into ResultBuffer.</title>
      <link>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/2791316#M63598</link>
      <description>&lt;P&gt;This is a pretty interesting one...&lt;/P&gt;&lt;P&gt;I thought it might be the DxfCode (from all my LSP experience I would have said that an arbitrary length 3D vector should be stored as 1012, which in my old LSP book says "A 3D World Space Displacement in XDATA".&amp;nbsp; The DxfCode enum name is ExtendedDataWorldXDisp.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am storing quite a bit of entity Xdata, but none of it is Vectors, mostly Points and handles.&amp;nbsp; So I copied and tweaked one of my routines to store a vector, and no matter how I tried it it fatal errored AutoCAD.&amp;nbsp; (I didn't even get an exception message, even with a try/catch it never entered the catch)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just for giggles, I tried storing the 3D vector values as a Point3d, using the Vector DxfCode, and it worked fine.&amp;nbsp; I have no idea why this would act this way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just to be thorough, I did make two assumptions about the code you did not post:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; aResultBuffer was declared as new or set to a reference.&amp;nbsp; if not the NullReferenceException would be expected.&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; that you had already added the RegisteredApplicationName to your resbuf prior to the code you posted.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2010 19:30:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/2791316#M63598</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2010-10-07T19:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Crash: adding vector3d into ResultBuffer.</title>
      <link>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/2791638#M63599</link>
      <description>&lt;P&gt;In my post i made a mistake, instead of Extension dictionary i wrote as Extended data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and i am sure ResultBuffer is initialized.&lt;/P&gt;&lt;P&gt;I even tried with 1012, but no luck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so, you think should also try storing Vector3d as Point3d.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2010 04:05:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/2791638#M63599</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-10-08T04:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Crash: adding vector3d into ResultBuffer.</title>
      <link>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/2791750#M63600</link>
      <description>&lt;P&gt;Since the required object for both&amp;nbsp;Xdata and Extension Dictionaries is&amp;nbsp;a ResultBuffer, and since the error is generated (by both my tests and yours) at the addition of the (TypedValue vector..) to the resbuf, I don't think that would make any difference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"so, you think should also try storing Vector3d as Point3d."&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The one thing I can say for sure is that when I tried it, the code succeeded, and I printed the data to the command line with a lisp routine, and the data was correct.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I did not try, was to read the data back out as a Vector3D in .NET.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If that fails, but&amp;nbsp;reading it back out as a point3d works, you can always use point3d.GetAsVector to turn it back into a vector.&amp;nbsp; I'll try that part when I get back to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd love for someone from Autodesk to check this and confirm or deny that it is a bug, or that I am (we are)&amp;nbsp;missing something.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2010 08:53:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/2791750#M63600</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2010-10-08T08:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Crash: adding vector3d into ResultBuffer.</title>
      <link>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/2792506#M63601</link>
      <description>&lt;P&gt;Well, It also fails&amp;nbsp;with an Invalid Cast if you try to set the vector variable equal to the typedvalue.value retrieved from the resbuf, but retrieving it as a point3d worked, and you can set the vector =&amp;nbsp; point3d.GetAsVector, so unless someone else wants to chime in, that's what I would do.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2010 19:41:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/2792506#M63601</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2010-10-08T19:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Crash: adding vector3d into ResultBuffer.</title>
      <link>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/2792870#M63602</link>
      <description>&lt;P&gt;I don't think you can add complex items to xdata,&amp;nbsp; you have to decompose them your self.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add the items one at a time&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;such as&lt;/P&gt;&lt;P&gt;aResultBuffer.Add(new TypedValue((int)DxfCode.ExtendedDataXCoordinate , vec3d.XValue));&lt;/P&gt;&lt;P&gt;aResultBuffer.Add(new TypedValue((int)DxfCode.ExtendedDataYCoordinate , vec3d.YValue));&lt;/P&gt;&lt;P&gt;aResultBuffer.Add(new TypedValue((int)DxfCode.ExtendedDataZCoordinate , vec3d.Zvalue));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That should fix it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HomeBoy Out&lt;/P&gt;</description>
      <pubDate>Sun, 10 Oct 2010 04:36:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/2792870#M63602</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-10-10T04:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Crash: adding vector3d into ResultBuffer.</title>
      <link>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/5792875#M63603</link>
      <description>&lt;P&gt;I know I am very late to the party, but still I came across the same problem and decided to put in my experience as well, also to indicate that the bug (?) persists till today:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;...
Vector3d nv3d= new Vector3d(1.1, 2.2, 3.3);
...
int anint = 112;
TypedValue tv = new TypedValue(anint, nv3d);
ResultBuffer rb = new ResultBuffer(tv);      &amp;lt;- this is where I crash with the errors mentioned in the original post&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried with various values for anint (as you see even with 112) but to no avail,&lt;/P&gt;&lt;P&gt;so now I am (too) going for the Point3d approach&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 11:14:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/5792875#M63603</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-28T11:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Crash: adding vector3d into ResultBuffer.</title>
      <link>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/5792879#M63604</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This code needs to be corrected:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="#333333"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new ResultBuffer&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;...needs an array as parameter, not a single value, so you should use instead&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="#333333"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new ResultBuffer(new TypedValue() { tv })&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH, - alfred -&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 11:26:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/5792879#M63604</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2015-08-28T11:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Crash: adding vector3d into ResultBuffer.</title>
      <link>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/5792910#M63605</link>
      <description>&lt;P&gt;Just tried it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;...&lt;BR /&gt;Vector3d nv3d = new Vector3d(1.1, 2.2, 3.3);&lt;BR /&gt;...&lt;BR /&gt;int anint = 112;
TypedValue tv = new TypedValue(anint, nv3d);
ResultBuffer rb = new ResultBuffer(new TypedValue[] {tv} );&lt;/PRE&gt;&lt;P&gt;(also with anint = 10,11,110)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but still crashing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I 'm sorry but I gave to disagree with you (although I saw that&amp;nbsp;the documentation agrees with you)&lt;/P&gt;&lt;P&gt;because these:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;...
Point3d np3d= new Point3d(1.1, 2.2, 3.3);
...
int anint = 10;
TypedValue tv = new TypedValue(anint, np3d);
ResultBuffer rb = new ResultBuffer(tv);
...&lt;/PRE&gt;&lt;PRE&gt;...
int ni = 25;
...
TypedValue tv = new TypedValue((int)DxfCode.Int32, ni);
ResultBuffer rb = new ResultBuffer(tv);&lt;/PRE&gt;&lt;P&gt;work just fine,&lt;/P&gt;&lt;P&gt;meaning that they are written into an Xrec going onto a line's Extension Dictionary.&lt;/P&gt;&lt;P&gt;checked it through Lisp on command prompt and with snoopdb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 11:56:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/5792910#M63605</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-28T11:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Crash: adding vector3d into ResultBuffer.</title>
      <link>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/5793042#M63606</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, the ResultBuffer type has an overloaded constructor which takes a (params TypedVaue[] values) argument.&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://msdn.microsoft.com/en-us/library/w5zay9db.aspx" target="_blank"&gt;params keyword&lt;/A&gt; means the argument can be either void, one or more TypedValueS separated with commas or a TypedValeS array.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, as far as i know, there's none TypedValue.TypeCode for Vector3d type, neither in the DxfCode enum nor in the LispDataType one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By my side, I always used as work around to use a Point3d instead of a Vector3d&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 13:00:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/5793042#M63606</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2015-08-28T13:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Crash: adding vector3d into ResultBuffer.</title>
      <link>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/5793853#M63607</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you for correction, I should have tried it in VS (and should have looked to the function signature in detail) instead of just writing from remembering.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 20:06:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/5793853#M63607</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2015-08-28T20:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Crash: adding vector3d into ResultBuffer.</title>
      <link>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/5799291#M63608</link>
      <description>&lt;P&gt;Firstly, thank you for your time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as the TypeCode for Vector3d goes, I thought 111 would be appropriate because of these documents:&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-3F0380A5-1C15-464D-BC66-2C5F094BCFB9" target="_blank"&gt;DXF Group Codes in Numerical Order Reference&lt;/A&gt;&amp;nbsp;:&lt;/P&gt;&lt;TABLE border="1" cellspacing="0" cellpadding="4"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P class="p"&gt;111&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="p"&gt;UCS &lt;EM&gt;X&lt;/EM&gt;-axis (appears only if code 72 is set to 1)&lt;/P&gt;&lt;P class="p"&gt;DXF: &lt;EM&gt;X&lt;/EM&gt; value; &lt;STRONG&gt;APP: 3D vector&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and :&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-E50DB779-69AE-43C6-B004-85653A983AC0" target="_blank"&gt;About DXF Formatting Conventions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which, as I understood them, 111 should apply to this context,&lt;/P&gt;&lt;P&gt;(althought that it is true that Vector3d doesn't exist in the mentioned enums)&lt;/P&gt;&lt;P&gt;but it obviously doesn't.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So thank you all for your time, Point3d it is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 08:57:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/crash-adding-vector3d-into-resultbuffer/m-p/5799291#M63608</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-02T08:57:25Z</dc:date>
    </item>
  </channel>
</rss>

