diff --git a/doc/source/_static/omniverse_tool.png b/doc/source/_static/omniverse_tool.png new file mode 100644 index 00000000000..db2aca68d63 Binary files /dev/null and b/doc/source/_static/omniverse_tool.png differ diff --git a/doc/source/user_guide/omniverse_info.rst b/doc/source/user_guide/omniverse_info.rst index 4b438866a32..ee360ea7933 100644 --- a/doc/source/user_guide/omniverse_info.rst +++ b/doc/source/user_guide/omniverse_info.rst @@ -21,8 +21,9 @@ Omniverse System Configuration ------------------------------ 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. +Please `install Omniverse `_ along +with one application like "Create" or "View" on your local system before +attempting to use this interface. PyEnSight and EnSight Python API @@ -46,6 +47,16 @@ in your own python, one can just use the API like this: s.ensight.utils.omniverse.update() +.. note:: + + 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. + + From inside an EnSight session, the API is similar: .. code-block:: python @@ -65,12 +76,22 @@ From inside an EnSight session, the API is similar: 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 +``ensight.utils.omniverse.update()`` command can be used to update the USD data in Omniverse, reflecting any recent changes in the EnSight scene. +Starting with 2025 R1, one can also access Omniverse via an EnSight +user-defined tool: -Within an Omniverse Application -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. image:: /_static/omniverse_tool.png + +This tool will only be available if EnSight detects an installed copy +of Omniverse. Clicking on "Connect to Omniverse" executes something +similar to the previous Python snippet and the button will change to +a mode where it just executes ``ensight.utils.omniverse.update()``. + + +PyEnSight/Omniverse kit from 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. @@ -80,18 +101,88 @@ 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 +At this point, the same pyensight script run in the Omniverse +``Script Editor`` panel 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. +The ``ansys.geometry.serviceui`` kit includes a GUI similar to the +EnSight 2025 R1 user-defined tool. It allows one to select a +target URI in Omniverse and the details of a gRPC connection +to a running EnSight. For example, if one launches EnSight with +``ensight.bat -grpc_server 2345``, then the uri: ``grpc://127.0.0.1:2345`` +can to used to request a locally running EnSight to push the current +scene to Omniverse. .. note:: - The ``batch=False`` option used in the examples causes the EnSight - GUI to be displayed together with the Omniverse Composer GUI. + If the ``ansys.geometry.service`` and ``ansys.geometry.serviceui`` + do not show up in the Community extensions list in Omniverse, then + it can be added to the ``Extension Search Paths`` list as: + ``git://github.com/ansys/pyensight.git?branch=main&dir=exts``. - 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. + +Developers: Running a "dev" build from the Command Line +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Omniverse kits can be run as command line tools and +the ``ansys.geometry.service`` is designed to support this mode +of operation as well. For this to work, one needs a copy of the +pyensight wheel and the name of a ``kit`` executable. The pyensight wheel +can be built by checking out the repo and building it. One can +find the location of a kit via the ``Omniverse Launcher`` application +using the ``Settings`` option: + +.. image:: /_static/omniverse_create_location.png + +Consider an example where the create app has been installed and the +file ``C:\Users\me\AppData\Local\ov\pkg\create-2023.2.5\kit.bat`` +exists. A copy of the pyensight repo is located and built here: +``D:\repos\pyensight``. With these conditions, one can run the extension +from the command line like this: + +.. code-block:: bat + + cd "C:\Users\me\AppData\Local\ov\pkg\create-2023.2.5" + .\kit.bat --ext-folder "D:\repos\pyensight\exts" --enable ansys.geometry.service --/exts/ansys.geometry.service/help=1 + + +Will generate the following output in the logs: + +.. code-block:: + + ANSYS Omniverse Geometry Service: ansys.geometry.service-0.8.5 + --/exts/ansys.geometry.service/help=1 + Display this help. + --/exts/ansys.geometry.service/run=1 + Run the server. + --/exts/ansys.geometry.service/omniUrl=URL + Omniverse pathname. (default: omniverse://localhost/Users/test) + --/exts/ansys.geometry.service/dsgUrl=URL + Dynamic Scene Graph connection URL. (default: grpc://127.0.0.1:5234) + --/exts/ansys.geometry.service/securityCode=TOKEN + Dynamic Scene Graph security token. (default: ) + --/exts/ansys.geometry.service/temporal=0|1 + If non-zero, include all timeseteps in the scene. (default: False) + --/exts/ansys.geometry.service/vrmode=0|1 + If non-zero, do not include a camera in the scene. (default: False) + --/exts/ansys.geometry.service/normalizeGeometry=0|1 + If non-zero, remap the geometry to the domain [-1,-1,-1]-[1,1,1]. (default: False) + + +Documenting the various kit command line options. Using the ``run=1`` option will launch the server from +from the command line. This version of the service will be run using the version of the pyensight wheel +installed in the specified ``--ext-folder``. When run as above, the service will use the +latest release of the ansys.pyensight.core wheel. If a local build is located here: +``D:\repos\pyensight\dist\ansys_pyensight_core-0.9.0.dev0-py3-none-any.whl`` it can be +used in the above kit by installing it into the Omniverse kit Python: + + +.. code-block:: bat + + .\kit\python.bat -m pip install D:\repos\pyensight\dist\ansys_pyensight_core-0.9.0.dev0-py3-none-any.whl + + +This version will be used instead of the older version in the PyPi repository. diff --git a/exts/ansys.geometry.service/ansys/geometry/service/extension.py b/exts/ansys.geometry.service/ansys/geometry/service/extension.py index f991ea49176..d8b5ebfbe56 100644 --- a/exts/ansys.geometry.service/ansys/geometry/service/extension.py +++ b/exts/ansys.geometry.service/ansys/geometry/service/extension.py @@ -331,7 +331,7 @@ def launch_server(self) -> None: cmd.extend(["--ext-folder", kit_dir]) cmd.extend(["--enable", "ansys.geometry.service"]) if self.security_token: - cmd.append(f"--/exts/ansys.geometry.service/securityCode={self.security_token}") + cmd.append(f'--/exts/ansys.geometry.service/securityCode="{self.security_token}"') if self.temporal: cmd.append("--/exts/ansys.geometry.service/temporal=1") if self.vrmode: diff --git a/exts/ansys.geometry.service/config/extension.toml b/exts/ansys.geometry.service/config/extension.toml index 0fe8d34a340..751305152fd 100644 --- a/exts/ansys.geometry.service/config/extension.toml +++ b/exts/ansys.geometry.service/config/extension.toml @@ -1,6 +1,6 @@ [package] # Semantic Versioning is used: https://semver.org/ -version = "0.8.6" +version = "0.8.7" # Lists people or organizations that are considered the "authors" of the package. authors = ["ANSYS"] diff --git a/exts/ansys.geometry.service/docs/CHANGELOG.md b/exts/ansys.geometry.service/docs/CHANGELOG.md index 96fc5462ec7..2abc3e1bc6a 100644 --- a/exts/ansys.geometry.service/docs/CHANGELOG.md +++ b/exts/ansys.geometry.service/docs/CHANGELOG.md @@ -3,6 +3,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [0.9.0] - 2024-06-28 +## [0.8.7] - 2024-07-12 +- Support for time varying data and temporal scaling + +## [0.8.4] - 2024-06-28 - Initial kit version of ANSYS Geometry Service Server diff --git a/exts/ansys.geometry.serviceui/config/extension.toml b/exts/ansys.geometry.serviceui/config/extension.toml index b4805b13f3b..bb506207f9e 100644 --- a/exts/ansys.geometry.serviceui/config/extension.toml +++ b/exts/ansys.geometry.serviceui/config/extension.toml @@ -1,6 +1,6 @@ [package] # Semantic Versioning is used: https://semver.org/ -version = "0.8.6" +version = "0.8.7" # Lists people or organizations that are considered the "authors" of the package. authors = ["ANSYS"] diff --git a/exts/ansys.geometry.serviceui/docs/CHANGELOG.md b/exts/ansys.geometry.serviceui/docs/CHANGELOG.md index 19eba7173c2..2abc3e1bc6a 100644 --- a/exts/ansys.geometry.serviceui/docs/CHANGELOG.md +++ b/exts/ansys.geometry.serviceui/docs/CHANGELOG.md @@ -3,6 +3,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [0.9.0] - 2024-06-28 -- Initial kit version of ANSYS Geometry Service GUI +## [0.8.7] - 2024-07-12 +- Support for time varying data and temporal scaling + +## [0.8.4] - 2024-06-28 +- Initial kit version of ANSYS Geometry Service Server diff --git a/src/ansys/pyensight/core/exts/ansys.geometry.service/ansys/geometry/service/extension.py b/src/ansys/pyensight/core/exts/ansys.geometry.service/ansys/geometry/service/extension.py index f991ea49176..d8b5ebfbe56 100644 --- a/src/ansys/pyensight/core/exts/ansys.geometry.service/ansys/geometry/service/extension.py +++ b/src/ansys/pyensight/core/exts/ansys.geometry.service/ansys/geometry/service/extension.py @@ -331,7 +331,7 @@ def launch_server(self) -> None: cmd.extend(["--ext-folder", kit_dir]) cmd.extend(["--enable", "ansys.geometry.service"]) if self.security_token: - cmd.append(f"--/exts/ansys.geometry.service/securityCode={self.security_token}") + cmd.append(f'--/exts/ansys.geometry.service/securityCode="{self.security_token}"') if self.temporal: cmd.append("--/exts/ansys.geometry.service/temporal=1") if self.vrmode: diff --git a/src/ansys/pyensight/core/exts/ansys.geometry.service/config/extension.toml b/src/ansys/pyensight/core/exts/ansys.geometry.service/config/extension.toml index 0fe8d34a340..751305152fd 100644 --- a/src/ansys/pyensight/core/exts/ansys.geometry.service/config/extension.toml +++ b/src/ansys/pyensight/core/exts/ansys.geometry.service/config/extension.toml @@ -1,6 +1,6 @@ [package] # Semantic Versioning is used: https://semver.org/ -version = "0.8.6" +version = "0.8.7" # Lists people or organizations that are considered the "authors" of the package. authors = ["ANSYS"] diff --git a/src/ansys/pyensight/core/exts/ansys.geometry.service/docs/CHANGELOG.md b/src/ansys/pyensight/core/exts/ansys.geometry.service/docs/CHANGELOG.md index 96fc5462ec7..2abc3e1bc6a 100644 --- a/src/ansys/pyensight/core/exts/ansys.geometry.service/docs/CHANGELOG.md +++ b/src/ansys/pyensight/core/exts/ansys.geometry.service/docs/CHANGELOG.md @@ -3,6 +3,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [0.9.0] - 2024-06-28 +## [0.8.7] - 2024-07-12 +- Support for time varying data and temporal scaling + +## [0.8.4] - 2024-06-28 - Initial kit version of ANSYS Geometry Service Server diff --git a/src/ansys/pyensight/core/exts/ansys.geometry.serviceui/config/extension.toml b/src/ansys/pyensight/core/exts/ansys.geometry.serviceui/config/extension.toml index b4805b13f3b..bb506207f9e 100644 --- a/src/ansys/pyensight/core/exts/ansys.geometry.serviceui/config/extension.toml +++ b/src/ansys/pyensight/core/exts/ansys.geometry.serviceui/config/extension.toml @@ -1,6 +1,6 @@ [package] # Semantic Versioning is used: https://semver.org/ -version = "0.8.6" +version = "0.8.7" # Lists people or organizations that are considered the "authors" of the package. authors = ["ANSYS"] diff --git a/src/ansys/pyensight/core/exts/ansys.geometry.serviceui/docs/CHANGELOG.md b/src/ansys/pyensight/core/exts/ansys.geometry.serviceui/docs/CHANGELOG.md index 19eba7173c2..2abc3e1bc6a 100644 --- a/src/ansys/pyensight/core/exts/ansys.geometry.serviceui/docs/CHANGELOG.md +++ b/src/ansys/pyensight/core/exts/ansys.geometry.serviceui/docs/CHANGELOG.md @@ -3,6 +3,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [0.9.0] - 2024-06-28 -- Initial kit version of ANSYS Geometry Service GUI +## [0.8.7] - 2024-07-12 +- Support for time varying data and temporal scaling + +## [0.8.4] - 2024-06-28 +- Initial kit version of ANSYS Geometry Service Server diff --git a/src/ansys/pyensight/core/utils/omniverse.py b/src/ansys/pyensight/core/utils/omniverse.py index 08106b43799..0ec38501402 100644 --- a/src/ansys/pyensight/core/utils/omniverse.py +++ b/src/ansys/pyensight/core/utils/omniverse.py @@ -173,6 +173,7 @@ def create_connection( temporal: bool = False, live: bool = True, debug_filename: str = "", + time_scale: float = 1.0, options: dict = {}, ) -> None: """Ensure that an EnSight dsg -> omniverse server is running @@ -200,9 +201,13 @@ def create_connection( If True, one can call 'update()' to send updated geometry to Omniverse. If False, the Omniverse connection will push a single update and then disconnect. Defaults to True. + time_scale : float + Multiply all EnSight time values by this factor before exporting to Omniverse. + The default is 1.0. debug_filename : str If the name of a file is provided, it will be used to save logging information on - the connection between EnSight and Omniverse. + the connection between EnSight and Omniverse. This option is no longer supported, + but the API remains for backwards compatibility. options : dict Allows for a fallback for the grpc host/port and the security token. """ @@ -237,6 +242,8 @@ def create_connection( cmd.append("--/exts/ansys.geometry.service/vrmode=1") if normalize_geometry: cmd.append("--/exts/ansys.geometry.service/normalizeGeometry=1") + if time_scale != 1.0: + cmd.append(f"--/exts/ansys.geometry.service/timeScale={time_scale}") cmd.append(f"--/exts/ansys.geometry.service/omniUrl={omniverse_path}") cmd.append(f"--/exts/ansys.geometry.service/dsgUrl={dsg_uri}") cmd.append("--/exts/ansys.geometry.service/run=1")