generated from ansys/template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Mario Ostieri <[email protected]> Co-authored-by: Mario Ostieri <[email protected]>
- Loading branch information
1 parent
e7e2dcb
commit bc75539
Showing
40 changed files
with
1,706 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
*.so | ||
*.o | ||
*.cache | ||
*.whl | ||
.pytest_cache/ | ||
*/__pycache__ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,97 @@ | ||
.. _omniverse_info: | ||
|
||
BETA: Omniverse Interface | ||
========================= | ||
PyEnSight/ANSYS Omniverse Interface | ||
=================================== | ||
|
||
This release of PyEnSight includes a technical preview of an interface | ||
to export the surfaces in the current EnSight scene to an Omniverse | ||
server. This functionality is was developed against the "203" (2023.x) | ||
version of Omniverse. Other versions may or may not work. The interface | ||
supports EnSight 2023 R2 or later. | ||
This release of PyEnSight includes an interface to export the surfaces | ||
in the current EnSight scene to an Omniverse server. This functionality | ||
is was developed against the "203" (2023.x) version of Omniverse. Other | ||
versions may or may not work. The interface supports EnSight 2023 R2 | ||
or later. | ||
|
||
Python Interpreter Configuration | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
To use this functionality, an installation of Omniverse is required | ||
and the PyEnSight module must be used from within an Omniverse | ||
Python interpreter. In most cases, the script editor in the USD | ||
Composer application. To install PyEnSight into the Composer Python | ||
interpreter the following script can be run in the embedded script | ||
editor (``Windows->Script Editor`` menu): | ||
|
||
.. code-block:: | ||
import omni.kit.pipapi | ||
omni.kit.pipapi.install("ansys-pyensight-core") | ||
It is also possible to install the module using the command line. | ||
To do this, one needs to find the installation location of the target | ||
tool. Looking at the settings for "Create": | ||
The API is available through a PyEnSight session instance, from EnSight | ||
Python directly as (ensight.utils.omniverse for 2025 R1 and later) and | ||
from within Omniverse applications via the ansys.geometry.service and | ||
ansys.geometry.serviceui kit extensions. | ||
|
||
.. image:: /_static/omniverse_create_location.png | ||
The Python API is defined here: :class:`Omniverse<ansys.pyensight.core.utils.omniverse.Omniverse>`. | ||
|
||
the install path can be found in the Omniverse GUI and the following | ||
may be run: | ||
|
||
.. code-block:: shell | ||
Omniverse System Configuration | ||
------------------------------ | ||
|
||
cd C:\Users\sampleuser\AppData\Local\ov\pkg\create-2023.2.5 | ||
kit\python.bat -m pip install ansys-pyensight-core | ||
To use this functionality, a local installation of Omniverse is required. | ||
Install Omniverse along with one application like "Create" or "View" on | ||
your local system. | ||
|
||
|
||
to install pyensight. | ||
|
||
Basic Example | ||
^^^^^^^^^^^^^ | ||
PyEnSight and EnSight Python API | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
The following can be run from inside the USD Composer script panel following | ||
the previous install. It can also be executed by the ``kit\python.bat`` | ||
interpreter, same as the one used during the configuration step. | ||
It assumes there is a local Nucleus server running that can be accessed | ||
via the URI: ``omniverse://localhost/Users/water``. | ||
The ``omniverse`` pyensight module will look for and leverage locally installed | ||
Omniverse to provide its APIs. If you are using the | ||
`ansys-pyensight-core <https://pypi.org/project/ansys-pyensight-core/>`_ module | ||
in your own python, one can just use the API like this: | ||
|
||
.. code-block:: python | ||
from ansys.pyensight.core import LocalLauncher | ||
s = LocalLauncher(batch=False).start() | ||
s.load_example("waterbreak.ens") | ||
# Start a new connection between EnSight and Omniverse | ||
uri = "omniverse://localhost/Users/water" | ||
s.ensight.utils.omniverse.create_connection(uri) | ||
# Do some more work... | ||
# Push a scene update | ||
s.ensight.utils.omniverse.update() | ||
From inside an EnSight session, the API is similar: | ||
|
||
.. code-block:: python | ||
After running the script, scene will appear in the Nucleus tree view as ``User/water``. | ||
The file ``dsg_scene.usd`` can be loaded into Composer. The | ||
# Start a DSG server in EnSight first | ||
(_, grpc_port, security) = ensight.objs.core.grpc_server(port=0, start=True) | ||
# Start a new connection between the EnSight DSG server and Omniverse | ||
options = {"host": "127.0.0.1", "port": str(grpc_port)} | ||
if security: | ||
options["security"] = security | ||
uri = "omniverse://localhost/Users/water" | ||
ensight.utils.omniverse.create_connection(uri, options=options) | ||
# Do some more work... | ||
# Push a scene update | ||
ensight.utils.omniverse.update() | ||
After running the script, the scene will appear in the Nucleus tree view as | ||
``User/water``. The file ``dsg_scene.usd`` can be loaded into Composer. The | ||
``s.ensight.utils.omniverse.update()`` command can be used to update the | ||
USD data in Omniverse, reflecting any recent changes in the EnSight scene. | ||
|
||
|
||
Within an Omniverse Application | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
To install the service (and the pyensight module) into an Omniverse | ||
application, one can install is via the third party extensions dialog. | ||
Select the ``Extensions`` option from the ``Window`` menu. Select | ||
third party extensions and filter by ``ANSYS``. Enabling the extension | ||
will install it, along with the ansys.pyensight.core module. | ||
|
||
.. image:: /_static/omniverse_extension.png | ||
|
||
At this point, the same pyensight script can be used to connect to | ||
an EnSight session or the GUI panel can be used to connect to a | ||
copy of EnSight that was launched with the ``-grpc_server {port}`` | ||
option specified. | ||
|
||
|
||
.. note:: | ||
|
||
The ``batch=False`` option cause the EnSight GUI to be displayed | ||
together with the Omniverse Composer GUI. Also, care must be taken | ||
to close the EnSight session before exiting Composer or is it possible | ||
to leave the EnSight instance running. | ||
The ``batch=False`` option used in the examples causes the EnSight | ||
GUI to be displayed together with the Omniverse Composer GUI. | ||
|
||
Also, care must be taken to close the EnSight session before | ||
exiting an Omniverse application hosting a pyensight session or is | ||
it possible to leave the EnSight instance running. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .extension import * |
Oops, something went wrong.