From aa8ab22ff6189fdc3b2c557a394072562c0bd240 Mon Sep 17 00:00:00 2001 From: Ninad Kamat Date: Mon, 6 Nov 2023 23:35:09 -0600 Subject: [PATCH] Update server APIs for dev10 (#645) --- .github/workflows/ci_cd.yml | 2 +- pyproject.toml | 2 +- .../meshing/prime/autogen/fileiostructs.py | 49 ++++++++++++++++--- .../meshing/prime/autogen/primeconfig.py | 2 + .../meshing/prime/internals/error_handling.py | 1 + 5 files changed, 47 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 5ad3f7a494..925ad13288 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -15,7 +15,7 @@ on: env: DOCKER_IMAGE_NAME: ghcr.io/ansys/prime - DOCKER_IMAGE_TAG: '24.1.0.dev9' + DOCKER_IMAGE_TAG: '24.1.0.dev10' MAIN_PYTHON_VERSION: '3.9' PACKAGE_NAME: 'ansys-meshing-prime' PACKAGE_NAMESPACE: 'ansys.meshing.prime' diff --git a/pyproject.toml b/pyproject.toml index 74608f5824..37caa2c81a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi" [project] name = "ansys-meshing-prime" -version = "0.5.0.dev9" +version = "0.5.0.dev10" description = "PyPrimeMesh is a Python client to Ansys Prime Server, which delivers core Ansys meshing technology." readme = "README.md" requires-python = ">=3.8,<4" diff --git a/src/ansys/meshing/prime/autogen/fileiostructs.py b/src/ansys/meshing/prime/autogen/fileiostructs.py index 8c2edeb7d9..ffbe3f94e7 100644 --- a/src/ansys/meshing/prime/autogen/fileiostructs.py +++ b/src/ansys/meshing/prime/autogen/fileiostructs.py @@ -500,13 +500,16 @@ class FileWriteResults(CoreObject): def __initialize( self, - error_code: ErrorCode): + error_code: ErrorCode, + warning_codes: List[WarningCode]): self._error_code = ErrorCode(error_code) + self._warning_codes = warning_codes def __init__( self, model: CommunicationManager=None, error_code: ErrorCode = None, + warning_codes: List[WarningCode] = None, json_data : dict = None, **kwargs): """Initializes the FileWriteResults. @@ -517,6 +520,8 @@ def __init__( Model to create a FileWriteResults object with default parameters. error_code: ErrorCode, optional Error code if file write operation is unsuccessful. + warning_codes: List[WarningCode], optional + Warning codes associated with the file write operation. json_data: dict, optional JSON dictionary to create a FileWriteResults object with provided parameters. @@ -526,12 +531,14 @@ def __init__( """ if json_data: self.__initialize( - ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None)) + ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None), + [WarningCode(data) for data in json_data["warningCodes"]] if "warningCodes" in json_data else None) else: - all_field_specified = all(arg is not None for arg in [error_code]) + all_field_specified = all(arg is not None for arg in [error_code, warning_codes]) if all_field_specified: self.__initialize( - error_code) + error_code, + warning_codes) else: if model is None: raise ValueError("Invalid assignment. Either pass model or specify all properties") @@ -539,7 +546,8 @@ def __init__( param_json = model._communicator.initialize_params(model, "FileWriteResults") json_data = param_json["FileWriteResults"] if "FileWriteResults" in param_json else {} self.__initialize( - error_code if error_code is not None else ( FileWriteResults._default_params["error_code"] if "error_code" in FileWriteResults._default_params else ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None))) + error_code if error_code is not None else ( FileWriteResults._default_params["error_code"] if "error_code" in FileWriteResults._default_params else ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None)), + warning_codes if warning_codes is not None else ( FileWriteResults._default_params["warning_codes"] if "warning_codes" in FileWriteResults._default_params else [WarningCode(data) for data in (json_data["warningCodes"] if "warningCodes" in json_data else None)])) self._custom_params = kwargs if model is not None: [ model._logger.warning(f'Unsupported argument : {key}') for key in kwargs ] @@ -549,13 +557,16 @@ def __init__( @staticmethod def set_default( - error_code: ErrorCode = None): + error_code: ErrorCode = None, + warning_codes: List[WarningCode] = None): """Set the default values of FileWriteResults. Parameters ---------- error_code: ErrorCode, optional Error code if file write operation is unsuccessful. + warning_codes: List[WarningCode], optional + Warning codes associated with the file write operation. """ args = locals() [FileWriteResults._default_params.update({ key: value }) for key, value in args.items() if value is not None] @@ -576,11 +587,13 @@ def _jsonify(self) -> Dict[str, Any]: json_data = {} if self._error_code is not None: json_data["errorCode"] = self._error_code + if self._warning_codes is not None: + json_data["warningCodes"] = [data for data in self._warning_codes] [ json_data.update({ utils.to_camel_case(key) : value }) for key, value in self._custom_params.items()] return json_data def __str__(self) -> str: - message = "error_code : %s" % (self._error_code) + message = "error_code : %s\nwarning_codes : %s" % (self._error_code, '[' + ''.join('\n' + str(data) for data in self._warning_codes) + ']') message += ''.join('\n' + str(key) + ' : ' + str(value) for key, value in self._custom_params.items()) return message @@ -594,6 +607,16 @@ def error_code(self) -> ErrorCode: def error_code(self, value: ErrorCode): self._error_code = value + @property + def warning_codes(self) -> List[WarningCode]: + """Warning codes associated with the file write operation. + """ + return self._warning_codes + + @warning_codes.setter + def warning_codes(self, value: List[WarningCode]): + self._warning_codes = value + class ReadSizeFieldParams(CoreObject): """Parameters used to read size field file. """ @@ -2460,16 +2483,22 @@ def __init__( Model to create a ExportMapdlCdbParams object with default parameters. material_properties: str, optional Materials in CDB format that will be added to the file. + This parameter is a Beta. Parameter behavior and name may change in future. boundary_conditions: str, optional Boundary conditions in CDB format that will be appended to the file. + This parameter is a Beta. Parameter behavior and name may change in future. write_cells: bool, optional Option to write out cells as part of the file. + This parameter is a Beta. Parameter behavior and name may change in future. enable_face_based_labels: bool, optional Option to write element components for labels. + This parameter is a Beta. Parameter behavior and name may change in future. write_by_zones: bool, optional Option to write zones in the file. + This parameter is a Beta. Parameter behavior and name may change in future. simulation_type: CdbSimulationType, optional Simulation type for the file. + This parameter is a Beta. Parameter behavior and name may change in future. json_data: dict, optional JSON dictionary to create a ExportMapdlCdbParams object with provided parameters. @@ -2580,6 +2609,7 @@ def __str__(self) -> str: @property def material_properties(self) -> str: """Materials in CDB format that will be added to the file. + This parameter is a Beta. Parameter behavior and name may change in future. """ return self._material_properties @@ -2590,6 +2620,7 @@ def material_properties(self, value: str): @property def boundary_conditions(self) -> str: """Boundary conditions in CDB format that will be appended to the file. + This parameter is a Beta. Parameter behavior and name may change in future. """ return self._boundary_conditions @@ -2600,6 +2631,7 @@ def boundary_conditions(self, value: str): @property def write_cells(self) -> bool: """Option to write out cells as part of the file. + This parameter is a Beta. Parameter behavior and name may change in future. """ return self._write_cells @@ -2610,6 +2642,7 @@ def write_cells(self, value: bool): @property def enable_face_based_labels(self) -> bool: """Option to write element components for labels. + This parameter is a Beta. Parameter behavior and name may change in future. """ return self._enable_face_based_labels @@ -2620,6 +2653,7 @@ def enable_face_based_labels(self, value: bool): @property def write_by_zones(self) -> bool: """Option to write zones in the file. + This parameter is a Beta. Parameter behavior and name may change in future. """ return self._write_by_zones @@ -2630,6 +2664,7 @@ def write_by_zones(self, value: bool): @property def simulation_type(self) -> CdbSimulationType: """Simulation type for the file. + This parameter is a Beta. Parameter behavior and name may change in future. """ return self._simulation_type diff --git a/src/ansys/meshing/prime/autogen/primeconfig.py b/src/ansys/meshing/prime/autogen/primeconfig.py index d797377cd7..66dde30c12 100644 --- a/src/ansys/meshing/prime/autogen/primeconfig.py +++ b/src/ansys/meshing/prime/autogen/primeconfig.py @@ -660,6 +660,8 @@ class WarningCode(enum.IntEnum): """Maximum value of min aspect ratio from selected prism controls is considered for all selected prism controls.""" PARTNOTINPARTSCOPE = 601 """Selected part is not in the part scope of the periodic control.""" + NUMERICPARTNAMERENAMETOALPHANUMERIC = 701 + """Numeric part name renamed to alphanumeric name.""" SURFERLAYEREDQUADFAILED = 1800 """Layered quad failed with surfer.""" SURFERDEGENERATEFACE = 1801 diff --git a/src/ansys/meshing/prime/internals/error_handling.py b/src/ansys/meshing/prime/internals/error_handling.py index ab840eacec..8602f841db 100644 --- a/src/ansys/meshing/prime/internals/error_handling.py +++ b/src/ansys/meshing/prime/internals/error_handling.py @@ -324,6 +324,7 @@ WarningCode.OVERRIDEVOLUMESCOPEENTITY: "Invalid volume scope entity, override by volume.", WarningCode.MAXOFPRISMCONTROLSMINASPECTRATIO: "Maximum value of min aspect ratio from selected prism controls is considered for all selected prism controls.", WarningCode.PARTNOTINPARTSCOPE: "The selected part is not in the part scope of the periodic control.", + WarningCode.NUMERICPARTNAMERENAMETOALPHANUMERIC: "Numeric part name renamed to alphanumeric name.", WarningCode.OVERRIDESUGGESTEDNAME: "Given name not available. Overriding it with unique name.", WarningCode.WRAPPER_SIZECONTROLNOTDEFINED: "No size controls provided for wrapper. Global sizes will be used.", WarningCode.WRAPPER_SIZECONTROLNOTSUPPORTED: "Size control is not supported in wrapper. Skipping it.",