Wrapper
This module provides a wrapper that will work for any OMF data object or project files.
Example Use
Use the wrapper provided in omfvista
to wrap any omf
data object:
import omfvista
omfvista.wrap(data)
Here’s an example using the sample data hosted in the OMF repository.
import omf
import omfvista
# Read all elements
reader = omf.OMFReader('test_file.omf')
project = reader.get_project()
# Iterate over the elements and add converted VTK objects to dictionary:
data = dict()
for e in project.elements:
d = omfvista.wrap(e)
data[e.name] = d
Or better yet, just use the project loader:
import omfvista
data = omfvista.load_project('test_file.omf')
Load Project File
- omfvista.wrapper.load_project(filename, load_textures=False)[source]
Loads an OMF project file into a
pyvista.MultiBlock
dataset
Project to VTK
- omfvista.wrapper.project_to_vtk(project, load_textures=False)[source]
Converts an OMF project (
omf.base.Project
) to apyvista.MultiBlock
data boject
The Wrapper
- omfvista.wrapper.wrap(data, origin=(0.0, 0.0, 0.0))[source]
Wraps the OMF data object/project as a VTK data object. This is the primary function that an end user will harness.
- Args:
data: any OMF data object
- Example:
>>> import omf >>> import omfvista
>>> # Read all elements >>> reader = omf.OMFReader('test_file.omf') >>> project = reader.get_project()
>>> # Iterate over the elements and add converted VTK objects to dictionary: >>> data = dict() >>> for e in project.elements: >>> d = omfvista.wrap(e) >>> data[e.name] = d