diff --git a/doc/changelog.d/1117.miscellaneous.md b/doc/changelog.d/1117.miscellaneous.md new file mode 100644 index 0000000000..98618148f4 --- /dev/null +++ b/doc/changelog.d/1117.miscellaneous.md @@ -0,0 +1 @@ +Sync control data related changes from ado \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 191fc93aed..61f4828684 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi" [project] name = "ansys-meshing-prime" -version = "0.10.0.dev2" +version = "0.10.0.dev3" description = "PyPrimeMesh is a Python client to Ansys Prime Server, which delivers core Ansys meshing technology." readme = "README.md" requires-python = ">=3.10,<4" diff --git a/src/ansys/meshing/prime/core/controldata.py b/src/ansys/meshing/prime/core/controldata.py index 5525b26fa4..50c79f9470 100644 --- a/src/ansys/meshing/prime/core/controldata.py +++ b/src/ansys/meshing/prime/core/controldata.py @@ -32,6 +32,9 @@ from ansys.meshing.prime.autogen.primeconfig import ErrorCode from ansys.meshing.prime.autogen.shellblcontrol import ShellBLControl from ansys.meshing.prime.autogen.thinvolumecontrol import ThinVolumeControl +from ansys.meshing.prime.core.featurerecoverycontrol import ( + FeatureRecoveryControl as _FRControl, +) from ansys.meshing.prime.core.periodiccontrol import PeriodicControl from ansys.meshing.prime.core.prismcontrol import PrismControl from ansys.meshing.prime.core.sizecontrol import SizeControl @@ -64,6 +67,7 @@ def __init__(self, model: Model, id: int, object_id: int, name: str): self._wrapper_controls = [] self._mz_controls = [] self._size_controls = [] + self._feature_controls = [] self._prism_controls = [] self._thin_volume_controls = [] self._volume_controls = [] @@ -144,6 +148,28 @@ def create_size_control(self, sizing_type: SizingType) -> SizeControl: self._size_controls.append(new_size_control) return new_size_control + def create_feature_recovery_control(self) -> _FRControl: + """Create Feature Recovery control for wrap. + + Returns + ------- + _FRControl + Returns the feature recovery control. + + Notes + ----- + An empty feature recovery control is created on calling this API. + + Examples + -------- + >>> feature_recovery_control = model.control_data.create_feature_recovery_control() + + """ + res = _ControlData.create_feature_recovery_control(self) + new_feature_recovery_control = _FRControl(self._model, res[0], res[1], res[2]) + self._feature_controls.append(new_feature_recovery_control) + return new_feature_recovery_control + def create_prism_control(self) -> PrismControl: """Create a prism control. @@ -261,6 +287,29 @@ def get_size_control_by_name(self, name: str) -> SizeControl: return size_control return None + def get_feature_recovery_control_by_name(self, name: str) -> _FRControl: + """Get a feature recovery control by name. + + Parameters + ---------- + name : str + Name of the feature recovery control. + + Returns + ------- + _FRControl + Feature recovery control. + + Examples + -------- + >>> fr_control = model.control_data.get_feature_recovery_control_by_name("_FRControl-1") + + """ + for feature_recovery_control in self._feature_controls: + if feature_recovery_control.name == name: + return feature_recovery_control + return None + def get_prism_control_by_name(self, name: str) -> PrismControl: """Get a prism control by name. @@ -356,6 +405,10 @@ def delete_controls(self, control_ids: Iterable[int]) -> DeleteResults: if size_control.id == id: self._size_controls.remove(size_control) break + for feature_recovery_control in self._feature_controls: + if feature_recovery_control.id == id: + self._feature_controls.remove(feature_recovery_control) + break for wrapper_control in self._wrapper_controls: if wrapper_control.id == id: self._wrapper_controls.remove(wrapper_control) @@ -389,6 +442,9 @@ def delete_controls(self, control_ids: Iterable[int]) -> DeleteResults: def _update_size_controls(self, c_data: List): self._size_controls = [SizeControl(self._model, c[0], c[1], c[2]) for c in c_data] + def _update_feature_recovery_controls(self, c_data: List): + self._feature_controls = [_FRControl(self._model, c[0], c[1], c[2]) for c in c_data] + def _update_prism_controls(self, c_data: List): self._prism_controls = [PrismControl(self._model, c[0], c[1], c[2]) for c in c_data] @@ -468,6 +524,21 @@ def size_controls(self) -> List[SizeControl]: """ return self._size_controls + @property + def feature_recovery_controls(self) -> List[_FRControl]: + """Get the feature recovery controls. + + Returns + ------- + List[SizeControl] + List of feature recovery controls. + + Examples + -------- + >>> feature_recovery_controls = model.control_data.feature_recovery_controls + """ + return self._feature_controls + @property def volume_controls(self) -> List[VolumeControl]: """Get the volume controls.