Skip to main content

object_from_reference

GitHub source

object_from_reference

evo.objects.typed.base.object_from_reference

object_from_reference(context: IContext, reference: ObjectReference | str) -> _BaseObject

Download a GeoscienceObject from an ObjectReference and create the appropriate typed instance.

This function downloads the object from a full ObjectReference (which can contain path, UUID, version, etc.) and automatically selects the correct typed class (e.g., PointSet, Regular3DGrid) based on the object's sub-classification.

Parameters:

NameTypeDescriptionDefault
contextIContextThe context for connecting to Evo APIs.required
referenceObjectReference | strThe ObjectReference identifying the object to download.required

Returns:

TypeDescription
_BaseObjectA typed GeoscienceObject instance (PointSet, Regular3DGrid, etc.).

Raises:

TypeDescription
ValueErrorIf no typed class is found for the object's sub-classification.

Example::

<br/>from evo.objects.typed import object_from_reference<br/>from evo.objects import ObjectReference<br/><br/># Create reference from URL<br/>ref = ObjectReference("evo://org/workspace/object/b208a6c9-6881-4b97-b02d-acb5d81299bb")<br/>obj = await object_from_reference(context, ref)<br/><br/># obj will be a PointSet if the object is a pointset,<br/># a Regular3DGrid if it's a regular-3d-grid, etc.<br/>

Was this page helpful?