<?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: Sub-transactions among multiple documents in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/sub-transactions-among-multiple-documents/m-p/8566597#M44509</link>
    <description>&lt;P&gt;Good question!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The TransactionGroup constructor takes the document as an argument:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://apidocs.co/apps/revit/2019/74cff3fa-9380-2c30-9fa9-b0e839a2c8e4.htm" target="_blank"&gt;https://apidocs.co/apps/revit/2019/74cff3fa-9380-2c30-9fa9-b0e839a2c8e4.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All sub-transactions it contains can process only that specific document.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could start a new transaction group for each document you process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I do not see how you could implement what you are doing using less transaction groups than the number of documents processed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Feb 2019 13:54:53 GMT</pubDate>
    <dc:creator>jeremytammik</dc:creator>
    <dc:date>2019-02-01T13:54:53Z</dc:date>
    <item>
      <title>Sub-transactions among multiple documents</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/sub-transactions-among-multiple-documents/m-p/8566568#M44508</link>
      <description>&lt;P&gt;My question is about sub transactions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have designed an add-in that does something like the following:&lt;/P&gt;
&lt;P&gt;-&lt;STRONG&gt;start transaction in doc&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;-make some changes&lt;/P&gt;
&lt;P&gt;-scan the doc for placed family instances&lt;/P&gt;
&lt;P&gt;-for each found family instance:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; -go inside that family&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; -&lt;STRONG&gt;start transaction inside family&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;-make some changes&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; -scan the inside of the family for nested family instances&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; -for each found nested family&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -go inside that nested family&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&lt;STRONG&gt;start transaction inside nested family&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -make some changes&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&lt;STRONG&gt;commit transaction&amp;nbsp;inside nested family&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -load nested family back into family&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; -&lt;STRONG&gt;commit transaction&amp;nbsp;inside family&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; -load family back into document&lt;/P&gt;
&lt;P&gt;-&lt;STRONG&gt;commit transaction in doc&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The way I have it now, is that all those transactions are separate transactions. So after the command is run, a whole bunch of commands appear under the undo-command button.&amp;nbsp; However I&lt;STRONG&gt; would like to be able to undo this command with 1 press of the undo button&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was thinking to use sub-transactions for this. But I was wondering if sub-transactions always have to be inside the same doc, or can it be among multiple docs, like in my example?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Furthermore I am struggling to find a good piece of example-code on sub-transactions. I found &lt;A href="https://spiderinnet.typepad.com/blog/2012/05/revit-net-transaction-transaction-and-subtransaction.html" target="_blank" rel="noopener"&gt;this&lt;/A&gt;, but I am not sure if I can use it, considering that the example executes on the same doc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So my question is: How would the syntax about the main-transaction and sub-transactions be, based on the above example?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Feb 2019 13:44:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/sub-transactions-among-multiple-documents/m-p/8566568#M44508</guid>
      <dc:creator>jnoordzij</dc:creator>
      <dc:date>2019-02-01T13:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-transactions among multiple documents</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/sub-transactions-among-multiple-documents/m-p/8566597#M44509</link>
      <description>&lt;P&gt;Good question!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The TransactionGroup constructor takes the document as an argument:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://apidocs.co/apps/revit/2019/74cff3fa-9380-2c30-9fa9-b0e839a2c8e4.htm" target="_blank"&gt;https://apidocs.co/apps/revit/2019/74cff3fa-9380-2c30-9fa9-b0e839a2c8e4.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All sub-transactions it contains can process only that specific document.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could start a new transaction group for each document you process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I do not see how you could implement what you are doing using less transaction groups than the number of documents processed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Feb 2019 13:54:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/sub-transactions-among-multiple-documents/m-p/8566597#M44509</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-02-01T13:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-transactions among multiple documents</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/sub-transactions-among-multiple-documents/m-p/8566707#M44510</link>
      <description>&lt;P&gt;Thanks, Jeremy.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Feb 2019 14:27:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/sub-transactions-among-multiple-documents/m-p/8566707#M44510</guid>
      <dc:creator>jnoordzij</dc:creator>
      <dc:date>2019-02-01T14:27:45Z</dc:date>
    </item>
  </channel>
</rss>

