From 8713283734a53cdf8211d730513acadd0ff4386e Mon Sep 17 00:00:00 2001 From: gmalinve <103059376+gmalinve@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:53:36 +0200 Subject: [PATCH] improve model_depth getter setter (#3771) * improve model_depth getter setter * Setter should not return anything --------- Co-authored-by: Samuel Lopez --- pyaedt/maxwell.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/pyaedt/maxwell.py b/pyaedt/maxwell.py index 82d1971c36b..67acc669ebe 100644 --- a/pyaedt/maxwell.py +++ b/pyaedt/maxwell.py @@ -10,7 +10,6 @@ from pyaedt.application.Analysis3D import FieldAnalysis3D from pyaedt.application.Variables import decompose_variable_value -from pyaedt.generic.DataHandlers import float_units from pyaedt.generic.constants import SOLUTIONS from pyaedt.generic.general_methods import generate_unique_name from pyaedt.generic.general_methods import open_file @@ -2829,23 +2828,19 @@ def xy_plane(self, value=True): @property def model_depth(self): """Model depth.""" - - if "ModelDepth" in self.design_properties: - value_str = self.design_properties["ModelDepth"] - a = None - try: - a = float_units(value_str) - except: - a = self.variable_manager[value_str].value - finally: - return a + design_settings = self.design_settings() + if "ModelDepth" in design_settings: + value_str = design_settings["ModelDepth"] + return value_str else: return None @model_depth.setter def model_depth(self, value): """Set model depth.""" - return self.change_design_settings({"ModelDepth": self.modeler._arg_with_dim(value, self.modeler.model_units)}) + if isinstance(value, float) or isinstance(value, int): + value = self.modeler._arg_with_dim(value, self.modeler.model_units) + self.change_design_settings({"ModelDepth": value}) @pyaedt_function_handler() def generate_design_data(self, linefilter=None, objectfilter=None):