Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Anormal modification of Element.UniqueId

rBarland
Participant

Anormal modification of Element.UniqueId

rBarland
Participant
Participant

Hello,

 

We encounter a problem with the management of the GUID collected by the "Element.UniqueId".
- When deleting an element, and then use the Undo function, the element that reappears has still the same ID and the same UniqueId.
- In the other case, if after deleting it, we save the project and then use the Undo function, the element that reappears has still the same Id but the UniqueId changed!
- The same problem also exists with IFC GUID.

 

This bug causes obviously a very big problem in the management of plugins that manage an external database or other tools using the IFC export.

 

Revit API’s documentation specifies that you can not directly use the id:

// Résumé :
//     A stable unique identifier for an element within the document.
//
// Notes :
//     The UniqueId can be used to store an identifier in an external database and to
//     retrieve the same element in the future if it still exists. This id can be passed
//     to the Document's Element property to retrieve the element. The UniqueId is stable
//     across upgrades and workset operations such as Save To Central, while the Autodesk.Revit.DB.ElementId
//     property may change.

 

We encountered this problem with the Revit 2016 Build 16.0.1144.0 and also the previous one.


Is there a feature or trick to skirt it?

0 Likes
Reply
857 Views
6 Replies
Replies (6)

JimJia
Alumni
Alumni
Dear Romain Barland,

Please accept our sincerer apology for the delay! We had a backlog in the queue.

We checked the description, unfortunately however it is hard to us to find a clue how to recreate this problem. In order to diagnose, could you isolate your test project and send us a small, reproducible sample? Note, please do not send us any information you think are confidential to your company.

Besides, following pages have good discussion on unique ID and IFC related, hope it's helpful:
http://thebuildingcoder.typepad.com/blog/2012/09/ifc-guid-generation-and-uniqueness.html
http://thebuildingcoder.typepad.com/blog/2013/09/access-to-individual-elements-in-linked-projects.ht...

We appreciate your understanding and your patience again!

Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes

rBarland
Participant
Participant
Hello,

We don't have a particular project to show this problem. It is present on all the tested projects.

To reproduce it:
- 1: Create a new project (template Architectural)
- 2: Enter a wall (Basic wall GENERIC - Ext 200 mm)
- 3: Save the project
- 4: Check GUID(ex: with Revit Lookup from Jeremy Tammik)
ID = 236076
GUID = e69ff5af-c168-40ac-8d22-5bfca33a2315-00039a2c
- 5: Select then remove the wall
- 6: Save the Project (Click the Save button)
- 7: Cancellation the Removal (Click the Undo button)
- 8: Check GUID
ID = 236076
GUID = c3d7250d-63e5-478a-8af0-4223944517e3-00039a2c

The GUID is different.
The problem does not appear if the operation 6 (Save before Undo) IS NOT Executed

Regarding the changing IFC GUID, we encounter the problem even without doing a modification on the project.
Attached is the link to download the example project and IFC exporting obtained: http://www.attic-plus-espaceclient.fr/telechgt/Autres/TestRevit/Test_GUID_IFC.zip

The Problem Was tested on:
- Revit 2016 Build 16.0.1144.0 with the standard IFC export
- Revit 2016 Build 16.0.1144.0 With IFC export 2016 Version 16.4.0.0
- Revit 2017 building 17.0.476.0 with the standard IFC export

Without doing any modification of the project, the IFC GUID of some elements change with each new export!
The screen capture below shows a door on which it occurs.
[cid:image003.png@01D1E429.682FCC10]

Best regards,

Xavier GARACHON
Service Technique
Tél : 04 73 35 62 56 - technique@attic-plus.fr
[Description : Logo-attic-fond-blanc 150 50]
w w w . a t t i c - p l u s . f r
0 Likes

JimJia
Alumni
Alumni
Dear Romain Barland,

Please refer to Jeremy's workaround which already mentioned in blog page: http://thebuildingcoder.typepad.com/blog/2012/09/ifc-guid-generation-and-uniqueness.html
"Answer: After some investigation we now understand the source of the issue. The GUID generation routines have an internal cache that prevents duplicate GUIDs from being generated. In IFC, these functions are called once per element, and then a call to the ExporterIFCUtils.EndExportInternal method clears this cache for the next IFC export. Please note that the first time you call these routines, they have consistent values from previous sessions.

For now, there are two workarounds:

1:Only call the functions once per session, and store their values.
2: Call ExporterIFCUtils.EndExportInternal to reset the internal cache."

Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes

rBarland
Participant
Participant
Hello,

Thank you for your answer , but it does’nt bring me a solution.
The first problem reported doens’t concerne IFC GUID but the UniqueId Revit !

"
To reproduce it:
- 1: Create a new project (template Architectural)
- 2: Enter a wall (Basic wall GENERIC - Ext 200 mm)
- 3: Save the project
- 4: Check GUID(ex: with Revit Lookup from Jeremy Tammik)
ID = 236076
GUID UniqueId = e69ff5af-c168-40ac-8d22-5bfca33a2315-00039a2c
- 5: Select then remove the wall
- 6: Save the Project (Click the Save button)
- 7: Cancellation the Removal (Click the Undo button)
- 8: Check GUID
ID = 236076
GUID UniqueId = c3d7250d-63e5-478a-8af0-4223944517e3-00039a2c
"

To quote the blog page of Jeremy Tammik :
" Answer: The one and only really unique id maintained by Revit and guaranteed to be unique and stable for elements across worksharing environments is the UniqueId…"
But this is not always the case!

Regarding the second issue (random GUID IFC) , it appears with the exports delivered with Revit.
How to explain to an architect ( using Revit but not using any of our solutions ) that the IFC export they will send to our clients doens’t allow them to reliably diagnose any changes made ​​to the file ?

Regards,

Cordialement

Xavier GARACHON
Service Technique
Tél : 04 73 35 62 56 - technique@attic-plus.fr
[Description : Logo-attic-fond-blanc 150 50]
w w w . a t t i c - p l u s . f r
0 Likes

JimJia
Alumni
Alumni

Hi Romain,

 

We communicated with engineering team, following is message from Revit IFC code owner Angel Velez, FYI:

"The IFC GUID is based on the Revit UniqueId.  If the UniqueId is changing, then so will the IFC GUID.  I suspect that when you save a file, you change the EpisodeId of the document.  The unique Id of an element is based on the EpisodeId and the ElementId.  If the EpisodeId is reset on an undo of a delete, that would explain it.   

For the issue of consistent GUIDs, Revit ensures that: 

1.       No two GUIDs in the IFC file are ever the same.  This is a 100% guarantee.

2.       For all IFC entities that are created from Revit elements, we create a consistent GUID (it doesn’t change between exports).  Note that that’s based on the UniqueId being consistent, so if there is an issue there, then that will clearly affect IFC export.

3.       For other entities, on a case-by-case basis, we can make some of them have consistent GUIDs.  For many, though, it isn’t possible (or extremely difficult). "


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes

hassan
Explorer
Explorer

Could any one found a solution for the changing Element Unique ID after deletion-save-undo scenario?

PLEASE, do not mention the IFC for an answer, we are oriented towards the changed Unique ID 

Any help will be appreciated