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:
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.
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[BlockProperties | DataObject]) – The ID of the block model to export as a bmf.
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:
- 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_bdf(path, unit=DistanceUnit.METRE)
Import a block model definition from a bdf file.
- Parameters:
unit (DistanceUnit)
- Returns:
ObjectID[BlockModelDefinition] – Object ID of the imported block model definition. This will not be placed in the project. Use Project.add_object() to set its path in the project.
unit – The unit to read the imported bdf in. This is metres by default.
- Raises:
FileNotFoundError – If the file does not exist or is a directory.
FileCorruptError – If the file is not a bdf file or the file is corrupt.
RuntimeError – If an unknown error occurs.
- Return type:
- export_bdf(oid, path, unit=DistanceUnit.METRE)
Export a block model definition into a bdf file.
- Parameters:
oid (ObjectID[BlockModelDefinition]) – Object ID of the block model definition to export.
path (PathLike | str) – Path to the file to export the block model definition to.
unit (DistanceUnit) – Unit to export the BDF in. This is metres by default.
- Raises:
TypeError – If oid is not a block model definition object.
RuntimeError – If an unknown error occurs.
ValueError – If unit is not supported by the connected application.
- import_maptekobj(path)
Import a Maptek Object file (maptekobj) into the project.
- Parameters:
- 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.
- Returns:
True if the export was a success. This never returns false - if the import fails an exception will be raised.
- Return type:
- 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).