diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 1827c0fad2..b8dc9a6b24 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.dev2' + DOCKER_IMAGE_TAG: '24.1.0.dev6' MAIN_PYTHON_VERSION: '3.9' PACKAGE_NAME: 'ansys-meshing-prime' PACKAGE_NAMESPACE: 'ansys.meshing.prime' diff --git a/pyproject.toml b/pyproject.toml index 23e2743ebf..a58c0447fc 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.dev3" +version = "0.5.0.dev6" 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/__init__.py b/src/ansys/meshing/prime/__init__.py index 1b2cd7cf83..ad3b454a88 100644 --- a/src/ansys/meshing/prime/__init__.py +++ b/src/ansys/meshing/prime/__init__.py @@ -65,6 +65,7 @@ from ansys.meshing.prime.autogen.thinvolumecontrolstructs import * from ansys.meshing.prime.autogen.volumemeshtoolstructs import * from ansys.meshing.prime.autogen.volumesweeperstructs import * +from ansys.meshing.prime.autogen.topodatastructs import * from ansys.meshing.prime.autogen.topoutilitystructs import * from ansys.meshing.prime.autogen.morpherstructs import * from ansys.meshing.prime.autogen.morpherbcsstructs import * diff --git a/src/ansys/meshing/prime/autogen/controlstructs.py b/src/ansys/meshing/prime/autogen/controlstructs.py index 67096eb015..a437d94c00 100644 --- a/src/ansys/meshing/prime/autogen/controlstructs.py +++ b/src/ansys/meshing/prime/autogen/controlstructs.py @@ -1263,3 +1263,127 @@ def warning_code(self) -> WarningCode: @warning_code.setter def warning_code(self, value: WarningCode): self._warning_code = value + +class SetParamsResults(CoreObject): + """Results associated with the set parameters operation. + """ + _default_params = {} + + def __initialize( + self, + error_code: ErrorCode, + warning_code: WarningCode): + self._error_code = ErrorCode(error_code) + self._warning_code = WarningCode(warning_code) + + def __init__( + self, + model: CommunicationManager=None, + error_code: ErrorCode = None, + warning_code: WarningCode = None, + json_data : dict = None, + **kwargs): + """Initializes the SetParamsResults. + + Parameters + ---------- + model: Model + Model to create a SetParamsResults object with default parameters. + error_code: ErrorCode, optional + Error code associated with the set parameters operation. + warning_code: WarningCode, optional + Warning code associated with the set parameters operation. + json_data: dict, optional + JSON dictionary to create a SetParamsResults object with provided parameters. + + Examples + -------- + >>> set_params_results = prime.SetParamsResults(model = model) + """ + if json_data: + self.__initialize( + ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None), + WarningCode(json_data["warningCode"] if "warningCode" in json_data else None)) + else: + all_field_specified = all(arg is not None for arg in [error_code, warning_code]) + if all_field_specified: + self.__initialize( + error_code, + warning_code) + else: + if model is None: + raise ValueError("Invalid assignment. Either pass model or specify all properties") + else: + param_json = model._communicator.initialize_params(model, "SetParamsResults") + json_data = param_json["SetParamsResults"] if "SetParamsResults" in param_json else {} + self.__initialize( + error_code if error_code is not None else ( SetParamsResults._default_params["error_code"] if "error_code" in SetParamsResults._default_params else ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None)), + warning_code if warning_code is not None else ( SetParamsResults._default_params["warning_code"] if "warning_code" in SetParamsResults._default_params else WarningCode(json_data["warningCode"] if "warningCode" 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 ] + [setattr(type(self), key, property(lambda self, key = key: self._custom_params[key] if key in self._custom_params else None, + lambda self, value, key = key : self._custom_params.update({ key: value }))) for key in kwargs] + self._freeze() + + @staticmethod + def set_default( + error_code: ErrorCode = None, + warning_code: WarningCode = None): + """Set the default values of SetParamsResults. + + Parameters + ---------- + error_code: ErrorCode, optional + Error code associated with the set parameters operation. + warning_code: WarningCode, optional + Warning code associated with the set parameters operation. + """ + args = locals() + [SetParamsResults._default_params.update({ key: value }) for key, value in args.items() if value is not None] + + @staticmethod + def print_default(): + """Print the default values of SetParamsResults. + + Examples + -------- + >>> SetParamsResults.print_default() + """ + message = "" + message += ''.join(str(key) + ' : ' + str(value) + '\n' for key, value in SetParamsResults._default_params.items()) + print(message) + + def _jsonify(self) -> Dict[str, Any]: + json_data = {} + if self._error_code is not None: + json_data["errorCode"] = self._error_code + if self._warning_code is not None: + json_data["warningCode"] = self._warning_code + [ 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\nwarning_code : %s" % (self._error_code, self._warning_code) + message += ''.join('\n' + str(key) + ' : ' + str(value) for key, value in self._custom_params.items()) + return message + + @property + def error_code(self) -> ErrorCode: + """Error code associated with the set parameters operation. + """ + return self._error_code + + @error_code.setter + def error_code(self, value: ErrorCode): + self._error_code = value + + @property + def warning_code(self) -> WarningCode: + """Warning code associated with the set parameters operation. + """ + return self._warning_code + + @warning_code.setter + def warning_code(self, value: WarningCode): + self._warning_code = value diff --git a/src/ansys/meshing/prime/autogen/featureextractionstructs.py b/src/ansys/meshing/prime/autogen/featureextractionstructs.py index 5262a2d726..abcf6b0ee5 100644 --- a/src/ansys/meshing/prime/autogen/featureextractionstructs.py +++ b/src/ansys/meshing/prime/autogen/featureextractionstructs.py @@ -20,13 +20,15 @@ def __initialize( separate_features: bool, separation_angle: float, disconnect_with_faces: bool, - label_name: str): + label_name: str, + number_of_threads: int): self._replace = replace self._feature_angle = feature_angle self._separate_features = separate_features self._separation_angle = separation_angle self._disconnect_with_faces = disconnect_with_faces self._label_name = label_name + self._number_of_threads = number_of_threads def __init__( self, @@ -37,6 +39,7 @@ def __init__( separation_angle: float = None, disconnect_with_faces: bool = None, label_name: str = None, + number_of_threads: int = None, json_data : dict = None, **kwargs): """Initializes the ExtractFeatureParams. @@ -57,6 +60,8 @@ def __init__( Option to disconnect edges from faces. If false, edges remain connected to faces by sharing nodes. label_name: str, optional Label name to be assigned to extracted features. + number_of_threads: int, optional + Number of threads used for multithreading. json_data: dict, optional JSON dictionary to create a ExtractFeatureParams object with provided parameters. @@ -71,9 +76,10 @@ def __init__( json_data["separateFeatures"] if "separateFeatures" in json_data else None, json_data["separationAngle"] if "separationAngle" in json_data else None, json_data["disconnectWithFaces"] if "disconnectWithFaces" in json_data else None, - json_data["labelName"] if "labelName" in json_data else None) + json_data["labelName"] if "labelName" in json_data else None, + json_data["numberOfThreads"] if "numberOfThreads" in json_data else None) else: - all_field_specified = all(arg is not None for arg in [replace, feature_angle, separate_features, separation_angle, disconnect_with_faces, label_name]) + all_field_specified = all(arg is not None for arg in [replace, feature_angle, separate_features, separation_angle, disconnect_with_faces, label_name, number_of_threads]) if all_field_specified: self.__initialize( replace, @@ -81,7 +87,8 @@ def __init__( separate_features, separation_angle, disconnect_with_faces, - label_name) + label_name, + number_of_threads) else: if model is None: raise ValueError("Invalid assignment. Either pass model or specify all properties") @@ -94,7 +101,8 @@ def __init__( separate_features if separate_features is not None else ( ExtractFeatureParams._default_params["separate_features"] if "separate_features" in ExtractFeatureParams._default_params else (json_data["separateFeatures"] if "separateFeatures" in json_data else None)), separation_angle if separation_angle is not None else ( ExtractFeatureParams._default_params["separation_angle"] if "separation_angle" in ExtractFeatureParams._default_params else (json_data["separationAngle"] if "separationAngle" in json_data else None)), disconnect_with_faces if disconnect_with_faces is not None else ( ExtractFeatureParams._default_params["disconnect_with_faces"] if "disconnect_with_faces" in ExtractFeatureParams._default_params else (json_data["disconnectWithFaces"] if "disconnectWithFaces" in json_data else None)), - label_name if label_name is not None else ( ExtractFeatureParams._default_params["label_name"] if "label_name" in ExtractFeatureParams._default_params else (json_data["labelName"] if "labelName" in json_data else None))) + label_name if label_name is not None else ( ExtractFeatureParams._default_params["label_name"] if "label_name" in ExtractFeatureParams._default_params else (json_data["labelName"] if "labelName" in json_data else None)), + number_of_threads if number_of_threads is not None else ( ExtractFeatureParams._default_params["number_of_threads"] if "number_of_threads" in ExtractFeatureParams._default_params else (json_data["numberOfThreads"] if "numberOfThreads" 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 ] @@ -109,7 +117,8 @@ def set_default( separate_features: bool = None, separation_angle: float = None, disconnect_with_faces: bool = None, - label_name: str = None): + label_name: str = None, + number_of_threads: int = None): """Set the default values of ExtractFeatureParams. Parameters @@ -126,6 +135,8 @@ def set_default( Option to disconnect edges from faces. If false, edges remain connected to faces by sharing nodes. label_name: str, optional Label name to be assigned to extracted features. + number_of_threads: int, optional + Number of threads used for multithreading. """ args = locals() [ExtractFeatureParams._default_params.update({ key: value }) for key, value in args.items() if value is not None] @@ -156,11 +167,13 @@ def _jsonify(self) -> Dict[str, Any]: json_data["disconnectWithFaces"] = self._disconnect_with_faces if self._label_name is not None: json_data["labelName"] = self._label_name + if self._number_of_threads is not None: + json_data["numberOfThreads"] = self._number_of_threads [ 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 = "replace : %s\nfeature_angle : %s\nseparate_features : %s\nseparation_angle : %s\ndisconnect_with_faces : %s\nlabel_name : %s" % (self._replace, self._feature_angle, self._separate_features, self._separation_angle, self._disconnect_with_faces, self._label_name) + message = "replace : %s\nfeature_angle : %s\nseparate_features : %s\nseparation_angle : %s\ndisconnect_with_faces : %s\nlabel_name : %s\nnumber_of_threads : %s" % (self._replace, self._feature_angle, self._separate_features, self._separation_angle, self._disconnect_with_faces, self._label_name, self._number_of_threads) message += ''.join('\n' + str(key) + ' : ' + str(value) for key, value in self._custom_params.items()) return message @@ -224,6 +237,16 @@ def label_name(self) -> str: def label_name(self, value: str): self._label_name = value + @property + def number_of_threads(self) -> int: + """Number of threads used for multithreading. + """ + return self._number_of_threads + + @number_of_threads.setter + def number_of_threads(self, value: int): + self._number_of_threads = value + class ExtractFeatureResults(CoreObject): """Result of edge zonelet extraction by angle. """ diff --git a/src/ansys/meshing/prime/autogen/fileiostructs.py b/src/ansys/meshing/prime/autogen/fileiostructs.py index 43cbf401a8..96b0341847 100644 --- a/src/ansys/meshing/prime/autogen/fileiostructs.py +++ b/src/ansys/meshing/prime/autogen/fileiostructs.py @@ -792,12 +792,14 @@ class ExportFluentCaseParams(CoreObject): _default_params = {} def __initialize( - self): - pass + self, + cff_format: bool): + self._cff_format = cff_format def __init__( self, model: CommunicationManager=None, + cff_format: bool = None, json_data : dict = None, **kwargs): """Initializes the ExportFluentCaseParams. @@ -806,6 +808,8 @@ def __init__( ---------- model: Model Model to create a ExportFluentCaseParams object with default parameters. + cff_format: bool, optional + Option to specify whether to export Fluent case file in CFF format (.cas.h5) or legacy format (.cas, .cas.gz). json_data: dict, optional JSON dictionary to create a ExportFluentCaseParams object with provided parameters. @@ -814,18 +818,21 @@ def __init__( >>> export_fluent_case_params = prime.ExportFluentCaseParams(model = model) """ if json_data: - self.__initialize() + self.__initialize( + json_data["cffFormat"] if "cffFormat" in json_data else None) else: - all_field_specified = all(arg is not None for arg in []) + all_field_specified = all(arg is not None for arg in [cff_format]) if all_field_specified: - self.__initialize() + self.__initialize( + cff_format) else: if model is None: raise ValueError("Invalid assignment. Either pass model or specify all properties") else: param_json = model._communicator.initialize_params(model, "ExportFluentCaseParams") json_data = param_json["ExportFluentCaseParams"] if "ExportFluentCaseParams" in param_json else {} - self.__initialize() + self.__initialize( + cff_format if cff_format is not None else ( ExportFluentCaseParams._default_params["cff_format"] if "cff_format" in ExportFluentCaseParams._default_params else (json_data["cffFormat"] if "cffFormat" 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 ] @@ -834,9 +841,14 @@ def __init__( self._freeze() @staticmethod - def set_default(): + def set_default( + cff_format: bool = None): """Set the default values of ExportFluentCaseParams. + Parameters + ---------- + cff_format: bool, optional + Option to specify whether to export Fluent case file in CFF format (.cas.h5) or legacy format (.cas, .cas.gz). """ args = locals() [ExportFluentCaseParams._default_params.update({ key: value }) for key, value in args.items() if value is not None] @@ -855,14 +867,26 @@ def print_default(): def _jsonify(self) -> Dict[str, Any]: json_data = {} + if self._cff_format is not None: + json_data["cffFormat"] = self._cff_format [ 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 = "" % () + message = "cff_format : %s" % (self._cff_format) message += ''.join('\n' + str(key) + ' : ' + str(value) for key, value in self._custom_params.items()) return message + @property + def cff_format(self) -> bool: + """Option to specify whether to export Fluent case file in CFF format (.cas.h5) or legacy format (.cas, .cas.gz). + """ + return self._cff_format + + @cff_format.setter + def cff_format(self, value: bool): + self._cff_format = value + class ExportFluentMeshingMeshParams(CoreObject): """Parameters used to export fluent meshing mesh. """ @@ -1273,7 +1297,8 @@ def __initialize( refacet: bool, cad_refaceting_params: CadRefacetingParams, stitch_tolerance: float, - cad_update_parameters: Dict[str, Union[str, int, float, bool]]): + cad_update_parameters: Dict[str, Union[str, int, float, bool]], + validate_shared_topology: bool): self._append = append self._ansys_release = ansys_release self._cad_reader_route = CadReaderRoute(cad_reader_route) @@ -1284,6 +1309,7 @@ def __initialize( self._cad_refaceting_params = cad_refaceting_params self._stitch_tolerance = stitch_tolerance self._cad_update_parameters = cad_update_parameters + self._validate_shared_topology = validate_shared_topology def __init__( self, @@ -1298,6 +1324,7 @@ def __init__( cad_refaceting_params: CadRefacetingParams = None, stitch_tolerance: float = None, cad_update_parameters: Dict[str, Union[str, int, float, bool]] = None, + validate_shared_topology: bool = None, json_data : dict = None, **kwargs): """Initializes the ImportCadParams. @@ -1309,7 +1336,7 @@ def __init__( append: bool, optional Append imported CAD into existing model when true. ansys_release: str, optional - Configures the Ansys release to be used for loading CAD data through non Native route. + Configures the Ansys release to be used for loading CAD data through non Native route. Supported formats for specifying Ansys release version are '24.1', '241', 'v241', '24R1'. cad_reader_route: CadReaderRoute, optional Specify the available CAD reader routes. The available CAD reader routes are ProgramControlled, Native, WorkBench, SpaceClaim. part_creation_type: PartCreationType, optional @@ -1326,6 +1353,8 @@ def __init__( Stitch facets based on tolerance. Available only with WorkBench CAD Reader route. cad_update_parameters: Dict[str, Union[str, int, float, bool]], optional Specify the CAD parameters for parametric CAD update. Available only with WorkBench CAD Reader route. + validate_shared_topology: bool, optional + Specify whether to validate the shared topology information. json_data: dict, optional JSON dictionary to create a ImportCadParams object with provided parameters. @@ -1344,9 +1373,10 @@ def __init__( json_data["refacet"] if "refacet" in json_data else None, CadRefacetingParams(model = model, json_data = json_data["cadRefacetingParams"] if "cadRefacetingParams" in json_data else None), json_data["stitchTolerance"] if "stitchTolerance" in json_data else None, - json_data["cadUpdateParameters"] if "cadUpdateParameters" in json_data else None) + json_data["cadUpdateParameters"] if "cadUpdateParameters" in json_data else None, + json_data["validateSharedTopology"] if "validateSharedTopology" in json_data else None) else: - all_field_specified = all(arg is not None for arg in [append, ansys_release, cad_reader_route, part_creation_type, geometry_transfer, length_unit, refacet, cad_refaceting_params, stitch_tolerance, cad_update_parameters]) + all_field_specified = all(arg is not None for arg in [append, ansys_release, cad_reader_route, part_creation_type, geometry_transfer, length_unit, refacet, cad_refaceting_params, stitch_tolerance, cad_update_parameters, validate_shared_topology]) if all_field_specified: self.__initialize( append, @@ -1358,7 +1388,8 @@ def __init__( refacet, cad_refaceting_params, stitch_tolerance, - cad_update_parameters) + cad_update_parameters, + validate_shared_topology) else: if model is None: raise ValueError("Invalid assignment. Either pass model or specify all properties") @@ -1375,7 +1406,8 @@ def __init__( refacet if refacet is not None else ( ImportCadParams._default_params["refacet"] if "refacet" in ImportCadParams._default_params else (json_data["refacet"] if "refacet" in json_data else None)), cad_refaceting_params if cad_refaceting_params is not None else ( ImportCadParams._default_params["cad_refaceting_params"] if "cad_refaceting_params" in ImportCadParams._default_params else CadRefacetingParams(model = model, json_data = (json_data["cadRefacetingParams"] if "cadRefacetingParams" in json_data else None))), stitch_tolerance if stitch_tolerance is not None else ( ImportCadParams._default_params["stitch_tolerance"] if "stitch_tolerance" in ImportCadParams._default_params else (json_data["stitchTolerance"] if "stitchTolerance" in json_data else None)), - cad_update_parameters if cad_update_parameters is not None else ( ImportCadParams._default_params["cad_update_parameters"] if "cad_update_parameters" in ImportCadParams._default_params else (json_data["cadUpdateParameters"] if "cadUpdateParameters" in json_data else None))) + cad_update_parameters if cad_update_parameters is not None else ( ImportCadParams._default_params["cad_update_parameters"] if "cad_update_parameters" in ImportCadParams._default_params else (json_data["cadUpdateParameters"] if "cadUpdateParameters" in json_data else None)), + validate_shared_topology if validate_shared_topology is not None else ( ImportCadParams._default_params["validate_shared_topology"] if "validate_shared_topology" in ImportCadParams._default_params else (json_data["validateSharedTopology"] if "validateSharedTopology" 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 ] @@ -1394,7 +1426,8 @@ def set_default( refacet: bool = None, cad_refaceting_params: CadRefacetingParams = None, stitch_tolerance: float = None, - cad_update_parameters: Dict[str, Union[str, int, float, bool]] = None): + cad_update_parameters: Dict[str, Union[str, int, float, bool]] = None, + validate_shared_topology: bool = None): """Set the default values of ImportCadParams. Parameters @@ -1402,7 +1435,7 @@ def set_default( append: bool, optional Append imported CAD into existing model when true. ansys_release: str, optional - Configures the Ansys release to be used for loading CAD data through non Native route. + Configures the Ansys release to be used for loading CAD data through non Native route. Supported formats for specifying Ansys release version are '24.1', '241', 'v241', '24R1'. cad_reader_route: CadReaderRoute, optional Specify the available CAD reader routes. The available CAD reader routes are ProgramControlled, Native, WorkBench, SpaceClaim. part_creation_type: PartCreationType, optional @@ -1419,6 +1452,8 @@ def set_default( Stitch facets based on tolerance. Available only with WorkBench CAD Reader route. cad_update_parameters: Dict[str, Union[str, int, float, bool]], optional Specify the CAD parameters for parametric CAD update. Available only with WorkBench CAD Reader route. + validate_shared_topology: bool, optional + Specify whether to validate the shared topology information. """ args = locals() [ImportCadParams._default_params.update({ key: value }) for key, value in args.items() if value is not None] @@ -1457,11 +1492,13 @@ def _jsonify(self) -> Dict[str, Any]: json_data["stitchTolerance"] = self._stitch_tolerance if self._cad_update_parameters is not None: json_data["cadUpdateParameters"] = self._cad_update_parameters + if self._validate_shared_topology is not None: + json_data["validateSharedTopology"] = self._validate_shared_topology [ 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 = "append : %s\nansys_release : %s\ncad_reader_route : %s\npart_creation_type : %s\ngeometry_transfer : %s\nlength_unit : %s\nrefacet : %s\ncad_refaceting_params : %s\nstitch_tolerance : %s\ncad_update_parameters : %s" % (self._append, self._ansys_release, self._cad_reader_route, self._part_creation_type, self._geometry_transfer, self._length_unit, self._refacet, '{ ' + str(self._cad_refaceting_params) + ' }', self._stitch_tolerance, self._cad_update_parameters) + message = "append : %s\nansys_release : %s\ncad_reader_route : %s\npart_creation_type : %s\ngeometry_transfer : %s\nlength_unit : %s\nrefacet : %s\ncad_refaceting_params : %s\nstitch_tolerance : %s\ncad_update_parameters : %s\nvalidate_shared_topology : %s" % (self._append, self._ansys_release, self._cad_reader_route, self._part_creation_type, self._geometry_transfer, self._length_unit, self._refacet, '{ ' + str(self._cad_refaceting_params) + ' }', self._stitch_tolerance, self._cad_update_parameters, self._validate_shared_topology) message += ''.join('\n' + str(key) + ' : ' + str(value) for key, value in self._custom_params.items()) return message @@ -1477,7 +1514,7 @@ def append(self, value: bool): @property def ansys_release(self) -> str: - """Configures the Ansys release to be used for loading CAD data through non Native route. + """Configures the Ansys release to be used for loading CAD data through non Native route. Supported formats for specifying Ansys release version are '24.1', '241', 'v241', '24R1'. """ return self._ansys_release @@ -1565,6 +1602,16 @@ def cad_update_parameters(self) -> Dict[str, Union[str, int, float, bool]]: def cad_update_parameters(self, value: Dict[str, Union[str, int, float, bool]]): self._cad_update_parameters = value + @property + def validate_shared_topology(self) -> bool: + """Specify whether to validate the shared topology information. + """ + return self._validate_shared_topology + + @validate_shared_topology.setter + def validate_shared_topology(self, value: bool): + self._validate_shared_topology = value + class ImportCadResults(CoreObject): """Results associated with the CAD import. """ diff --git a/src/ansys/meshing/prime/autogen/periodiccontrol.py b/src/ansys/meshing/prime/autogen/periodiccontrol.py index 01780293b5..1e84a1f884 100644 --- a/src/ansys/meshing/prime/autogen/periodiccontrol.py +++ b/src/ansys/meshing/prime/autogen/periodiccontrol.py @@ -42,7 +42,7 @@ def get_params(self) -> PeriodicControlParams: self._model._print_logs_after_command("get_params", PeriodicControlParams(model = self._model, json_data = result)) return PeriodicControlParams(model = self._model, json_data = result) - def set_params(self, periodic_control_params : PeriodicControlParams): + def set_params(self, periodic_control_params : PeriodicControlParams) -> SetParamsResults: """ Set the periodic control parameters. @@ -63,8 +63,9 @@ def set_params(self, periodic_control_params : PeriodicControlParams): args = {"periodic_control_params" : periodic_control_params._jsonify()} command_name = "PrimeMesh::PeriodicControl/SetParams" self._model._print_logs_before_command("set_params", args) - self._comm.serve(self._model, command_name, self._object_id, args=args) - self._model._print_logs_after_command("set_params") + result = self._comm.serve(self._model, command_name, self._object_id, args=args) + self._model._print_logs_after_command("set_params", SetParamsResults(model = self._model, json_data = result)) + return SetParamsResults(model = self._model, json_data = result) def set_suggested_name(self, name : str) -> SetNameResults: """ Sets the unique name for the periodic control based on the suggested name. diff --git a/src/ansys/meshing/prime/autogen/primeconfig.py b/src/ansys/meshing/prime/autogen/primeconfig.py index 4febefa41f..c9deaf36ab 100644 --- a/src/ansys/meshing/prime/autogen/primeconfig.py +++ b/src/ansys/meshing/prime/autogen/primeconfig.py @@ -430,6 +430,8 @@ class ErrorCode(enum.IntEnum): """Could not find a matching periodic face pair.""" PERIODICSURFACESEDGESMISMATCH = 2912 """Edge entities do not match on periodic source and target surfaces.""" + PERIODICRECOVERYFORALREADYVOLUMEMESHEDPART = 2913 + """Periodic recovery unsupported for already volume meshed part.""" TRANSFORMATIONFAILED = 3000 """Transformation failed.""" SCALINGFAILED = 3001 @@ -519,7 +521,7 @@ class ErrorCode(enum.IntEnum): UNSUPPORTEDFILEEXTENSIONFORFLUENTMESHINGMESH = 9002 """Provided file extension is not supported. Supported extensions are .msh and .msh.gz.""" UNSUPPORTEDFILEEXTENSIONFORFLUENTCASE = 9003 - """Provided file extension is not supported. Supported extensions are .cas and .cas.gz.""" + """Provided file extension is not supported. Supported extensions are .cas, .cas.gz and .cas.h5.""" UNSUPPORTEDFILEEXTENSIONFORKEYWORDFILE = 9004 """Provided file extension is not supported. Supported extensions are .k and .key.""" UNSUPPORTEDFILEEXTENSIONFORFLUENTSIZEFIELD = 9005 @@ -582,8 +584,16 @@ class ErrorCode(enum.IntEnum): """Same face scope is set as source for more than two thin volume controls.""" THINVOLUMEMESHNOTSUPPORTEDWITHFACEBASEDDATABASE = 12112 """Thin volume mesh is not supported with face based database.""" + INVALIDCONTROLPARAMS = 12201 + """Invalid control parameters.""" MICROSTRUCTUREINVALIDELEMENTTYPE = 13000 """Invalid input provided. Invalid Element Type.""" + MICROSTRUCTUREINVALIDSHAPETYPE = 13001 + """Invalid input provided. Invalid Shape.""" + MICROSTRUCTUREWRONGAPICALLSEQUENCE = 13002 + """Wrong API call sequence.""" + MICROSTRUCTUREBADSHAPEPROPERTIES = 13003 + """Bad shape properties.""" class WarningCode(enum.IntEnum): """Warning codes associated with the PyPrimeMesh operation. @@ -614,6 +624,8 @@ class WarningCode(enum.IntEnum): """Override volume scope entity.""" MAXOFPRISMCONTROLSMINASPECTRATIO = 403 """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.""" SURFERLAYEREDQUADFAILED = 1800 """Layered quad failed with surfer.""" SURFERDEGENERATEFACE = 1801 diff --git a/src/ansys/meshing/prime/autogen/surfaceutilities.py b/src/ansys/meshing/prime/autogen/surfaceutilities.py index 291257ac6c..e289e2fde5 100644 --- a/src/ansys/meshing/prime/autogen/surfaceutilities.py +++ b/src/ansys/meshing/prime/autogen/surfaceutilities.py @@ -472,3 +472,37 @@ def create_contact_patch(self, source_zonelets : Iterable[int], target_zonelets result = self._comm.serve(self._model, command_name, self._object_id, args=args) self._model._print_logs_after_command("create_contact_patch", CreateContactPatchResults(model = self._model, json_data = result)) return CreateContactPatchResults(model = self._model, json_data = result) + + def stretch_free_boundaries(self, face_zonelet_ids : Iterable[int], params : StretchFreeBoundariesParams) -> StretchFreeBoundariesResults: + """ Stretches free boundaries of each zonelet. + + + Parameters + ---------- + face_zonelet_ids : Iterable[int] + Ids of face zonelets. + params : StretchFreeBoundariesParams + Parameters to control stretch free boundaries operation. + + Returns + ------- + StretchFreeBoundariesResults + Returns the StretchFreeBoundariesResults. + + + Examples + -------- + >>> result = surf_utils.stretch_free_boundaries(face_zonelet_ids, params) + + """ + if not isinstance(face_zonelet_ids, Iterable): + raise TypeError("Invalid argument type passed for face_zonelet_ids, valid argument type is Iterable[int].") + if not isinstance(params, StretchFreeBoundariesParams): + raise TypeError("Invalid argument type passed for params, valid argument type is StretchFreeBoundariesParams.") + args = {"face_zonelet_ids" : face_zonelet_ids, + "params" : params._jsonify()} + command_name = "PrimeMesh::SurfaceUtilities/StretchFreeBoundaries" + self._model._print_logs_before_command("stretch_free_boundaries", args) + result = self._comm.serve(self._model, command_name, self._object_id, args=args) + self._model._print_logs_after_command("stretch_free_boundaries", StretchFreeBoundariesResults(model = self._model, json_data = result)) + return StretchFreeBoundariesResults(model = self._model, json_data = result) diff --git a/src/ansys/meshing/prime/autogen/surfaceutilitystructs.py b/src/ansys/meshing/prime/autogen/surfaceutilitystructs.py index 13dbb2cde2..9acb7aea37 100644 --- a/src/ansys/meshing/prime/autogen/surfaceutilitystructs.py +++ b/src/ansys/meshing/prime/autogen/surfaceutilitystructs.py @@ -3292,3 +3292,181 @@ def part_id(self) -> int: @part_id.setter def part_id(self, value: int): self._part_id = value + +class StretchFreeBoundariesParams(CoreObject): + """Parameters used for stretch free boundaries operation. + """ + _default_params = {} + + def __initialize( + self): + pass + + def __init__( + self, + model: CommunicationManager=None, + json_data : dict = None, + **kwargs): + """Initializes the StretchFreeBoundariesParams. + + Parameters + ---------- + model: Model + Model to create a StretchFreeBoundariesParams object with default parameters. + json_data: dict, optional + JSON dictionary to create a StretchFreeBoundariesParams object with provided parameters. + + Examples + -------- + >>> stretch_free_boundaries_params = prime.StretchFreeBoundariesParams(model = model) + """ + if json_data: + self.__initialize() + else: + all_field_specified = all(arg is not None for arg in []) + if all_field_specified: + self.__initialize() + else: + if model is None: + raise ValueError("Invalid assignment. Either pass model or specify all properties") + else: + param_json = model._communicator.initialize_params(model, "StretchFreeBoundariesParams") + json_data = param_json["StretchFreeBoundariesParams"] if "StretchFreeBoundariesParams" in param_json else {} + self.__initialize() + self._custom_params = kwargs + if model is not None: + [ model._logger.warning(f'Unsupported argument : {key}') for key in kwargs ] + [setattr(type(self), key, property(lambda self, key = key: self._custom_params[key] if key in self._custom_params else None, + lambda self, value, key = key : self._custom_params.update({ key: value }))) for key in kwargs] + self._freeze() + + @staticmethod + def set_default(): + """Set the default values of StretchFreeBoundariesParams. + + """ + args = locals() + [StretchFreeBoundariesParams._default_params.update({ key: value }) for key, value in args.items() if value is not None] + + @staticmethod + def print_default(): + """Print the default values of StretchFreeBoundariesParams. + + Examples + -------- + >>> StretchFreeBoundariesParams.print_default() + """ + message = "" + message += ''.join(str(key) + ' : ' + str(value) + '\n' for key, value in StretchFreeBoundariesParams._default_params.items()) + print(message) + + def _jsonify(self) -> Dict[str, Any]: + json_data = {} + [ 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 = "" % () + message += ''.join('\n' + str(key) + ' : ' + str(value) for key, value in self._custom_params.items()) + return message + +class StretchFreeBoundariesResults(CoreObject): + """Results associated with stretch free boundaries operation. + """ + _default_params = {} + + def __initialize( + self, + error_code: ErrorCode): + self._error_code = ErrorCode(error_code) + + def __init__( + self, + model: CommunicationManager=None, + error_code: ErrorCode = None, + json_data : dict = None, + **kwargs): + """Initializes the StretchFreeBoundariesResults. + + Parameters + ---------- + model: Model + Model to create a StretchFreeBoundariesResults object with default parameters. + error_code: ErrorCode, optional + Error code associated with failure of operation. + json_data: dict, optional + JSON dictionary to create a StretchFreeBoundariesResults object with provided parameters. + + Examples + -------- + >>> stretch_free_boundaries_results = prime.StretchFreeBoundariesResults(model = model) + """ + if json_data: + self.__initialize( + ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None)) + else: + all_field_specified = all(arg is not None for arg in [error_code]) + if all_field_specified: + self.__initialize( + error_code) + else: + if model is None: + raise ValueError("Invalid assignment. Either pass model or specify all properties") + else: + param_json = model._communicator.initialize_params(model, "StretchFreeBoundariesResults") + json_data = param_json["StretchFreeBoundariesResults"] if "StretchFreeBoundariesResults" in param_json else {} + self.__initialize( + error_code if error_code is not None else ( StretchFreeBoundariesResults._default_params["error_code"] if "error_code" in StretchFreeBoundariesResults._default_params else ErrorCode(json_data["errorCode"] if "errorCode" 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 ] + [setattr(type(self), key, property(lambda self, key = key: self._custom_params[key] if key in self._custom_params else None, + lambda self, value, key = key : self._custom_params.update({ key: value }))) for key in kwargs] + self._freeze() + + @staticmethod + def set_default( + error_code: ErrorCode = None): + """Set the default values of StretchFreeBoundariesResults. + + Parameters + ---------- + error_code: ErrorCode, optional + Error code associated with failure of operation. + """ + args = locals() + [StretchFreeBoundariesResults._default_params.update({ key: value }) for key, value in args.items() if value is not None] + + @staticmethod + def print_default(): + """Print the default values of StretchFreeBoundariesResults. + + Examples + -------- + >>> StretchFreeBoundariesResults.print_default() + """ + message = "" + message += ''.join(str(key) + ' : ' + str(value) + '\n' for key, value in StretchFreeBoundariesResults._default_params.items()) + print(message) + + def _jsonify(self) -> Dict[str, Any]: + json_data = {} + if self._error_code is not None: + json_data["errorCode"] = self._error_code + [ 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 += ''.join('\n' + str(key) + ' : ' + str(value) for key, value in self._custom_params.items()) + return message + + @property + def error_code(self) -> ErrorCode: + """Error code associated with failure of operation. + """ + return self._error_code + + @error_code.setter + def error_code(self, value: ErrorCode): + self._error_code = value diff --git a/src/ansys/meshing/prime/autogen/topodata.py b/src/ansys/meshing/prime/autogen/topodata.py index f594a362ec..f2ad19c4ac 100644 --- a/src/ansys/meshing/prime/autogen/topodata.py +++ b/src/ansys/meshing/prime/autogen/topodata.py @@ -222,6 +222,41 @@ def get_adjacent_topo_edges_of_topo_edges(self, topo_edges : Iterable[int]) -> I self._model._print_logs_after_command("get_adjacent_topo_edges_of_topo_edges") return result + def delete_mesh_on_topo_faces(self, topo_faces : Iterable[int], params : DeleteMeshParams) -> DeleteMeshResults: + """ Delete mesh on the provided topofaces. + + + Parameters + ---------- + topo_faces : Iterable[int] + Ids of topofaces. + params : DeleteMeshParams + Parameters to delete mesh on topofaces. + + Returns + ------- + DeleteMeshResults + Returns the DeleteMeshResults. + + + Examples + -------- + >>> params = prime.DeleteMeshParams(model = model) + >>> result = topo_data.delete_mesh_on_topo_faces(top_faces, params) + + """ + if not isinstance(topo_faces, Iterable): + raise TypeError("Invalid argument type passed for topo_faces, valid argument type is Iterable[int].") + if not isinstance(params, DeleteMeshParams): + raise TypeError("Invalid argument type passed for params, valid argument type is DeleteMeshParams.") + args = {"topo_faces" : topo_faces, + "params" : params._jsonify()} + command_name = "PrimeMesh::TopoData/DeleteMeshOnTopoFaces" + self._model._print_logs_before_command("delete_mesh_on_topo_faces", args) + result = self._comm.serve(self._model, command_name, self._object_id, args=args) + self._model._print_logs_after_command("delete_mesh_on_topo_faces", DeleteMeshResults(model = self._model, json_data = result)) + return DeleteMeshResults(model = self._model, json_data = result) + @property def id(self): """ Get the id of TopoData.""" diff --git a/src/ansys/meshing/prime/autogen/topodatastructs.py b/src/ansys/meshing/prime/autogen/topodatastructs.py new file mode 100644 index 0000000000..41fa310aa0 --- /dev/null +++ b/src/ansys/meshing/prime/autogen/topodatastructs.py @@ -0,0 +1,211 @@ +""" Auto-generated file. DO NOT MODIFY """ +import enum +from typing import Dict, Any, Union, List, Iterable +from ansys.meshing.prime.internals.comm_manager import CommunicationManager +from ansys.meshing.prime.internals import utils +from ansys.meshing.prime.autogen.coreobject import * +import numpy as np + +from ansys.meshing.prime.params.primestructs import * + +class DeleteMeshResults(CoreObject): + """Results structure associated with delete mesh on topofaces. + """ + _default_params = {} + + def __initialize( + self, + error_code: ErrorCode): + self._error_code = ErrorCode(error_code) + + def __init__( + self, + model: CommunicationManager=None, + error_code: ErrorCode = None, + json_data : dict = None, + **kwargs): + """Initializes the DeleteMeshResults. + + Parameters + ---------- + model: Model + Model to create a DeleteMeshResults object with default parameters. + error_code: ErrorCode, optional + Error code associated with the failure of operation. + json_data: dict, optional + JSON dictionary to create a DeleteMeshResults object with provided parameters. + + Examples + -------- + >>> delete_mesh_results = prime.DeleteMeshResults(model = model) + """ + if json_data: + self.__initialize( + ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None)) + else: + all_field_specified = all(arg is not None for arg in [error_code]) + if all_field_specified: + self.__initialize( + error_code) + else: + if model is None: + raise ValueError("Invalid assignment. Either pass model or specify all properties") + else: + param_json = model._communicator.initialize_params(model, "DeleteMeshResults") + json_data = param_json["DeleteMeshResults"] if "DeleteMeshResults" in param_json else {} + self.__initialize( + error_code if error_code is not None else ( DeleteMeshResults._default_params["error_code"] if "error_code" in DeleteMeshResults._default_params else ErrorCode(json_data["errorCode"] if "errorCode" 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 ] + [setattr(type(self), key, property(lambda self, key = key: self._custom_params[key] if key in self._custom_params else None, + lambda self, value, key = key : self._custom_params.update({ key: value }))) for key in kwargs] + self._freeze() + + @staticmethod + def set_default( + error_code: ErrorCode = None): + """Set the default values of DeleteMeshResults. + + Parameters + ---------- + error_code: ErrorCode, optional + Error code associated with the failure of operation. + """ + args = locals() + [DeleteMeshResults._default_params.update({ key: value }) for key, value in args.items() if value is not None] + + @staticmethod + def print_default(): + """Print the default values of DeleteMeshResults. + + Examples + -------- + >>> DeleteMeshResults.print_default() + """ + message = "" + message += ''.join(str(key) + ' : ' + str(value) + '\n' for key, value in DeleteMeshResults._default_params.items()) + print(message) + + def _jsonify(self) -> Dict[str, Any]: + json_data = {} + if self._error_code is not None: + json_data["errorCode"] = self._error_code + [ 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 += ''.join('\n' + str(key) + ' : ' + str(value) for key, value in self._custom_params.items()) + return message + + @property + def error_code(self) -> ErrorCode: + """Error code associated with the failure of operation. + """ + return self._error_code + + @error_code.setter + def error_code(self, value: ErrorCode): + self._error_code = value + +class DeleteMeshParams(CoreObject): + """Parameters to delete mesh on topoentities. + """ + _default_params = {} + + def __initialize( + self, + delete_mesh_on_connected_topo_edges: bool): + self._delete_mesh_on_connected_topo_edges = delete_mesh_on_connected_topo_edges + + def __init__( + self, + model: CommunicationManager=None, + delete_mesh_on_connected_topo_edges: bool = None, + json_data : dict = None, + **kwargs): + """Initializes the DeleteMeshParams. + + Parameters + ---------- + model: Model + Model to create a DeleteMeshParams object with default parameters. + delete_mesh_on_connected_topo_edges: bool, optional + Option to delete mesh on topoedges connected only to provided topoentities. + json_data: dict, optional + JSON dictionary to create a DeleteMeshParams object with provided parameters. + + Examples + -------- + >>> delete_mesh_params = prime.DeleteMeshParams(model = model) + """ + if json_data: + self.__initialize( + json_data["deleteMeshOnConnectedTopoEdges"] if "deleteMeshOnConnectedTopoEdges" in json_data else None) + else: + all_field_specified = all(arg is not None for arg in [delete_mesh_on_connected_topo_edges]) + if all_field_specified: + self.__initialize( + delete_mesh_on_connected_topo_edges) + else: + if model is None: + raise ValueError("Invalid assignment. Either pass model or specify all properties") + else: + param_json = model._communicator.initialize_params(model, "DeleteMeshParams") + json_data = param_json["DeleteMeshParams"] if "DeleteMeshParams" in param_json else {} + self.__initialize( + delete_mesh_on_connected_topo_edges if delete_mesh_on_connected_topo_edges is not None else ( DeleteMeshParams._default_params["delete_mesh_on_connected_topo_edges"] if "delete_mesh_on_connected_topo_edges" in DeleteMeshParams._default_params else (json_data["deleteMeshOnConnectedTopoEdges"] if "deleteMeshOnConnectedTopoEdges" 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 ] + [setattr(type(self), key, property(lambda self, key = key: self._custom_params[key] if key in self._custom_params else None, + lambda self, value, key = key : self._custom_params.update({ key: value }))) for key in kwargs] + self._freeze() + + @staticmethod + def set_default( + delete_mesh_on_connected_topo_edges: bool = None): + """Set the default values of DeleteMeshParams. + + Parameters + ---------- + delete_mesh_on_connected_topo_edges: bool, optional + Option to delete mesh on topoedges connected only to provided topoentities. + """ + args = locals() + [DeleteMeshParams._default_params.update({ key: value }) for key, value in args.items() if value is not None] + + @staticmethod + def print_default(): + """Print the default values of DeleteMeshParams. + + Examples + -------- + >>> DeleteMeshParams.print_default() + """ + message = "" + message += ''.join(str(key) + ' : ' + str(value) + '\n' for key, value in DeleteMeshParams._default_params.items()) + print(message) + + def _jsonify(self) -> Dict[str, Any]: + json_data = {} + if self._delete_mesh_on_connected_topo_edges is not None: + json_data["deleteMeshOnConnectedTopoEdges"] = self._delete_mesh_on_connected_topo_edges + [ 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 = "delete_mesh_on_connected_topo_edges : %s" % (self._delete_mesh_on_connected_topo_edges) + message += ''.join('\n' + str(key) + ' : ' + str(value) for key, value in self._custom_params.items()) + return message + + @property + def delete_mesh_on_connected_topo_edges(self) -> bool: + """Option to delete mesh on topoedges connected only to provided topoentities. + """ + return self._delete_mesh_on_connected_topo_edges + + @delete_mesh_on_connected_topo_edges.setter + def delete_mesh_on_connected_topo_edges(self, value: bool): + self._delete_mesh_on_connected_topo_edges = value diff --git a/src/ansys/meshing/prime/autogen/wrapperstructs.py b/src/ansys/meshing/prime/autogen/wrapperstructs.py index fbad11a58f..1766eeef28 100644 --- a/src/ansys/meshing/prime/autogen/wrapperstructs.py +++ b/src/ansys/meshing/prime/autogen/wrapperstructs.py @@ -1010,13 +1010,13 @@ def __initialize( material_point_name: str, suggested_part_name: str, number_of_threads: int, - merge_to_geom: bool): + create_new_part: bool): self._target = target self._gap_size = gap_size self._material_point_name = material_point_name self._suggested_part_name = suggested_part_name self._number_of_threads = number_of_threads - self._merge_to_geom = merge_to_geom + self._create_new_part = create_new_part def __init__( self, @@ -1026,7 +1026,7 @@ def __init__( material_point_name: str = None, suggested_part_name: str = None, number_of_threads: int = None, - merge_to_geom: bool = None, + create_new_part: bool = None, json_data : dict = None, **kwargs): """Initializes the WrapperCloseGapsParams. @@ -1045,8 +1045,8 @@ def __init__( Suggested part name for created patching surfaces. number_of_threads: int, optional Number of threads for multithreading. - merge_to_geom: bool, optional - Merges the created gap closure elements to the nearest input geometry. + create_new_part: bool, optional + Creates a new gap closure part. If set to false, merge the patches to the adjacent face zonelet with the highest face count in the input. json_data: dict, optional JSON dictionary to create a WrapperCloseGapsParams object with provided parameters. @@ -1061,9 +1061,9 @@ def __init__( json_data["materialPointName"] if "materialPointName" in json_data else None, json_data["suggestedPartName"] if "suggestedPartName" in json_data else None, json_data["numberOfThreads"] if "numberOfThreads" in json_data else None, - json_data["mergeToGeom"] if "mergeToGeom" in json_data else None) + json_data["createNewPart"] if "createNewPart" in json_data else None) else: - all_field_specified = all(arg is not None for arg in [target, gap_size, material_point_name, suggested_part_name, number_of_threads, merge_to_geom]) + all_field_specified = all(arg is not None for arg in [target, gap_size, material_point_name, suggested_part_name, number_of_threads, create_new_part]) if all_field_specified: self.__initialize( target, @@ -1071,7 +1071,7 @@ def __init__( material_point_name, suggested_part_name, number_of_threads, - merge_to_geom) + create_new_part) else: if model is None: raise ValueError("Invalid assignment. Either pass model or specify all properties") @@ -1084,7 +1084,7 @@ def __init__( material_point_name if material_point_name is not None else ( WrapperCloseGapsParams._default_params["material_point_name"] if "material_point_name" in WrapperCloseGapsParams._default_params else (json_data["materialPointName"] if "materialPointName" in json_data else None)), suggested_part_name if suggested_part_name is not None else ( WrapperCloseGapsParams._default_params["suggested_part_name"] if "suggested_part_name" in WrapperCloseGapsParams._default_params else (json_data["suggestedPartName"] if "suggestedPartName" in json_data else None)), number_of_threads if number_of_threads is not None else ( WrapperCloseGapsParams._default_params["number_of_threads"] if "number_of_threads" in WrapperCloseGapsParams._default_params else (json_data["numberOfThreads"] if "numberOfThreads" in json_data else None)), - merge_to_geom if merge_to_geom is not None else ( WrapperCloseGapsParams._default_params["merge_to_geom"] if "merge_to_geom" in WrapperCloseGapsParams._default_params else (json_data["mergeToGeom"] if "mergeToGeom" in json_data else None))) + create_new_part if create_new_part is not None else ( WrapperCloseGapsParams._default_params["create_new_part"] if "create_new_part" in WrapperCloseGapsParams._default_params else (json_data["createNewPart"] if "createNewPart" 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 ] @@ -1099,7 +1099,7 @@ def set_default( material_point_name: str = None, suggested_part_name: str = None, number_of_threads: int = None, - merge_to_geom: bool = None): + create_new_part: bool = None): """Set the default values of WrapperCloseGapsParams. Parameters @@ -1114,8 +1114,8 @@ def set_default( Suggested part name for created patching surfaces. number_of_threads: int, optional Number of threads for multithreading. - merge_to_geom: bool, optional - Merges the created gap closure elements to the nearest input geometry. + create_new_part: bool, optional + Creates a new gap closure part. If set to false, merge the patches to the adjacent face zonelet with the highest face count in the input. """ args = locals() [WrapperCloseGapsParams._default_params.update({ key: value }) for key, value in args.items() if value is not None] @@ -1144,13 +1144,13 @@ def _jsonify(self) -> Dict[str, Any]: json_data["suggestedPartName"] = self._suggested_part_name if self._number_of_threads is not None: json_data["numberOfThreads"] = self._number_of_threads - if self._merge_to_geom is not None: - json_data["mergeToGeom"] = self._merge_to_geom + if self._create_new_part is not None: + json_data["createNewPart"] = self._create_new_part [ 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 = "target : %s\ngap_size : %s\nmaterial_point_name : %s\nsuggested_part_name : %s\nnumber_of_threads : %s\nmerge_to_geom : %s" % ('{ ' + str(self._target) + ' }', self._gap_size, self._material_point_name, self._suggested_part_name, self._number_of_threads, self._merge_to_geom) + message = "target : %s\ngap_size : %s\nmaterial_point_name : %s\nsuggested_part_name : %s\nnumber_of_threads : %s\ncreate_new_part : %s" % ('{ ' + str(self._target) + ' }', self._gap_size, self._material_point_name, self._suggested_part_name, self._number_of_threads, self._create_new_part) message += ''.join('\n' + str(key) + ' : ' + str(value) for key, value in self._custom_params.items()) return message @@ -1205,14 +1205,14 @@ def number_of_threads(self, value: int): self._number_of_threads = value @property - def merge_to_geom(self) -> bool: - """Merges the created gap closure elements to the nearest input geometry. + def create_new_part(self) -> bool: + """Creates a new gap closure part. If set to false, merge the patches to the adjacent face zonelet with the highest face count in the input. """ - return self._merge_to_geom + return self._create_new_part - @merge_to_geom.setter - def merge_to_geom(self, value: bool): - self._merge_to_geom = value + @create_new_part.setter + def create_new_part(self, value: bool): + self._create_new_part = value class WrapperCloseGapsResult(CoreObject): """Result structure associated with close gaps operation. diff --git a/src/ansys/meshing/prime/internals/error_handling.py b/src/ansys/meshing/prime/internals/error_handling.py index b713ba0535..891316c91e 100644 --- a/src/ansys/meshing/prime/internals/error_handling.py +++ b/src/ansys/meshing/prime/internals/error_handling.py @@ -244,6 +244,7 @@ ErrorCode.RECOVERPERIODICSURFACESINVALIDSCOPE: "Source face zonelets are empty. Invalid scope input.", ErrorCode.CHECKPERIODICPAIRSFAILED: "Failed to recover periodic surfaces. No matching periodic face pair found. Check the inputs.", ErrorCode.PERIODICSURFACESEDGESMISMATCH: "Failed to recover periodic surfaces. Edge entities do not match on periodic source and target surfaces.", + ErrorCode.PERIODICRECOVERYFORALREADYVOLUMEMESHEDPART: "Already volume meshed. Periodic recovery unsupported.", ErrorCode.CREATECAPONFACEZONELETSFAILED: "Failed to create cap on face zonelets.", ErrorCode.INTERSECTIONINTARGETVOLUMES: "Found overlapping or intersecting target volumes.", ErrorCode.INTERSECTIONINCUTTERVOLUMES: "Found overlapping or intersecting cutter volumes.", @@ -307,6 +308,7 @@ WarningCode.OVERRIDESURFACESCOPEENTITY: "Invalid surface scope entity, override by face zonelets.", 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.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.", diff --git a/src/ansys/meshing/prime/params/primestructs.py b/src/ansys/meshing/prime/params/primestructs.py index 3a16694f0c..241432c771 100644 --- a/src/ansys/meshing/prime/params/primestructs.py +++ b/src/ansys/meshing/prime/params/primestructs.py @@ -29,6 +29,7 @@ from ansys.meshing.prime.autogen.surfaceutilitystructs import * from ansys.meshing.prime.autogen.surferstructs import * from ansys.meshing.prime.autogen.thinvolumecontrolstructs import * +from ansys.meshing.prime.autogen.topodatastructs import * from ansys.meshing.prime.autogen.topoutilitystructs import * from ansys.meshing.prime.autogen.transformstructs import * from ansys.meshing.prime.autogen.volumecontrolstructs import *