<?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: Transaction Problem, Linked Document. in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/transaction-problem-linked-document/m-p/5806129#M70607</link>
    <description>&lt;P&gt;May be my short example helps You&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;"Creating a space in first linked file" &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ElementClassFilter&lt;/SPAN&gt;&lt;SPAN&gt; filter = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;ElementClassFilter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;typeof&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;RevitLinkInstance&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FilteredElementCollector&lt;/SPAN&gt;&lt;SPAN&gt; collector = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;FilteredElementCollector&lt;/SPAN&gt;&lt;SPAN&gt;(doc);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ICollection&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;Element&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt; allLinks = collector.WherePasses(filter).ToElements();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;doc_link=(allLinks.First&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;Element&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;() &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;RevitLinkInstance&lt;/SPAN&gt;&lt;SPAN&gt;).GetLinkDocument();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Space&lt;/SPAN&gt;&lt;SPAN&gt; sp = doc_link.Create.NewSpace(&lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Phase&lt;/SPAN&gt;&lt;SPAN&gt;());&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Sep 2015 13:37:29 GMT</pubDate>
    <dc:creator>OR_AND_NO</dc:creator>
    <dc:date>2015-09-07T13:37:29Z</dc:date>
    <item>
      <title>Transaction Problem, Linked Document.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/transaction-problem-linked-document/m-p/5805945#M70606</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is written to create a space inside a linked element. This is an error I get when using the&amp;nbsp;&lt;STRONG&gt;NewSpace()&amp;nbsp;&lt;/STRONG&gt;method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/187483i0E89CFC32FDF5CD5/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;&lt;P&gt;I call the method inside a Transaction in the main document and It does nothing to the error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt; UIApplication uiapp = commandData.Application;&lt;BR /&gt; UIDocument uidoc = uiapp.ActiveUIDocument;&lt;BR /&gt; Application app = uiapp.Application;&lt;BR /&gt; Document &lt;STRONG&gt;doc&lt;/STRONG&gt; = uidoc.Document;&lt;BR /&gt;&lt;BR /&gt; foreach (Document &lt;STRONG&gt;d&lt;/STRONG&gt; in app.Documents)&lt;BR /&gt; {&lt;BR /&gt;     using (Transaction t = new Transaction&lt;U&gt;(&lt;STRONG&gt;doc&lt;/STRONG&gt;,&lt;/U&gt; "New Space"))
     {
         t.Start();
         Autodesk.Revit.Creation.Document &lt;STRONG&gt;docu&lt;/STRONG&gt; = &lt;STRONG&gt;&lt;U&gt;d&lt;/U&gt;.Create&lt;/STRONG&gt;;
         Space sp = &lt;STRONG&gt;docu&lt;/STRONG&gt;.NewSpace(... ,...);&lt;BR /&gt;         t.Commit();&lt;BR /&gt;     }                                    
 }&lt;/PRE&gt;&lt;P&gt;Could this error be due to that I am calling &lt;STRONG&gt;NewSpace()&amp;nbsp;&lt;/STRONG&gt;in the Linked element but the Transaction is in the primary document?.&lt;/P&gt;&lt;P&gt;Revit does not seem to allow me use transactions in anything but the primary document.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone has any suggestions of how I might be able to edit the linked element successful I would be very appreciative.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, Jack&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2015 10:05:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/transaction-problem-linked-document/m-p/5805945#M70606</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-07T10:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction Problem, Linked Document.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/transaction-problem-linked-document/m-p/5806129#M70607</link>
      <description>&lt;P&gt;May be my short example helps You&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;"Creating a space in first linked file" &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ElementClassFilter&lt;/SPAN&gt;&lt;SPAN&gt; filter = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;ElementClassFilter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;typeof&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;RevitLinkInstance&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FilteredElementCollector&lt;/SPAN&gt;&lt;SPAN&gt; collector = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;FilteredElementCollector&lt;/SPAN&gt;&lt;SPAN&gt;(doc);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ICollection&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;Element&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt; allLinks = collector.WherePasses(filter).ToElements();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;doc_link=(allLinks.First&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;Element&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;() &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;RevitLinkInstance&lt;/SPAN&gt;&lt;SPAN&gt;).GetLinkDocument();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Space&lt;/SPAN&gt;&lt;SPAN&gt; sp = doc_link.Create.NewSpace(&lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Phase&lt;/SPAN&gt;&lt;SPAN&gt;());&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2015 13:37:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/transaction-problem-linked-document/m-p/5806129#M70607</guid>
      <dc:creator>OR_AND_NO</dc:creator>
      <dc:date>2015-09-07T13:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction Problem, Linked Document.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/transaction-problem-linked-document/m-p/5806778#M70608</link>
      <description>&lt;P&gt;Dear Jack,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, absolutely, a transaction is totally tied to a document.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have two separate documents to modify, you need two separate transactions for them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your subtransaction is in a different document B, it cannot be nested into a transaction tied to document A.&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;</description>
      <pubDate>Tue, 08 Sep 2015 06:34:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/transaction-problem-linked-document/m-p/5806778#M70608</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2015-09-08T06:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction Problem, Linked Document.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/transaction-problem-linked-document/m-p/5807872#M70609</link>
      <description>&lt;P&gt;It is correct&amp;nbsp;what Jeremy stated: that to modify a document one needs to open a transaction in that document.&lt;/P&gt;
&lt;P&gt;However, what is even more applicable in this particular case is the fact that linked documents are not modifiable - they cannot have transactions. In order to modify a linked document, one would&amp;nbsp;have to close the link, open the document as a separate main document, make the changes there, save it, and&amp;nbsp;link it again in the original host.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2015 19:15:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/transaction-problem-linked-document/m-p/5807872#M70609</guid>
      <dc:creator>arnostlobel</dc:creator>
      <dc:date>2015-09-08T19:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction Problem, Linked Document.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/transaction-problem-linked-document/m-p/5808881#M70610</link>
      <description>&lt;P&gt;You are right, but my example not. I am sorry.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 12:29:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/transaction-problem-linked-document/m-p/5808881#M70610</guid>
      <dc:creator>OR_AND_NO</dc:creator>
      <dc:date>2015-09-09T12:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction Problem, Linked Document.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/transaction-problem-linked-document/m-p/5810539#M70611</link>
      <description>&lt;P&gt;Dear Arnošt,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for the real answer!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I published a summary of these explanations&amp;nbsp;on The Building Coder:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2015/09/geometry-basics-and-no-modifying-linked-files.html#3" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2015/09/geometry-basics-and-no-modifying-linked-files.html#3&lt;/A&gt;&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;</description>
      <pubDate>Thu, 10 Sep 2015 08:22:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/transaction-problem-linked-document/m-p/5810539#M70611</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2015-09-10T08:22:01Z</dc:date>
    </item>
  </channel>
</rss>

