- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I'm trying to retrieve the GUIDs of elements within a RevitLinkInstance to generate reports that can accurately identify elements across a Document and an IFC file.
For a better understanding of GUIDs in Revit, you can refer to this helpful resource: https://thebuildingcoder.typepad.com/blog/2009/02/uniqueid-dwf-and-ifc-guid.html
The problem : The methods I know for obtaining a GUID, but neither provides the GUID of an element in a RevitLinkInstance. Instead, they always return the GUID as if the linked document is the active one.
Important Note: I cannot use the "IFC GUID" parameter because it is not populated for elements within a link.
Exemple : I have a Document containing two identical RevitLinkInstance objects (from the same RevitLinkType). When exporting an IFC, the same element from the RevitLinkType gets different GUIDs depending on which RevitLinkInstance owns it.
Even if I set the linked document as the active one and export an IFC, the resulting GUIDs are still different. Fortunately, these GUIDs from the Active Document can be obtained using specific API methods or algorithms (detailed below).
Exsting API method and algorithm :
- "ExportUtils.GetExportId"
- This method requires the element's document.
- As a result, it always returns the GUID as if the linked document is the active one, and not the GUID within the RevitLinkInstance.
- API Reference: https://www.revitapidocs.com/2023/f410a32a-f9dd-32b3-b640-3cfa90e8b168.htm
- "ExporterIFCUtils.CreateAlternateGUID"
- This method generates the same GUID that can be derived using the following algorithm:
https://thebuildingcoder.typepad.com/blog/2010/06/ifc-guid-algorithm-in-c.html - It relies on ExportUtils.GetExportId and is therefore subject to the same limitations.
- Note: The results from this method may vary if the active document has not had an IFC exported and the "IFC GUID" parameter is not populated, making the algorithm generally more stable.
- API Reference: https://www.revitapidocs.com/2019/7eee1508-c064-bc8d-ed79-76366948f15f.htm
- This method generates the same GUID that can be derived using the following algorithm:
Request for Assistance
Does anyone know a method or workaround to get the GUID of an element within a RevitLinkInstance instead of the linked document itself?
Thanks in advance for your help!
Solved! Go to Solution.
