<?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: How to make set parameter transaction run faster? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-make-set-parameter-transaction-run-faster/m-p/5979900#M68475</link>
    <description>&lt;P&gt;Hi,&lt;SPAN&gt;Remy van den Bor&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for your reply.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Yeah, I moved the t.start and commit out of the loop and it work much faster.&lt;/P&gt;&lt;P&gt;It still run slower than the manual&amp;nbsp;setting,but is good enough&amp;nbsp;for me.&lt;/P&gt;&lt;P&gt;I compare the run time between&amp;nbsp;&lt;SPAN&gt;manual&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;setting and using Macro. It look like the bigger the model is the smaller&amp;nbsp;differences&amp;nbsp;is.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;500 beams macro is about 86% slower&amp;nbsp;&lt;/P&gt;&lt;P&gt;2000 beams&amp;nbsp;&lt;SPAN&gt;macro is about 37% slower&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;4000 beams&amp;nbsp;&lt;SPAN&gt;macro is about 19% slower&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jan 2016 16:41:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-01-08T16:41:13Z</dc:date>
    <item>
      <title>How to make set parameter transaction run faster?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-make-set-parameter-transaction-run-faster/m-p/5976690#M68473</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I’m using parameter.set to set the material of collected elements.&lt;/P&gt;&lt;P&gt;But the processes seems kinds slow compare to set the value from the Revit properties panel manually.&lt;/P&gt;&lt;P&gt;especially for larger amount of elements(like more than 100 columns)&lt;SPAN&gt;the processing takes a long time.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Is there anyways to make the code run faster? Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my current code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using (Transaction t = new Transaction(doc, "Set Parameter"))
			{
				foreach(Element e in elementSet)
				{
					Parameter matPara = e.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM);
					t.Start();
					matPara.Set(new ElementId(newMatId));
					t.Commit();
				}
				
			}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2016 23:08:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-make-set-parameter-transaction-run-faster/m-p/5976690#M68473</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-06T23:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to make set parameter transaction run faster?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-make-set-parameter-transaction-run-faster/m-p/5977020#M68474</link>
      <description>&lt;PRE&gt;I would move the t.start and commit utside the foreach loop, this might speed up things a bit.&lt;BR /&gt;And maybe a little check, because you might find elements that don't have this builtin parameter.&lt;BR /&gt;&lt;BR /&gt;using (Transaction t = new Transaction(doc, "Set Parameter"))
			{&lt;BR /&gt;                                t.Start();
				foreach(Element e in elementSet)
				{
					Parameter matPara = e.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM); 
					if(matPara == null) continue;&lt;BR /&gt;                                        matPara.Set(new ElementId(newMatId));
				}&lt;BR /&gt;                                t.Commit();
			}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2016 06:37:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-make-set-parameter-transaction-run-faster/m-p/5977020#M68474</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-07T06:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to make set parameter transaction run faster?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-make-set-parameter-transaction-run-faster/m-p/5979900#M68475</link>
      <description>&lt;P&gt;Hi,&lt;SPAN&gt;Remy van den Bor&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for your reply.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Yeah, I moved the t.start and commit out of the loop and it work much faster.&lt;/P&gt;&lt;P&gt;It still run slower than the manual&amp;nbsp;setting,but is good enough&amp;nbsp;for me.&lt;/P&gt;&lt;P&gt;I compare the run time between&amp;nbsp;&lt;SPAN&gt;manual&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;setting and using Macro. It look like the bigger the model is the smaller&amp;nbsp;differences&amp;nbsp;is.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;500 beams macro is about 86% slower&amp;nbsp;&lt;/P&gt;&lt;P&gt;2000 beams&amp;nbsp;&lt;SPAN&gt;macro is about 37% slower&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;4000 beams&amp;nbsp;&lt;SPAN&gt;macro is about 19% slower&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 16:41:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-make-set-parameter-transaction-run-faster/m-p/5979900#M68475</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-08T16:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to make set parameter transaction run faster?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-make-set-parameter-transaction-run-faster/m-p/5980275#M68476</link>
      <description>&lt;P&gt;The slowdown is understandable&amp;nbsp;and expected.&amp;nbsp;Making changes in Revit via the API can almost never be as fast as making the same changes via the API, for there is always some&amp;nbsp;overhead introduced by managed layer around Revit native core. Managed wrappers around native elements must be instantiated, then later disposed&amp;nbsp;or garbage collected. There is also always some&amp;nbsp;delay from just crossing the native/managed barrier&amp;nbsp;as well as from converting methods' arguments&amp;nbsp;back and forth.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 19:57:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-make-set-parameter-transaction-run-faster/m-p/5980275#M68476</guid>
      <dc:creator>arnostlobel</dc:creator>
      <dc:date>2016-01-08T19:57:26Z</dc:date>
    </item>
  </channel>
</rss>

