.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/00-basic-pyvista-examples/remote_trame_view.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-pyvista-examples_remote_trame_view.py: .. _ref_remote_trame_view: ============================= Use trame as a remote service ============================= This example shows how to launch a trame service and use it as a remote service. First, we need to launch the trame service. We can do this by running the following code:: # import required libraries from ansys.tools.visualization_interface.backends.pyvista.trame_service import ( TrameService, ) # create a trame service, in whatever port is available in your system ts = TrameService(websocket_port=8765) # run the service ts.run() Now, we can send meshes and plotter to the trame service. We can do this by running the following code in a separate terminal:: # import required libraries import time import pyvista as pv from ansys.tools.visualization_interface.backends.pyvista.trame_remote import ( send_mesh, send_pl, ) # create an example plotter plotter = pv.Plotter() plotter.add_mesh(pv.Cube()) # send some example meshes send_mesh(pv.Sphere()) send_mesh(pv.Sphere(center=(3, 0, 0))) time.sleep(4) # if we send a plotter, the previous meshes will be deleted. send_pl(plotter) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.000 seconds) .. _sphx_glr_download_examples_00-basic-pyvista-examples_remote_trame_view.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: remote_trame_view.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: remote_trame_view.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: remote_trame_view.zip `