<?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: Unique Id vs ElementId, which identifier to stored in the external database. in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/unique-id-vs-elementid-which-identifier-to-stored-in-the/m-p/4974930#M77069</link>
    <description>&lt;DIV&gt;The above answer/suggestion is not entirely correct. Revit’s UniqueID is not a Guid. It is a string. Part of the string is a Guid, but the whole thing is not&amp;nbsp;– it needs to be treated as a string identifier.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;To get a unique Id for an element use: Element.UniqueId&lt;/DIV&gt;
&lt;DIV&gt;To retrieve an element by its unique Id: document.GetElement( uniqueId )&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;By the way, the difference between UniqueId and regular element&amp;nbsp;Id is its stability (or instability, respectively) in a work-sharing environment. While regular element Ids are unique only in documents that are not work-shared, Unique Ids are stable and still unique even in document that are shared (and modified by) several local copies and then synchronizes with the server version.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Neither of the identifiers types are stable across individual Revit documents&amp;nbsp;– it means that elements in different, independent&amp;nbsp;Revit models may have the same Ids (as well as UniqueIds) assigned.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Arnošt Löbel&lt;/DIV&gt;
&lt;DIV&gt;Sr. Principal Engineer&lt;/DIV&gt;
&lt;DIV&gt;Autodesk, Revit R&amp;amp;D&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Sun, 20 Apr 2014 14:14:44 GMT</pubDate>
    <dc:creator>arnostlobel</dc:creator>
    <dc:date>2014-04-20T14:14:44Z</dc:date>
    <item>
      <title>Unique Id vs ElementId, which identifier to stored in the external database.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unique-id-vs-elementid-which-identifier-to-stored-in-the/m-p/4962636#M77067</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to develop a Revit extension which help to export/import Revit building model to structural analysis software. In the external database, i am not sure which identifier to be stored in order to retrieve the same element after successive import/export call between Revit and analysis software.&lt;/P&gt;&lt;P&gt;I wish to implement something described as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1)After structural analysis software made changes to the building model, it export these changes to a external database. My extension will load the external database, retrieve the 'changed' element based on the identifier(i.e document.get_element(ElementId/UniqueId)) in Revit and apply the changes to the retrieved element. However these ids are used internally in Revit and i don't know how Revit generate the ids which make me hard to identify which element is changed outside Revit.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;2)&lt;/SPAN&gt;&lt;SPAN&gt;Revit&lt;/SPAN&gt;&lt;SPAN&gt; user can &lt;/SPAN&gt;&lt;SPAN&gt;aslo&lt;/SPAN&gt;&lt;SPAN&gt; made change to the &lt;/SPAN&gt;&lt;SPAN&gt;building&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;model and send this changes back to structural analysis &lt;/SPAN&gt;&lt;SPAN&gt;software&lt;/SPAN&gt;&lt;SPAN&gt;. However, in the &lt;/SPAN&gt;&lt;SPAN&gt;structural&lt;/SPAN&gt;&lt;SPAN&gt; analysis software, there is no &lt;/SPAN&gt;&lt;SPAN&gt;unique&lt;/SPAN&gt;&lt;SPAN&gt; identifier for each element like &lt;/SPAN&gt;&lt;SPAN&gt;Revit&lt;/SPAN&gt;&lt;SPAN&gt; do. Hence, i think i need to create one.(i.e use &lt;/SPAN&gt;&lt;SPAN&gt;GUID&lt;/SPAN&gt;&lt;SPAN&gt;). But this identifier is not the same as the one used in &lt;/SPAN&gt;&lt;SPAN&gt;Revit&lt;/SPAN&gt;&lt;SPAN&gt;. How do i generate a same identifier which is used to identify the element in both &lt;/SPAN&gt;&lt;SPAN&gt;Revit&lt;/SPAN&gt;&lt;SPAN&gt; and structural analysis software?&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I get some suggestion as below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;1)On export from Revit, create a set of GUIDs for the exported elements. Besides that, each exported element's ElementId must be saved as well.&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;How do i generate a&amp;nbsp;&lt;A target="_self" href="http://msdn.microsoft.com/en-us/library/system.guid.aspx"&gt;Guid&lt;/A&gt;&amp;nbsp;which is used to identify exported element?&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;2)On import to Revit, check for an existing object with the standard GUID or else create a new one.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;So, S&lt;/SPAN&gt;&lt;SPAN&gt;tructural&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;analysis software need to generate the G&lt;/SPAN&gt;&lt;SPAN&gt;uid&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;in the same way described in(1) so that the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;guid&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;is identical to both&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Revit&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;and Analysis software? Please correct me if i am wrong or something i have missed out. &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Does anyone have other suggestion?&amp;nbsp;Any help is appreciated.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Apr 2014 03:56:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unique-id-vs-elementid-which-identifier-to-stored-in-the/m-p/4962636#M77067</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-04-16T03:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Id vs ElementId, which identifier to stored in the external database.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unique-id-vs-elementid-which-identifier-to-stored-in-the/m-p/4962990#M77068</link>
      <description>&lt;P&gt;The Document class has some GetElement methods to access Elements by their index (ElementId or Guid).&lt;/P&gt;&lt;P&gt;The Guid is for that case a string, so you need to get the elements like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Guid uniqueId = something;&lt;/P&gt;&lt;P&gt;Element fetch = doc.GetElement(uniqueId.ToString());&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The opposite is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Guid elementGuid= new Guid(element.UniqueId);&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case, the UniqueId is also a string, so you need to convert it to a Guid struct.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Apr 2014 08:01:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unique-id-vs-elementid-which-identifier-to-stored-in-the/m-p/4962990#M77068</guid>
      <dc:creator>GonçaloFeio1321</dc:creator>
      <dc:date>2014-04-16T08:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Id vs ElementId, which identifier to stored in the external database.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unique-id-vs-elementid-which-identifier-to-stored-in-the/m-p/4974930#M77069</link>
      <description>&lt;DIV&gt;The above answer/suggestion is not entirely correct. Revit’s UniqueID is not a Guid. It is a string. Part of the string is a Guid, but the whole thing is not&amp;nbsp;– it needs to be treated as a string identifier.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;To get a unique Id for an element use: Element.UniqueId&lt;/DIV&gt;
&lt;DIV&gt;To retrieve an element by its unique Id: document.GetElement( uniqueId )&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;By the way, the difference between UniqueId and regular element&amp;nbsp;Id is its stability (or instability, respectively) in a work-sharing environment. While regular element Ids are unique only in documents that are not work-shared, Unique Ids are stable and still unique even in document that are shared (and modified by) several local copies and then synchronizes with the server version.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Neither of the identifiers types are stable across individual Revit documents&amp;nbsp;– it means that elements in different, independent&amp;nbsp;Revit models may have the same Ids (as well as UniqueIds) assigned.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Arnošt Löbel&lt;/DIV&gt;
&lt;DIV&gt;Sr. Principal Engineer&lt;/DIV&gt;
&lt;DIV&gt;Autodesk, Revit R&amp;amp;D&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Sun, 20 Apr 2014 14:14:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unique-id-vs-elementid-which-identifier-to-stored-in-the/m-p/4974930#M77069</guid>
      <dc:creator>arnostlobel</dc:creator>
      <dc:date>2014-04-20T14:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Id vs ElementId, which identifier to stored in the external database.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unique-id-vs-elementid-which-identifier-to-stored-in-the/m-p/4981728#M77070</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understood the relationship between UniqueId and regular element id. But now, i do not know how to keep track of structural element in a building model in both Revit and structural analysis software&amp;nbsp;&lt;SPAN&gt;after successive import/export call between Revit and analysis software.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I wish to implement something described as below:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1)After structural analysis software made changes to the building model, it export these changes to a external database. My add-in will load the external database, retrieve the 'changed' element based on the identifier(i.e document.get_element(ElementId/UniqueId)) in Revit and apply the changes to the retrieved element. However these ids are used internally in Revit and i don't know how Revit generate the ids which make me hard to identify which element is changed outside Revit.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;2)&lt;/SPAN&gt;&lt;SPAN&gt;Revit&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;user can&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;aslo&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;made change to the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;building&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;model and send this changes back to structural analysis&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;software&lt;/SPAN&gt;&lt;SPAN&gt;. However, in the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;structural&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;analysis software, there is no&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;unique&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;identifier for each element like&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Revit&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;do. Hence, i think i need to create one.(i.e use&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;GUID&lt;/SPAN&gt;&lt;SPAN&gt;). But this identifier is not the same as the one used in&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Revit&lt;/SPAN&gt;&lt;SPAN&gt;. How do i generate a same identifier which is used to identify the element in both&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Revit&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;and structural analysis software?&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I get some suggestion from Jeremy's blog:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;1)On export from Revit, create a set of GUIDs for the exported elements. Besides that, each exported element's ElementId must be saved as well.&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;How do i generate a&amp;nbsp;&lt;A href="http://msdn.microsoft.com/en-us/library/system.guid.aspx" target="_self" rel="nofollow"&gt;Guid&lt;/A&gt;&amp;nbsp;which is used to identify exported element?&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;2)On import to Revit, check for an existing object with the standard GUID or else create a new one.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;So, S&lt;/SPAN&gt;&lt;SPAN&gt;tructural&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;analysis software need to generate the G&lt;/SPAN&gt;&lt;SPAN&gt;uid&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;in the same way described in(1) so that the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;guid&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;is identical to both&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Revit&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;and Analysis software? Please correct me if i am wrong or something i have missed out. &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&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;Does anyone have other suggestion?&amp;nbsp;Any help is appreciated.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2014 07:42:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unique-id-vs-elementid-which-identifier-to-stored-in-the/m-p/4981728#M77070</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-04-23T07:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Id vs ElementId, which identifier to stored in the external database.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unique-id-vs-elementid-which-identifier-to-stored-in-the/m-p/4981920#M77071</link>
      <description>&lt;P&gt;Dear Bsyap,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the elements originate in Revit and come equipped with a unique id, I would use that to identify them in both environments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the elements originate outside of Revit and you need to assign a perpetual unique identifier to them before they automatically become equipped with a Revit unique id, I would use a standard GUID in addition, just like you described.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This makes things much more complicated than just using the Revit unique id, though.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To generate a GUID, you can simply use the standard Windows or .NET API.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://lmgtfy.com/?q=.net+guid+generate" target="_blank"&gt;http://lmgtfy.com/?q=.net+guid+generate&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2014 08:43:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unique-id-vs-elementid-which-identifier-to-stored-in-the/m-p/4981920#M77071</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2014-04-23T08:43:55Z</dc:date>
    </item>
  </channel>
</rss>

