mapteksdk.data.io module
Functions for importing and exporting data.
- import_00t(path, unit=DistanceUnit.METRE)
Import a Maptek Vulcan Triangulation file (00t) into the project.
- Parameters
path (str | pathlib.Path) – Path to file to import.
unit (DistanceUnit) – The unit used when exporting the file.
- Returns
The ID of the imported object.
- Return type
- Raises
FileNotFoundError – If the file does not exist.
TypeError – If path cannot be converted to a pathlib.Path. If the unit is not an instance of DistanceUnit.
RuntimeError – If there is a problem importing the file.
Notes
The imported object is not automatically placed inside a container. A call to project.add_object() is required to add it to a container.
- export_00t(object_id, path, unit=DistanceUnit.METRE)
Export a Surface to a Vulcan Triangulation (00t).
- Parameters
object_id (ObjectID[Surface]) – The ID of the surface to export.
path (str | pathlib.Path) – Where to save the 00t.
unit (DistanceUnit) – Unit to use when exporting the file.
- Raises
TypeError – If the unit is not a DistanceUnit.
RuntimeError – If there was a problem exporting the file.
Notes
Changed in version 1.4 - This function no longer returns a value. Prior to 1.4, this would return True on success and raise an exception on failure (It could never return False).
- import_bmf(path, unit=DistanceUnit.METRE)
Import a Maptek Block Model File (bmf) into the project.
- Parameters
path (str | pathlib.Path) – Path to file to import.
unit (DistanceUnit) – Unit to use when importing the file.
- Returns
The ID of the imported object.
- Return type
- Raises
TypeError – If path could not be converted to a pathlib.Path. If the unit is not an instance of DistanceUnit.
FileNotFoundError – If the file does not exist.
RuntimeError – If there is a problem importing the file.
Notes
The ObjectID returned by this function is type hinted as ObjectID[BlockProperties, DataObject] because all supported block models are expected to inherit from BlockProperties and DataObject. This means autocompletion should only suggest properties which are shared by all block models. The type hint may be incorrect if the bmf contains a block model not supported by the SDK.
- export_bmf(object_id, path, unit=DistanceUnit.METRE)
Export a block model to a Maptek Block Model File (bmf).
- Parameters
object_id (ObjectID[mapteksdk.data.primitives.block_properties.BlockProperties | mapteksdk.data.base.DataObject]) – The ID of the block model to export as a bmf.
path (str | pathlib.Path) – Where to save the bmf file.
unit (DistanceUnit) – Unit to use when exporting the file.
- Returns
True if the export was a success. This never returns false - if the import fails an exception will be raised.
- Return type
bool
- Raises
TypeError – If unit is not a DistanceUnit.
RuntimeError – If there was a problem exporting the file.
Notes
Changed in version 1.4 - This function no longer returns a value. Prior to 1.4, this would return True on success and raise an exception on failure (It could never return False).
- import_maptekobj(path)
Import a Maptek Object file (maptekobj) into the project.
- Parameters
path (str | pathlib.Path) – Path to file to import.
- Returns
The ID of the imported object.
- Return type
- Raises
FileNotFoundError – If the file does not exist.
RuntimeError – If there is a problem importing the file.
TypeError – If path cannot be converted to a pathlib.Path object.
- export_maptekobj(object_id, path)
Export an object to a Maptek Object file (maptekobj).
Unlike 00t and bmf any object (even containers) can be exported to a maptekobj file.
- Parameters
object_id (ObjectID[DataObject]) – The ID of the object to export.
path (str | pathlib.Path) – Where to save the maptekobj file.
- Returns
True if the export was a success. This never returns false - if the import fails an exception will be raised.
- Return type
bool
- Raises
RuntimeError – If there was a problem exporting the file.
Notes
Changed in version 1.4 - This function no longer returns a value. Prior to 1.4, this would return True on success and raise an exception on failure (It could never return False).