Resolve a version to its root object
Every version carries areferencedObject field. Its value is the object id of the root of that version’s data package. Fetch the version, read the id, then receive that object.
- Get the version. List a model’s versions to take the latest, or fetch one by id.
- Read
referencedObject. It is a plain object id, the same kind of id every object in the package has. - Receive that id. The SDK downloads the root and every object it references, and returns the root as a
Base.
Base as the root. Check speckle_type before you assume a Collection.
referencedObject is null when the version is beyond your workspace’s version history limit.
There is nothing to receive for such a version.What lives on the Version
The server stores these fields when the version is created. Read them from the version record. They are not present on the root object.
The .NET and Python SDK
Version types expose every row except totalChildrenCount and parents. Query those two fields with the GraphQL API when you need them.
What lives on the root object
The root object is aBase. Connectors publish it as a Collection and set the fields below on it before sending. Only name and elements are declared on the Collection class. The rest are dynamic properties, so read them by key.
The units convention
Connectors write the source document’s unit tounits on the root object. The value is one of the SDK unit strings: mm, cm, m, km, in, ft, yd, mi, or none. Treat it as the default unit for the whole package.
Geometry objects also carry their own units field. A connector normally writes the same value to both. When you convert coordinates, read the unit from the geometry object you are converting, and use the root value as the fallback when a geometry object has none.
Read each in a script
Both snippets assumeclient, project_id / projectId, and model_id / modelId are already in scope, and that you have authenticated with a personal access token. The Python snippet also assumes a ServerTransport named transport. The .NET snippet assumes account and an IOperations named operations.
- .NET
- Python
Example
Set each field in the right place when you publish
The same split applies when you publish from a script.- Set
name,units, andelementson the rootBasebefore you send it. Set them as dynamic properties on aCollectionto match what connectors publish. - Pass
message,sourceApplication, andtotalChildrenCountin the create-version input after the send returns the root object id.
FAQ
Can I point an existing version at a different root object?
Can I point an existing version at a different root object?
No. A version’s
referencedObject is fixed at creation. Updating a version changes only its
message. Send the new root and create a new version for it.What happens to the root object when I delete the version?
What happens to the root object when I delete the version?
The root object and its children stay in the project’s object store, but nothing references
them. They are orphaned and reachable only by object id.
Next steps
Core Concepts
Root Collection, Proxies, and Info in detail
Traversal Recipes
Walk
elements once you hold the rootObject Schema
Fields on every object below the root