<?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: Slow performance while creating objects in Revit in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/slow-performance-while-creating-objects-in-revit/m-p/7534236#M54971</link>
    <description>&lt;P&gt;Im not sure if it will be helpful for you, but when i was doing a api for pipes I ended up by doing my own metod for elbow fitting.&lt;BR /&gt;In every case that I had to create a FamilyInstance, I gather data and use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;ICollection&amp;lt;DB.ElementId&amp;gt; NewFamilyInstances2(List&amp;lt;FamilyInstanceCreationData&amp;gt; dataList)&lt;/P&gt;&lt;P&gt;In my case I cut time for one elbow to half what it was, but creating a metod for this might take you a lot of time.&lt;BR /&gt;&lt;BR /&gt;in any case try make as small amount of transaction as you can.&lt;BR /&gt;Try to read about&amp;nbsp; IFailuresPreprocessor, I thing it is possible to &lt;SPAN&gt;&lt;SPAN&gt;cancel&lt;/SPAN&gt;&lt;/SPAN&gt; creation if it take too long, maybe you can find out for what specific case it take so long.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Nov 2017 14:49:33 GMT</pubDate>
    <dc:creator>MarryTookMyCoffe</dc:creator>
    <dc:date>2017-11-10T14:49:33Z</dc:date>
    <item>
      <title>Slow performance while creating objects in Revit</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/slow-performance-while-creating-objects-in-revit/m-p/7525357#M54969</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Revit 2017&lt;/P&gt;&lt;P&gt;API&lt;/P&gt;&lt;P&gt;C# AddIn&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am adding about 15 objects (Duct and Elbow) and it takes ~1 minute. This is slow performance. In the actual project, it would be about 60 to 100 objects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the following:&lt;/P&gt;&lt;P&gt;1. read quite a bit online regarding TransactionGroup, Transaction and SubTransanctions.&lt;/P&gt;&lt;P&gt;2. Used&amp;nbsp; [Transaction(TransactionMode.Manual)]&amp;nbsp; [Regeneration(RegenerationOption.Manual)]&lt;/P&gt;&lt;P&gt;3. Searched for not recording the UNDO buffer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any other suggestions to improve the speed of creating objects?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;-Thilak Rao&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 21:35:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/slow-performance-while-creating-objects-in-revit/m-p/7525357#M54969</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-07T21:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Slow performance while creating objects in Revit</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/slow-performance-while-creating-objects-in-revit/m-p/7526094#M54970</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Thilak Rao,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your query.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Congratulations on reading up on the topic and doing some research.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have heard about unacceptable performance when programmatically adding hundreds or thousands of ducts.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However, there should be no problem adding a couple of dozen objects.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;First, to address the individual points you list:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN&gt; TransactionGroup, Transaction and SubTransanctions: this is probably the way to go. I'll explain more below.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2a. RegenerationOption.Manual: this is obsolete, since there is no other regeneration option, cf. (search for RegenerationAttribute):&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2013/02/whats-new-in-the-revit-2011-api.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2013/02/whats-new-in-the-revit-2011-api.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;"RegenerationOption.Automatic is obsolete and will be removed in a future release."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2b. TransactionMode.Manual: yes, this is the right choice. In this case, you cannot use ReadOnly, of course. Automatic transaction mode is deprecated and gives you no control at all.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL start="3"&gt;
&lt;LI&gt;&lt;SPAN&gt; Not recording the UNDO buffer: not possible, afaik.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As said, there should be no performance problem at all creating a couple of dozen HVAC elements.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Obviously, if Revit triggers a complete regeneration of the model after each single element addition and recalculates all HVAC systems each time, you will have a problem.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Therefore, I suggest that you prevent that by adding all of the elements in one single transaction, if possible, or grouping all the transaction into one single transaction group and only committing that once, at the end, after all additions have been completed.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hopefully, each element can be added independently, without relying on the changes made to the model by the addition of the other elements.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In summary, the performance may depend on the exact nesting of your transactions, sub-transactions and transaction groups.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If all else fails, try to add all of the elements in one single transaction.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;KISS -- &lt;A href="https://en.wikipedia.org/wiki/KISS_principle" target="_blank"&gt;https://en.wikipedia.org/wiki/KISS_principle&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this helps.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 07:01:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/slow-performance-while-creating-objects-in-revit/m-p/7526094#M54970</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-11-08T07:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Slow performance while creating objects in Revit</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/slow-performance-while-creating-objects-in-revit/m-p/7534236#M54971</link>
      <description>&lt;P&gt;Im not sure if it will be helpful for you, but when i was doing a api for pipes I ended up by doing my own metod for elbow fitting.&lt;BR /&gt;In every case that I had to create a FamilyInstance, I gather data and use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;ICollection&amp;lt;DB.ElementId&amp;gt; NewFamilyInstances2(List&amp;lt;FamilyInstanceCreationData&amp;gt; dataList)&lt;/P&gt;&lt;P&gt;In my case I cut time for one elbow to half what it was, but creating a metod for this might take you a lot of time.&lt;BR /&gt;&lt;BR /&gt;in any case try make as small amount of transaction as you can.&lt;BR /&gt;Try to read about&amp;nbsp; IFailuresPreprocessor, I thing it is possible to &lt;SPAN&gt;&lt;SPAN&gt;cancel&lt;/SPAN&gt;&lt;/SPAN&gt; creation if it take too long, maybe you can find out for what specific case it take so long.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 14:49:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/slow-performance-while-creating-objects-in-revit/m-p/7534236#M54971</guid>
      <dc:creator>MarryTookMyCoffe</dc:creator>
      <dc:date>2017-11-10T14:49:33Z</dc:date>
    </item>
  </channel>
</rss>

