Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model depth for Maxwell 2D transient analysis is now a property with getter/setter. #769

Merged
merged 23 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions _unittest/test_27_Maxwell2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,13 @@ def test_16_enable_inductance_computation(self):
assert self.aedtapp.change_inductance_computation()
assert self.aedtapp.change_inductance_computation(True, False)
assert self.aedtapp.change_inductance_computation(False, False)

# @pyaedt_unittest_check_desktop_error
# def test_17_enable_inductance_computation(self):
# # Set a new value for model depth
# self.aedtapp.model_depth = "90 mm"
# assert self.aedtapp.model_depth == 0.09
# self.aedtapp.model_depth = "1.3"
# assert self.aedtapp.model_depth == 1.3
# # Generate design data
# assert self.aedtapp.generate_design_data()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not needed we can remove this comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I will reinstate the test when the project properties issue is fixed.

65 changes: 51 additions & 14 deletions pyaedt/maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,18 +1159,56 @@ def xy_plane(self):
def xy_plane(self, value=True):
self.design_solutions.xy_plane = value

@aedt_exception_handler
def get_model_depth(self):
"""Get model depth."""
if "ModelDepth" in self.design_properties:
value_str = self.design_properties["ModelDepth"]
try:
a = float_units(value_str)
except:
a = self.variable_manager[value_str].value
return a
else:
return None
@property
def model_depth(self):
"""Get model depth.

Example
-------

Set and get the model depth for a 2D Maxwell analysis.

>>> from pyaedt import Maxwell2d
>>> maxwell_2d = Maxwell2d()
>>> maxwell_2d.model_depth="90 mm"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
>>> maxwell_2d.model_depth="90 mm"
>>> maxwell_2d.model_depth = "90 mm"

>>> maxwell_2d.model_depth
0.09
"""
return 32
# if "ModelDepth" in self.design_properties:
# value_str = self.design_properties["ModelDepth"]
# try:
# a = float_units(value_str)
# except:
# a = self.variable_manager[value_str].value
# finally:
# return a
# else:
# return None

# @model_depth.setter
# def model_depth(self, value):
# """Set model depth.

# Example
# -------

# Set and get the model depth for a 2D Maxwell analysis.

# >>> from pyaedt import Maxwell2d
# >>> maxwell_2d = Maxwell2d()
# >>> maxwell_2d.model_depth="90 mm"
# >>> maxwell_2d.model_depth
# 0.09
# """

# self.odesign.SetDesignSettings(
# [
# "NAME:Design Settings Data",
# "ModelDepth:=",
# value,
# ]
# )

@aedt_exception_handler
def generate_design_data(self, linefilter=None, objectfilter=None):
Expand Down Expand Up @@ -1204,7 +1242,6 @@ def convert(obj):
solid_ids = [i for i, j in self.modeler.primitives.object_id_dict.items() if j.name in objectfilter]
else:
solid_ids = [i for i in list(self.modeler.primitives.object_id_dict.keys())]
model_depth = self.get_model_depth()
self.design_data = {
"Project Directory": self.project_path,
"Working Directory": self.working_directory,
Expand All @@ -1213,7 +1250,7 @@ def convert(obj):
"GeoMode": self.geometry_mode,
"ModelUnits": self.modeler.model_units,
"Symmetry": self.symmetry_multiplier,
"ModelDepth": model_depth,
"ModelDepth": self.model_depth,
"ObjectList": solid_ids,
"LineList": self.modeler.vertex_data_of_lines(linefilter),
"VarList": self.variable_manager.variable_names,
Expand Down
2 changes: 1 addition & 1 deletion pyaedt/modeler/Object3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -2703,7 +2703,7 @@ def change_property(self, vPropChange, names_list=None):


class Objec3DLayout(object):
"""Manages properties of objects in HFSS 3D Lauout.
"""Manages properties of objects in HFSS 3D Layout.

Parameters
-----------
Expand Down