Specific GUID. Is it posible?

Specific GUID. Is it posible?

ol2743
Contributor Contributor
1,273 Views
10 Replies
Message 1 of 11

Specific GUID. Is it posible?

ol2743
Contributor
Contributor

Helo!

How can I generate elements that have specific GUID? 

Example - I have one ( or a lot of ) element and GUID(s) ( that I want ), I need element  having that GUID.

 

0 Likes
1,274 Views
10 Replies
Replies (10)
Message 2 of 11

RPTHOMAS108
Mentor
Mentor

If you are speaking about Element.UniqueId then the answer is no, those are generated by Revit.

 

0 Likes
Message 3 of 11

caroline.gitonga
Autodesk
Autodesk

Hi @ol2743,

Do you mean ElementId , UniqueId or version Guid.

I believe all the above are unique identifiers auto-generated and stored in an external database to uniquely select or retrieve an element when created.
There is way you could specify the above on your own and assign them manually to an element

Carol Gitonga, Developer Advocacy and Support, ADN Open
0 Likes
Message 4 of 11

caroline.gitonga
Autodesk
Autodesk

There is NO way you could specify the above on your own and assign them manually to an element

Carol Gitonga, Developer Advocacy and Support, ADN Open
0 Likes
Message 5 of 11

ol2743
Contributor
Contributor
0 Likes
Message 6 of 11

jeremy_tammik
Alumni
Alumni

You mean that you wish to generate a Revit BIM element and specify its unique id?

 

No, that is not possible.

 

If you are in a situation with such a requirement, there is a serious flaw in your workflow design and architecture.

 

Use some other identifier. If you need to define the identifier yourself, then do so.

 

You cannot expect Revit or any other software to generate a GUID according to your specification.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 7 of 11

jeremy_tammik
Alumni
Alumni

An example of generating and storing your own GUID to identify a project that could also be used for individual BIM elements is given by the named GUID storage for project identification:

 

https://thebuildingcoder.typepad.com/blog/2016/04/named-guid-storage-for-project-identification.html

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 8 of 11

ol2743
Contributor
Contributor

We need it - for IFC export. That our workflow is that we have a master database, from which we need to generate and re-generate objects in Revit - but we would like that when exported to IFC, their GlobalId is set to something that we have generated in our own project, not newly assigned by Revit each case.

 

0 Likes
Message 9 of 11

jeremy_tammik
Alumni
Alumni

Well, sorry, you read all the unanimous answers above. You can easily program a workaround. You will not be able to force Revit to use the unique ids you need, but you can easily equip the building elements with the pre-existing ids in your own data structure and replace them in the IFC file or elsewhere along the processing pipeline. Be creative.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 10 of 11

RPTHOMAS108
Mentor
Mentor

There is already a mechanism for keeping IFC GUID's consistent for elements between IFC exports from a Revit project.

 

https://forums.autodesk.com/t5/revit-api-forum/guid/m-p/10616955/highlight/true#M58275

 

If you need to recreate the elements in Revit then your need to repopulate the parameter used to store the GUID in relation to the above setting with the value you want it to be. 

 

So if you are creating elements in Revit from data in this external database then just populate the parameter of that created element with what exists in your external database (removing same superseded item in Revit). Then when exported the IFC GUID will be generated from the parameter if the above setting is used for export.

Message 11 of 11

jeremy_tammik
Alumni
Alumni

Dear Thomas,

 

Wow, thank you very much for pointing out that super important feature and thread answer of yours. I was previously unaware of it. Sounds like an important step towards a viable solution to me.

 

Cheers, 

 

Jeremy

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes