<?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: Document Session ID in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/document-session-id/m-p/9842674#M30695</link>
    <description>&lt;P&gt;Dear Tobias,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As we all know, there are no stupid questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sometimes people would be better served searching for an answer themselves before asking others. It seems to me you have already searched, with no fruitful results. Thank you for that. However, there is some information on this already out there, waiting to be found:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Every Revit project includes a singleton ProjectInformation database element. Every&amp;nbsp;database element has a unique identifier. So, theoretically, you could use that to uniquely identify a project.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, if I create a project A, and then copy it for reuse in project B, the two&amp;nbsp;ProjectInformation elements will have the same unique id, so this solution only works if you can guarantee that no such copy will ever be created:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2017/12/project-identifier-and-fuzzy-comparison.html#2" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2017/12/project-identifier-and-fuzzy-comparison.html#2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a some further analysis of this situation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://the3dwebcoder.typepad.com/blog/2015/07/implementing-mongo-database-relationships.html#2" target="_blank"&gt;https://the3dwebcoder.typepad.com/blog/2015/07/implementing-mongo-database-relationships.html#2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To address this, I suggested a different and safer solution using&amp;nbsp;&lt;SPAN&gt;an extensible storage schema and a&amp;nbsp;&lt;/SPAN&gt;named GUID storage for project identification instead:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2016/04/named-guid-storage-for-project-identification.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2016/04/named-guid-storage-for-project-identification.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope these various thoughts and suggestions can help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please do let us know how you end up solving this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&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;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Nov 2020 14:07:23 GMT</pubDate>
    <dc:creator>jeremytammik</dc:creator>
    <dc:date>2020-11-03T14:07:23Z</dc:date>
    <item>
      <title>Document Session ID</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/document-session-id/m-p/9842515#M30694</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for my stupid question, can't find an answer. But I'm sure there is a way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there something like a session id for open documents?&lt;/P&gt;&lt;P&gt;I would like to uniquely identify a Autodesk.Revit.DB.Document object, for example in the ViewActivated Event. This is needed while more than one document can be open at the same time in Revit. Because I hold some stuff in memory, I need to know to which document it belongs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The DocumentPath as Id is not an option, because newly created documents have a zero string (could be occur more than one as well in a session)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for hints&lt;/P&gt;&lt;P&gt;Tobias&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 12:58:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/document-session-id/m-p/9842515#M30694</guid>
      <dc:creator>tobias.floescher</dc:creator>
      <dc:date>2020-11-03T12:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: Document Session ID</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/document-session-id/m-p/9842674#M30695</link>
      <description>&lt;P&gt;Dear Tobias,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As we all know, there are no stupid questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sometimes people would be better served searching for an answer themselves before asking others. It seems to me you have already searched, with no fruitful results. Thank you for that. However, there is some information on this already out there, waiting to be found:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Every Revit project includes a singleton ProjectInformation database element. Every&amp;nbsp;database element has a unique identifier. So, theoretically, you could use that to uniquely identify a project.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, if I create a project A, and then copy it for reuse in project B, the two&amp;nbsp;ProjectInformation elements will have the same unique id, so this solution only works if you can guarantee that no such copy will ever be created:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2017/12/project-identifier-and-fuzzy-comparison.html#2" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2017/12/project-identifier-and-fuzzy-comparison.html#2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a some further analysis of this situation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://the3dwebcoder.typepad.com/blog/2015/07/implementing-mongo-database-relationships.html#2" target="_blank"&gt;https://the3dwebcoder.typepad.com/blog/2015/07/implementing-mongo-database-relationships.html#2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To address this, I suggested a different and safer solution using&amp;nbsp;&lt;SPAN&gt;an extensible storage schema and a&amp;nbsp;&lt;/SPAN&gt;named GUID storage for project identification instead:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2016/04/named-guid-storage-for-project-identification.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2016/04/named-guid-storage-for-project-identification.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope these various thoughts and suggestions can help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please do let us know how you end up solving this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 14:07:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/document-session-id/m-p/9842674#M30695</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-11-03T14:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Document Session ID</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/document-session-id/m-p/9842752#M30696</link>
      <description>&lt;P&gt;Hello Jeremy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Indeed, I searched before without a satisfying result.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;I came to the same conclusion as your solutions.&lt;/SPAN&gt; &lt;SPAN class=""&gt;I was hoping there was something else&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Possibly use the combination of unique identifier and the file path, but this is not very elegant. I think I will end up in use the solution with extensible storage. maybe a second scheme, not the same as my plugin use for storing its data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank's a lot for your answer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;tobias&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 14:35:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/document-session-id/m-p/9842752#M30696</guid>
      <dc:creator>tobias.floescher</dc:creator>
      <dc:date>2020-11-03T14:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Document Session ID</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/document-session-id/m-p/9843024#M30697</link>
      <description>&lt;P&gt;Some documents don't contain a path (yet to be saved ones).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Document.GetHashCode has served me well over the years. Mainly I use this in static variable to see if the current document has switched via the ViewActivatedEvent.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 16:14:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/document-session-id/m-p/9843024#M30697</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2020-11-03T16:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Document Session ID</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/document-session-id/m-p/9844775#M30698</link>
      <description>&lt;P&gt;Ah very nice. thank you for that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;read the manual:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.revitapidocs.com/2020/006a71c2-4393-e036-9987-14467342a7d3.htm" target="_blank"&gt;https://www.revitapidocs.com/2020/006a71c2-4393-e036-9987-14467342a7d3.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2020 09:49:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/document-session-id/m-p/9844775#M30698</guid>
      <dc:creator>tobias.floescher</dc:creator>
      <dc:date>2020-11-04T09:49:44Z</dc:date>
    </item>
  </channel>
</rss>

