<?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: .Net API and Multi-Thread in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/net-api-and-multi-thread/m-p/3144238#M59510</link>
    <description>&lt;P&gt;Many thanks guys,&lt;/P&gt;&lt;P&gt;I used the DoEvents method and its working fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why dose it make faster if the application run the code inside autocad rather than windows-form app?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thnx&lt;/P&gt;</description>
    <pubDate>Thu, 01 Sep 2011 16:06:41 GMT</pubDate>
    <dc:creator>JASONBIRD</dc:creator>
    <dc:date>2011-09-01T16:06:41Z</dc:date>
    <item>
      <title>.Net API and Multi-Thread</title>
      <link>https://forums.autodesk.com/t5/net-forum/net-api-and-multi-thread/m-p/3141170#M59507</link>
      <description>&lt;P&gt;I am developing a .Net (windows form) application which will be called by a command from autocad.&lt;BR /&gt;The task is looking through all entities in the model and select specific polygons. This is sort of a heavy task, so I am having the UI freezed for minutes which is not suitable. Thus I tried run the task in seperate thread: starting a transaction, getting objects and check some of their properties.&lt;BR /&gt;Now, it works fine with one transaction , but if I use more than one transaction the app fails randomly. The stack shows error on this call:&lt;BR /&gt;&lt;BR /&gt;".. Autodesk.AutoCAD.Runtime.Interop.CheckNull(IntPtr returnValue)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; at Autodesk.AutoCAD.ApplicationServices.TransactionManager.StartTransaction()"&lt;BR /&gt;&lt;BR /&gt;or when Autocad tries to Dispose the transaction object. ( I'm using USING block for strating transaction, therefore not calling Dispose method in the code.)&lt;BR /&gt;&lt;BR /&gt;but these error never happenes in single-thread mode.&lt;BR /&gt;&lt;BR /&gt;Can you please help&amp;nbsp; me to understand the reason and find a solution ?&lt;BR /&gt;Or what else can one do to make UI responsive when a time-consuming task is running?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;ali&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2011 16:37:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/net-api-and-multi-thread/m-p/3141170#M59507</guid>
      <dc:creator>JASONBIRD</dc:creator>
      <dc:date>2011-08-30T16:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: .Net API and Multi-Thread</title>
      <link>https://forums.autodesk.com/t5/net-forum/net-api-and-multi-thread/m-p/3141350#M59508</link>
      <description>&lt;P&gt;Calls into the AutoCAD .NET API from a separate thread are not safe, as you have discovered.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as the UI, check out these posts on Through The Interface:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://through-the-interface.typepad.com/through_the_interface/2007/02/allowing_users_.html"&gt;http://through-the-interface.typepad.com/through_the_interface/2007/02/allowing_users_.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://through-the-interface.typepad.com/through_the_interface/2007/05/displaying_a_pr.html"&gt;http://through-the-interface.typepad.com/through_the_interface/2007/05/displaying_a_pr.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://through-the-interface.typepad.com/through_the_interface/2007/08/a-handy-net-cla.html"&gt;http://through-the-interface.typepad.com/through_the_interface/2007/08/a-handy-net-cla.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that the third link is pretty much a combination of the first two, but it has been a while since I read them, so I gave all three, just in case there were differences in the approach.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2011 18:23:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/net-api-and-multi-thread/m-p/3141350#M59508</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2011-08-30T18:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: .Net API and Multi-Thread</title>
      <link>https://forums.autodesk.com/t5/net-forum/net-api-and-multi-thread/m-p/3141408#M59509</link>
      <description>&lt;P&gt;Are you running the calculations as you iterate through the objects?&amp;nbsp; If so, consider harvesting the data from the objects in the drawing in a very lightweight loop (minimal filtering) and&amp;nbsp;then passing the raw&amp;nbsp;data into your calculations.&amp;nbsp; You may be able to successfully spin off those calculations into&amp;nbsp;multiple threads since they would not be&amp;nbsp;dependant on AutoCAD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oh, hang on - just re-read your post.&amp;nbsp; Calling a separate UI-based application outside of AutoCAD will cause all sorts of slowness.&amp;nbsp; If at all possible, keep everything in-house&amp;nbsp;to maximize speed.&amp;nbsp; Trying to run drawing-dependant calculations outside of AutoCAD while the user can diddle inside the drawing&amp;nbsp;can be *very* problematic as well.&amp;nbsp; Very few professionally developed applications do this, and for good reason.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2011 18:56:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/net-api-and-multi-thread/m-p/3141408#M59509</guid>
      <dc:creator>dgorsman</dc:creator>
      <dc:date>2011-08-30T18:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: .Net API and Multi-Thread</title>
      <link>https://forums.autodesk.com/t5/net-forum/net-api-and-multi-thread/m-p/3144238#M59510</link>
      <description>&lt;P&gt;Many thanks guys,&lt;/P&gt;&lt;P&gt;I used the DoEvents method and its working fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why dose it make faster if the application run the code inside autocad rather than windows-form app?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thnx&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2011 16:06:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/net-api-and-multi-thread/m-p/3144238#M59510</guid>
      <dc:creator>JASONBIRD</dc:creator>
      <dc:date>2011-09-01T16:06:41Z</dc:date>
    </item>
  </channel>
</rss>

