.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/00-basic/00-launch-visor.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_00-basic_00-launch-visor.py: .. _ref_launch_visor: Launch VISOR ============ To launch the VISOR visualization, instantiate the viewer and call the ``start`` method with a file name or a ``vtkDataSet`` object. This example shows how to run VISOR in a Jupyter notebook. It creates a VISOR visualizer on the default port (8081) and views it in an iframe. If you are not using a Jupyter notebook, the VISOR server is viewable in a new browser tab. Note that the VISOR server runs in a background threads, so the main thread is free to continue executing other code. .. GENERATED FROM PYTHON SOURCE LINES 20-59 .. code-block:: Python from IPython.display import IFrame from ansys.visor.viewer import Visor # Define paths to two different assets asset_path1 = '../../examples/assets/vtk_scene_sphere_l2_b3_r32_v3_c1_z0.vtm' asset_path2 = '../../examples/assets/tensors9.vtp' # Instantiate a VISOR visualizer on port 8081. visor = Visor(url='http://localhost:8081') # Start the visualizer server in the background using the first asset visor.start(asset_path1) # VISOR starts a server and opens a browser window to visualize the data. # The server runs in the background until visualizer.stop() is called or the main process is stopped. # In a Jupyter notebook, the VISOR server stops when the kernel is restarted or stopped. # View the visualizer inline (if in a Jupyter Notebook) IFrame(src='http://localhost:8081', width=1200, height=600) # Update the visualizer with the second asset visor.update(asset_path2) # Print information about the visualizer instance visor.info() # {'app_name': 'VISOR Viewer', # 'host': 'localhost', # 'port': 8081, # 'standalone': True, # 'file_input_path': '../../examples/assets/tensors9.vtp', # 'metadata': None} # Stop the first VISOR instance visor.stop() .. _sphx_glr_download_examples_00-basic_00-launch-visor.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 00-launch-visor.ipynb <00-launch-visor.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 00-launch-visor.py <00-launch-visor.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 00-launch-visor.zip <00-launch-visor.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_