diff --git a/src/ansys/pyensight/core/renderable.py b/src/ansys/pyensight/core/renderable.py index bc107ebadf5..b79d9e5e4c2 100644 --- a/src/ansys/pyensight/core/renderable.py +++ b/src/ansys/pyensight/core/renderable.py @@ -5,7 +5,7 @@ """ import os import shutil -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, no_type_check +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union, no_type_check import uuid import webbrowser @@ -15,6 +15,12 @@ from ansys.pyensight.core import Session +def _get_ansysnexus_version(version: Union[int, str]) -> str: + if int(version) < 242: + return "" + return str(version) + + class Renderable: """Generates HTML pages for renderable entities. @@ -510,14 +516,15 @@ def update(self): # Save the file self._session.ensight.savegeom.save_geometric_entities(self._avz_pathname) # generate HTML page with file references local to the websocket server root + version = _get_ansysnexus_version(self._session._cei_suffix) if self._using_proxy: # if using pim we get the static content from the front end and not # where ensight is running, thus we use a specific URI host and not relative. - html = f"\n" + html = f"\n" html += f"\n" else: - html = "\n" + html = f"\n" html += f"\n" # refresh the remote HTML self._save_remote_html_page(html) @@ -541,8 +548,8 @@ def update(self): """ optional_query = self._get_query_parameters_str() - - html = f"\n" + version = _get_ansysnexus_version(self._session._cei_suffix) + html = f"\n" rest_uri = ( f"{self._http_protocol}://{self._session.html_hostname}:{self._session.html_port}" ) @@ -582,8 +589,9 @@ def __init__(self, *args, **kwargs) -> None: self.update() def update(self): + version = _get_ansysnexus_version(self._session._cei_suffix) url = f"{self._http_protocol}://{self._session.html_hostname}:{self._session.html_port}" - url += "/ansys/nexus/angular/viewer_angular_pyensight.html" + url += f"/ansys{version}/nexus/angular/viewer_angular_pyensight.html" url += self._get_query_parameters_str(self._query_params) self._url = url super().update() @@ -634,8 +642,8 @@ def update(self): # generate HTML page with file references local to the websocketserver root optional_query = self._get_query_parameters_str() - - html = f"\n" + version = _get_ansysnexus_version(self._session._cei_suffix) + html = f"\n" server = f"{self._http_protocol}://{self._session.html_hostname}:{self._session.html_port}" # FIXME: This method doesn't work with Ansys Lab since the viewer seems to require @@ -718,8 +726,8 @@ def update(self): # pragma: no cover attributes += f" proxy_img='/{self._sgeo_base_filename}/proxy.png{self._get_query_parameters_str()}'" attributes += " aspect_ratio='proxy'" attributes += " renderer='sgeo'" - - html = f"\n" + version = _get_ansysnexus_version(self._session._cei_suffix) + html = f"\n" html += f"\n" html += self._periodic_script() # refresh the remote HTML