Need to retrieve RevitInstance Id during Unity runtime

We want to retrieve this object in Unity during runtime.

Cannot find this Id in Speckle Properties. The element Id is repeating for multiple objects so cannot use it to get this specific one.

image

Is there a way to get this in Unity?

That RevitInstance will have a defintion and transform properties. In turn, the definition will have an id to retrieve the geometry defintion; these two Speckle objects can combine in a way that a Unity app developer probably understands better than a BIMmer.

The web frontend does this stitching together for you.

The definition id happens to not be unique for some objects that have the same local geometries but different world positions. Can you clarify what you meant by, “These two speckle objects can combine” did you mean we should use the definition id and the transform id both to retrieve the object we want during runtime?

ElementId too repeats for repeating geometries, which are few but important to us, and so far it seems we would have to use their world positions to differentiate between these duplicates just for those few cases, which just adds more conditions to check and room for errors in the future.

We want to write a general code that we can use for all object types (not just RevitInstances), it seems other SpeckleTypes don’t have Definition as a field, so if there is One Unique Id field that will be the same in speckle and unity, that is also present in all SpeckleTypes, can you point me towards where I can find that id?

To add, we want an id that will be the same across all connectors for each specific instance of a 3d object, so we can use that to correlate between different connectors.

This is correct, there is a single Definition shared by many Instances.

The Unique Addressable ID will be carried on the Instance, as will other instance parameters.

ElementId is the internal ID that Revit a user can use in Revit to address a specific element (instance)

There s a lot more to unpick from that actually than first appearances. If you want to be in control of something immutable, then the way to achieve this from Revit into other Connectors is to make it yourself in a parameter in Revit.

ElementId - Automatically assigned by Revit on Element creation. Immutable until it isn’t (operations that delete and replace instead of amend the Revit Element)
id (Speckle Generated) - this is a hash of the entire detached object if any property changes, data or geometry, a new id will be created (on a new object in the Speckle DB

Speckle Id will also change if you Send from Revit, Receive in Rhino and send again from Rhino - it is now a Rhino object.

So, having an extremely reliable immutable ID across all apps is a phantasm. But applying your own may be unfeasible if you want it for ALL elements. We’d need to know more of what you are seeking to achieve to advise any further.

How many other Connectors are you seeking to track IDs across?

As of now our focus is Unity and Python. We are using python to do some calculations and then based on python’s output we use Unity for visualization. The .id we obtain from the received data in python, appears to be the first “id” field we see in speckle web UI. But we could not find that id in the SpeckleProperties data that Unity receives, the id we found was different than what python receives.

Your suggestion to add a custom parameter is a promising approach. However a way of getting the id that python receives from speckle, into the data that Unity receives from speckle; would make our workflow much smoother. Or even, another id that will be unique, immutable and is accessible in both connectors helps us.