Skip to content

Commit

Permalink
improve model_depth getter setter (#3771)
Browse files Browse the repository at this point in the history
* improve model_depth getter setter

* Setter should not return anything

---------

Co-authored-by: Samuel Lopez <[email protected]>
  • Loading branch information
gmalinve and Samuelopez-ansys committed Oct 19, 2023
1 parent da83359 commit 8713283
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions pyaedt/maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 8713283

Please sign in to comment.