VTKConverter#
- class ansys.tools.usdviewer.vtk_converter.VTKConverter#
Convert VTK files to USD format for visualization.
Overview#
Load a VTK asset into a given stage. |
Convert a VTK file to a USD file. |
|
Convert a VTK file to a USD stage. |
|
Get the appropriate VTK reader based on the file extension. |
|
Convert VTK polydata to USD mesh geometry. |
|
Convert a USD mesh to VTK polydata. |
Import detail#
from ansys.tools.usdviewer.vtk_converter import VTKConverter
Method detail#
- static VTKConverter.convert_vtk_file_to_usd(vtk_file_path: str | pathlib.Path, stage: pxr.Usd.Stage = None) None#
Convert a VTK file to a USD file.
Parameters#
- vtk_file_pathUnion[str, Path]
Path to the VTK file to convert.
- stageUsd.Stage
Stage to add the converted USD data to.
- static VTKConverter.convert_vtk_to_usd(data: vtk.vtkDataSet, stage: pxr.Usd.Stage = None, mesh_name: str = 'VTKMesh') pxr.Usd.Stage#
Convert a VTK file to a USD stage.
Parameters#
- vtk_file_pathUnion[str, Path]
Path to the VTK file to convert.
- stageUsd.Stage
Stage to add the VTK data to.
Returns#
- Usd.Stage
Stage containing the VTK data.
- static VTKConverter.get_vtk_reader(file_path: pathlib.Path) vtk.vtkAlgorithm#
Get the appropriate VTK reader based on the file extension.
Parameters#
- file_pathPath
Path to the VTK file.
- static VTKConverter.convert_polydata_to_usd_mesh(polydata: vtk.vtkPolyData, stage: pxr.Usd.Stage = None, mesh_name: str = 'VTKMesh') None#
Convert VTK polydata to USD mesh geometry.
Parameters#
- polydatavtk.vtkPolyData
VTK polydata to convert.
- stageUsd.Stage
USD stage to add the mesh to.
- mesh_namestr, default:
"VTKMesh" Name of the mesh in USD.
- static VTKConverter.convert_usd_to_vtk(stage: pxr.Usd.Stage, mesh_path: str | None = None) vtk.vtkPolyData | None#
Convert a USD mesh to VTK polydata.
Parameters#
- stageUsd.Stage
USD stage containing the mesh.
- mesh_pathstr, default: None
Path to the mesh in USD. If
None, the first mesh in the stage is used.
Returns#
- Optional[vtk.vtkPolyData]
Converted VTK polydata or
Noneif conversion failed.