-
Notifications
You must be signed in to change notification settings - Fork 129
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
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
d70868d
Model depth for Maxwell 2D transient analysis is now a property with …
MaxJPRey 41c856a
Add unit test for model depth property.
MaxJPRey 0bd2960
Improve code style.
MaxJPRey 52f2cec
Fix typo in the documentation.
MaxJPRey 18d15f2
The transformed value was never used.
MaxJPRey 676a21d
Use SetDesignSettings for the model_depth property setter.
MaxJPRey 2924249
The test cannot work until a refactoring is made for the project prop…
MaxJPRey 51cfbc8
Fix the documentation.
MaxJPRey 26af071
Always return a value.
MaxJPRey 536d2f2
Debug.
MaxJPRey 7183352
Test not supported yet.
MaxJPRey 7b29d81
Remove the setter.
MaxJPRey 712ca46
Documentation.
MaxJPRey 51ca495
Enable getter.
MaxJPRey 90348a9
Documentation attribute __name__.
MaxJPRey fecb243
Return None.
MaxJPRey 48ed0d8
Return None.
MaxJPRey 7590a31
Remove example.
MaxJPRey f9b5a52
Add example for the getter.
MaxJPRey 5122d42
Remove example for the getter.
MaxJPRey cd3548b
Add comments for improvement.
MaxJPRey 058488c
Fix typo.
MaxJPRey 5ce30b6
Remove test until project properties are improved.
MaxJPRey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
>>> 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): | ||||||
|
@@ -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, | ||||||
|
@@ -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, | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.