:class:`VTKConverter` ===================== .. py:class:: ansys.tools.visualization_interface.backends.usd.vtk_converter.VTKConverter Convert VTK files to USD format for visualization. .. !! processed by numpydoc !! .. py:currentmodule:: VTKConverter Overview -------- .. tab-set:: .. tab-item:: Methods .. list-table:: :header-rows: 0 :widths: auto * - :py:attr:`~load_asset` - Load a VTK asset into a given stage. .. tab-item:: Static methods .. list-table:: :header-rows: 0 :widths: auto * - :py:attr:`~convert_vtk_file_to_usd` - Convert a VTK file to a USD file. * - :py:attr:`~convert_vtk_to_usd` - Convert a VTK file to a USD stage. * - :py:attr:`~get_vtk_reader` - Get the appropriate VTK reader based on the file extension. * - :py:attr:`~convert_polydata_to_usd_mesh` - Convert VTK polydata to USD mesh geometry. * - :py:attr:`~convert_usd_to_vtk` - Convert a USD mesh to VTK polydata. Import detail ------------- .. code-block:: python from ansys.tools.visualization_interface.backends.usd.vtk_converter import VTKConverter Method detail ------------- .. py:method:: convert_vtk_file_to_usd(vtk_file_path: Union[str, pathlib.Path], stage: pxr.Usd.Stage = None) -> None :staticmethod: Convert a VTK file to a USD file. :Parameters: **vtk_file_path** : :obj:`Union`\[:class:`python:str`, :obj:`Path`] Path to the VTK file to convert. **stage** : :obj:`Usd.Stage` Stage to add the converted USD data to. .. !! processed by numpydoc !! .. py:method:: convert_vtk_to_usd(data: vtk.vtkDataSet, stage: pxr.Usd.Stage = None, mesh_name: str = 'VTKMesh') -> pxr.Usd.Stage :staticmethod: Convert a VTK file to a USD stage. :Parameters: **vtk_file_path** : :obj:`Union`\[:class:`python:str`, :obj:`Path`] Path to the VTK file to convert. **stage** : :obj:`Usd.Stage` Stage to add the VTK data to. :Returns: :obj:`Usd.Stage` Stage containing the VTK data. .. !! processed by numpydoc !! .. py:method:: get_vtk_reader(file_path: pathlib.Path) -> vtk.vtkAlgorithm :staticmethod: Get the appropriate VTK reader based on the file extension. :Parameters: **file_path** : :obj:`Path` Path to the VTK file. .. !! processed by numpydoc !! .. py:method:: convert_polydata_to_usd_mesh(polydata: vtk.vtkPolyData, stage: pxr.Usd.Stage = None, mesh_name: str = 'VTKMesh') -> None :staticmethod: Convert VTK polydata to USD mesh geometry. :Parameters: **polydata** : :obj:`vtk.vtkPolyData` VTK polydata to convert. **stage** : :obj:`Usd.Stage` USD stage to add the mesh to. **mesh_name** : :class:`python:str`, default: ``"VTKMesh"`` Name of the mesh in USD. .. !! processed by numpydoc !! .. py:method:: convert_usd_to_vtk(stage: pxr.Usd.Stage, mesh_path: Optional[str] = None) -> Optional[vtk.vtkPolyData] :staticmethod: Convert a USD mesh to VTK polydata. :Parameters: **stage** : :obj:`Usd.Stage` USD stage containing the mesh. **mesh_path** : :class:`python:str`, default: :data:`python:None` Path to the mesh in USD. If ``None``, the first mesh in the stage is used. :Returns: :obj:`Optional`\[:obj:`vtk.vtkPolyData`] Converted VTK polydata or ``None`` if conversion failed. .. !! processed by numpydoc !! .. py:method:: load_asset(asset_path: str, stage: pxr.Usd.Stage) -> Optional[pxr.Usd.Stage] Load a VTK asset into a given stage. :Parameters: **asset_path** : :class:`python:str` Path to the asset file. **stage** : :obj:`Usd.Stage` Stage to add the asset to. :Returns: :obj:`Optional`\[:obj:`Usd.Stage`] Stage with the loaded asset or ``None`` if loading failed. .. !! processed by numpydoc !!