<?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: Modfiy, SaveAs and Rollback in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/modfiy-saveas-and-rollback/m-p/8510265#M45044</link>
    <description>&lt;P&gt;Its definitely not a dumb question... I'm sure rolling back the transaction would have been a lot faster than all the open and close business if there was a way to make that work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did have another thought, but&amp;nbsp; since I have a pretty limited knowledge of C#, I'm not sure there is a way to make this work either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way to make a copy of the document in C#?&amp;nbsp; I'm pretty sure something as simple as this won't work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="typ"&gt;Document&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; doc1 &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; uiDoc&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;Document&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="typ"&gt;Document&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; doc2 &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; uiDoc&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;Document&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That obviously won't work because both doc1 &amp;amp; doc2 are just references to the same document.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if you could do something that is the equivalent of:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Document doc2 = doc1 by value;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might be able to start the transaction on doc2 and save it.&amp;nbsp; Then go back to doc1 and repeat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm just not sure C# can really provide a real copy of a document variable without just creating 2 references to the same object.&amp;nbsp; And you might also be running into the postcommand problem again.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Jan 2019 14:24:25 GMT</pubDate>
    <dc:creator>stever66</dc:creator>
    <dc:date>2019-01-09T14:24:25Z</dc:date>
    <item>
      <title>Modfiy, SaveAs and Rollback</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modfiy-saveas-and-rollback/m-p/8507115#M45040</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;
&lt;P&gt;We are creating an add-that would&amp;nbsp;do the following for a given set of areas:&lt;/P&gt;
&lt;P&gt;1) modifies the document according to the given area&lt;/P&gt;
&lt;P&gt;2) Save the modified document to a new document&lt;/P&gt;
&lt;P&gt;3) Rollback the changes&lt;/P&gt;
&lt;P&gt;Then switch to the next area of the set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried&amp;nbsp;the following ways, all based on the idea of a TransactionGroup that I rollback at the end of step 3. But none of them work:&lt;/P&gt;
&lt;P&gt;Idea 1 : use SaveAs.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pb : SaveAs is not authorized in an open Transaction or TransactionGroup&lt;/P&gt;
&lt;P&gt;Idea 2 : use a PostCommand with SaveAsLibraryGroup&lt;/P&gt;
&lt;P&gt;Pb : the postCommand is executed once the flow is terminated so that I can not Rollback my TransactionGroup.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea / suggestions ?&lt;/P&gt;
&lt;P&gt;This item is similar to this one :&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/modeless-rollback-a-transaction-after-commit/m-p/8127938#M32269" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/modeless-rollback-a-transaction-after-commit/m-p/8127938#M32269&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Benoit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 12:38:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modfiy-saveas-and-rollback/m-p/8507115#M45040</guid>
      <dc:creator>BenoitE&amp;A</dc:creator>
      <dc:date>2019-01-08T12:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Modfiy, SaveAs and Rollback</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modfiy-saveas-and-rollback/m-p/8507557#M45041</link>
      <description>&lt;P&gt;I'm not sure exactly what you are trying to accomplish, but once you have done a "Save-as", I don't think you can go back and undo a transaction on the previous file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe try a different workflow?&amp;nbsp; Like copy the original file (or open and do a Save-As), open the copy, make your changes and save, and then just reopen the original unchanged document and repeat?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm also not sure offhand what you can do without a post command, so I may be way off here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 14:52:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modfiy-saveas-and-rollback/m-p/8507557#M45041</guid>
      <dc:creator>stever66</dc:creator>
      <dc:date>2019-01-08T14:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Modfiy, SaveAs and Rollback</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modfiy-saveas-and-rollback/m-p/8508701#M45042</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Benoit,&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;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;Save the original document A.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Make modifications and save as B.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Open A.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Close B.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Make modifications and save as C.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Open A.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Close C.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Et cetera ad infinitum.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&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;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 21:13:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modfiy-saveas-and-rollback/m-p/8508701#M45042</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-01-08T21:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Modfiy, SaveAs and Rollback</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modfiy-saveas-and-rollback/m-p/8508760#M45043</link>
      <description>&lt;P&gt;Hi Jeremy, hi Stever,&lt;/P&gt;
&lt;P&gt;You are both right, the best way is to change the workflow : save before, than modify.&lt;/P&gt;
&lt;P&gt;Once answered, some questions look dumb...&lt;/P&gt;
&lt;P&gt;The Rollback idea was cool though...&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Benoit&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 21:45:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modfiy-saveas-and-rollback/m-p/8508760#M45043</guid>
      <dc:creator>BenoitE&amp;A</dc:creator>
      <dc:date>2019-01-08T21:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Modfiy, SaveAs and Rollback</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modfiy-saveas-and-rollback/m-p/8510265#M45044</link>
      <description>&lt;P&gt;Its definitely not a dumb question... I'm sure rolling back the transaction would have been a lot faster than all the open and close business if there was a way to make that work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did have another thought, but&amp;nbsp; since I have a pretty limited knowledge of C#, I'm not sure there is a way to make this work either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way to make a copy of the document in C#?&amp;nbsp; I'm pretty sure something as simple as this won't work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="typ"&gt;Document&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; doc1 &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; uiDoc&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;Document&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="typ"&gt;Document&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; doc2 &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; uiDoc&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;Document&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That obviously won't work because both doc1 &amp;amp; doc2 are just references to the same document.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if you could do something that is the equivalent of:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Document doc2 = doc1 by value;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might be able to start the transaction on doc2 and save it.&amp;nbsp; Then go back to doc1 and repeat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm just not sure C# can really provide a real copy of a document variable without just creating 2 references to the same object.&amp;nbsp; And you might also be running into the postcommand problem again.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2019 14:24:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modfiy-saveas-and-rollback/m-p/8510265#M45044</guid>
      <dc:creator>stever66</dc:creator>
      <dc:date>2019-01-09T14:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Modfiy, SaveAs and Rollback</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modfiy-saveas-and-rollback/m-p/8510304#M45045</link>
      <description>&lt;P&gt;Hi Stever,&lt;/P&gt;
&lt;P&gt;Thank you for the idea. Yes you can create a Document which is only a pointer to the same document (Document newDoc = uidoc.Document;). But I am not sure whether you can modify this document without saving it (writing in memory), and saving is not allowed as long as your Transactions are not closed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am back to my original question though. The integral copy of the document then modify it is a real pain for what I want to do (slow, long, and not reliable). So I would really like to do my previous hint :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) modify the document&lt;/P&gt;
&lt;P&gt;2) extract the modified geometry (the only way I found was with the PostCommand SaveAsLibraryGroup)&lt;/P&gt;
&lt;P&gt;3) cancel the modifications&lt;/P&gt;
&lt;P&gt;Would anybody have an idea how to do this ?&lt;/P&gt;
&lt;P&gt;Benoit&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2019 14:35:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modfiy-saveas-and-rollback/m-p/8510304#M45045</guid>
      <dc:creator>BenoitE&amp;A</dc:creator>
      <dc:date>2019-01-09T14:35:53Z</dc:date>
    </item>
  </channel>
</rss>

