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 22 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.

2 changes: 2 additions & 0 deletions pyaedt/application/Design.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ def logger(self):
"""
return self._logger

# TODO Project Properties are set at the beginning
# but after they are never updated along the different project steps.
@property
def project_properies(self):
"""Project properties.
Expand Down
23 changes: 18 additions & 5 deletions pyaedt/maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,19 +1159,33 @@ def xy_plane(self):
def xy_plane(self, value=True):
self.design_solutions.xy_plane = value

@aedt_exception_handler
def get_model_depth(self):
@property
def 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
finally:
return a
else:
return None

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

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

@aedt_exception_handler
def generate_design_data(self, linefilter=None, objectfilter=None):
"""Generate a generic set of design data and store it in the extension directory as ``design_data.json``.
Expand Down Expand Up @@ -1204,7 +1218,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 +1226,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