Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Specific GUID. Is it posible?

10 REPLIES 10
Reply
Message 1 of 11
ol2743
631 Views, 10 Replies

Specific GUID. Is it posible?

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.

 

10 REPLIES 10
Message 2 of 11
RPTHOMAS108
in reply to: ol2743

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

 

Message 3 of 11
caroline.gitonga
in reply to: ol2743

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
Message 4 of 11

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
Message 5 of 11
ol2743
in reply to: ol2743

Message 6 of 11
jeremy_tammik
in reply to: ol2743

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
in reply to: ol2743

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
Message 8 of 11
ol2743
in reply to: jeremy_tammik

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.

 

Message 9 of 11
jeremy_tammik
in reply to: ol2743

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
Message 10 of 11
RPTHOMAS108
in reply to: ol2743

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
in reply to: RPTHOMAS108

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report