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

FIX: Object oriented name update #5595

Merged
merged 36 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
08911a6
Fix MeshOperation.name when mesh op isn't defined.
Devin-Crawford Dec 14, 2024
74bfde1
Update get_oo_object
Devin-Crawford Dec 15, 2024
2f17d02
Update get_oo_object
Devin-Crawford Dec 16, 2024
bcf1528
CHORE: Auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 16, 2024
73ee428
Merge branch 'main' into FIX/Mesh-Operations-5568
Devin-Crawford Dec 16, 2024
9b170d7
Merge branch 'main' into FIX/Mesh-Operations-5568
SMoraisAnsys Dec 16, 2024
b168cad
Apply suggestions from code review
Devin-Crawford Dec 16, 2024
e36795b
Update get_oo_object
Devin-Crawford Dec 16, 2024
be8e2e9
Merge remote-tracking branch 'origin/fix/Mesh-Operations-5568' into F…
Devin-Crawford Dec 16, 2024
e929538
CHORE: Auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 16, 2024
220de9e
Update child object
Samuelopez-ansys Dec 18, 2024
d2a753e
Merge branch 'main' into fix/Mesh-Operations-5568
Samuelopez-ansys Dec 18, 2024
85af8dd
Merge branch 'main' into fix/Mesh-Operations-5568
Samuelopez-ansys Dec 18, 2024
6be2f82
Apply #5590
Samuelopez-ansys Dec 19, 2024
8e1a9a9
RMxpert solution type fixed in test_10_export_to_maxwell
Samuelopez-ansys Dec 19, 2024
1542eb8
Try and except read only properties
Samuelopez-ansys Dec 19, 2024
682596b
Fix Q3D source and sink rename
Samuelopez-ansys Dec 19, 2024
7b70c8f
Fix _child_object
Samuelopez-ansys Dec 19, 2024
d7ab57e
Fix HFSS test
Samuelopez-ansys Dec 19, 2024
96c48f9
Fix Layout boundary
Samuelopez-ansys Dec 19, 2024
720e5b5
Fix unit tests
maxcapodi78 Dec 19, 2024
47c3f8e
Merge branch 'main' into fix/Mesh-Operations-5568
Samuelopez-ansys Dec 19, 2024
acc410b
Merge branch 'main' into fix/Mesh-Operations-5568
maxcapodi78 Dec 19, 2024
0747690
Fix unit tests
maxcapodi78 Dec 19, 2024
e6c0e39
Fix unit tests
maxcapodi78 Dec 19, 2024
984fbd3
Merge branch 'fix/Mesh-Operations-5568' of https://github.com/ansys/p…
maxcapodi78 Dec 19, 2024
6ebf830
Fix unit tests
maxcapodi78 Dec 19, 2024
9144bf7
Fix unit tests
maxcapodi78 Dec 19, 2024
c983ef5
Fix unit tests
maxcapodi78 Dec 19, 2024
bb447e7
Fix unit tests
maxcapodi78 Dec 19, 2024
7c8a449
Fix unit tests
maxcapodi78 Dec 19, 2024
fbbcc24
Speedup BinaryTreeNode
maxcapodi78 Dec 19, 2024
5eaea71
Speedup BinaryTreeNode
maxcapodi78 Dec 19, 2024
2a6bef1
Speedup BinaryTreeNode
maxcapodi78 Dec 19, 2024
89a230c
Speedup BinaryTreeNode
maxcapodi78 Dec 19, 2024
923eb3e
Speedup BinaryTreeNode
maxcapodi78 Dec 19, 2024
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 src/ansys/aedt/core/application/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,16 @@ def excitation_objects(self):
if el.name in exc_names:
self._excitation_objects[el.name] = el

# Delete objects that are not anymore available
keys_to_remove = [
internal_excitation
for internal_excitation in self._excitation_objects
if internal_excitation not in self.excitations
]

for key in keys_to_remove:
del self._excitation_objects[key]

return self._excitation_objects

@pyaedt_function_handler()
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/application/analysis_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ def import_gds_3d(self, input_file: str, mapping_layers: dict, units: str = "um"
input_file : str
Path to the GDS file.
mapping_layers : dict
Dictionary keys are GDS layer numbers, and the value is a tuple with the thickness and elevation.
Dictionary keys are GDS layer numbers, and the value is a tuple with the elevation and thickness.
units : str, optional
Length unit values. The default is ``"um"``.
import_method : integer, optional
Expand Down
7 changes: 6 additions & 1 deletion src/ansys/aedt/core/application/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
from ansys.aedt.core.generic.load_aedt_file import load_entire_aedt_file
from ansys.aedt.core.modules.boundary.common import BoundaryObject
from ansys.aedt.core.modules.boundary.icepak_boundary import NetworkObject
from ansys.aedt.core.modules.boundary.layout_boundary import BoundaryObject3dLayout
from ansys.aedt.core.modules.boundary.maxwell_boundary import MaxwellParameters

if sys.version_info.major > 2:
Expand Down Expand Up @@ -492,10 +493,14 @@ def boundaries(self) -> List[BoundaryObject]:
self._boundaries[boundary] = NetworkObject(self, boundary)
else:
self._boundaries[boundary] = BoundaryObject(self, boundary, boundarytype=boundarytype)

try:
for k, v in zip(current_excitations, current_excitation_types):
if k not in self._boundaries:
self._boundaries[k] = BoundaryObject(self, k, boundarytype=v)
if self.design_type == "HFSS 3D Layout Design" and v == "Port":
self._boundaries[k] = BoundaryObject3dLayout(self, k, props=None, boundarytype=v)
else:
self._boundaries[k] = BoundaryObject(self, k, boundarytype=v)
except Exception:
self.logger.info("Failed to design boundary object.")
return list(self._boundaries.values())
Expand Down
1 change: 1 addition & 0 deletions src/ansys/aedt/core/hfss.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ def field_setups(self):
List of :class:`ansys.aedt.core.modules.boundary.hfss_boundary.FarFieldSetup` and
:class:`ansys.aedt.core.modules.hfss_boundary.NearFieldSetup`
"""
self._field_setups = []
for field in self.field_setup_names:
obj_field = self.odesign.GetChildObject("Radiation").GetChildObject(field)
type_field = obj_field.GetPropValue("Type")
Expand Down
69 changes: 49 additions & 20 deletions src/ansys/aedt/core/modeler/cad/elements_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1370,43 +1370,60 @@
self._props = None
if not root_name:
root_name = node
saved_root_name = node if first_level else root_name
self.node = node
self._saved_root_name = node if first_level else root_name
self._get_child_obj_arg = get_child_obj_arg
self._node = node
self.child_object = child_object
self.children = {}
self.auto_update = True
self._children = {}
self.__first_level = first_level
if first_level:
self._update_children()

def _update_children(self):
self._children = {}
name = None
try:
if get_child_obj_arg is None:
child_names = [i for i in list(child_object.GetChildNames()) if not i.startswith("CachedBody")]
if self._get_child_obj_arg is None:
child_names = [i for i in list(self.child_object.GetChildNames()) if not i.startswith("CachedBody")]
else:
child_names = [
i for i in list(child_object.GetChildNames(get_child_obj_arg)) if not i.startswith("CachedBody")
i
for i in list(self.child_object.GetChildNames(self._get_child_obj_arg))
if not i.startswith("CachedBody")
]
except Exception: # pragma: no cover
child_names = []
for i in child_names:
if not name:
name = i
if i == "OperandPart_" + saved_root_name or i == "OperandPart_" + saved_root_name.split("_")[0]:
if i == "OperandPart_" + self._saved_root_name or i == "OperandPart_" + self._saved_root_name.split("_")[0]:
continue
elif not i.startswith("OperandPart_"):
try:
self.children[i] = BinaryTreeNode(i, self.child_object.GetChildObject(i), root_name=saved_root_name)
self._children[i] = BinaryTreeNode(
i, self.child_object.GetChildObject(i), root_name=self._saved_root_name
)
except Exception: # nosec
pass
else:
names = self.child_object.GetChildObject(i).GetChildNames()
for name in names:
self.children[name] = BinaryTreeNode(
name, self.child_object.GetChildObject(i).GetChildObject(name), root_name=saved_root_name
self._children[name] = BinaryTreeNode(
name, self.child_object.GetChildObject(i).GetChildObject(name), root_name=self._saved_root_name
)
if first_level:
self.child_object = self.children[name].child_object
self._props = self.children[name]._props
if name and self.__first_level:
self.child_object = self._children[name].child_object
self._props = self._children[name].properties
if name == "CreatePolyline:1":
self.segments = self.children[name].children
del self.children[name]
self.segments = self._children[name].children
del self._children[name]

@property
def children(self):
if not self._children:
self._update_children()
return self._children

@property
def properties(self):
Expand All @@ -1417,6 +1434,8 @@
:class:``ansys.aedt.coree.modeler.cad.elements_3d.HistoryProps``
"""
self._props = {}
if not getattr(self, "child_object", None):
return self._props

Check warning on line 1438 in src/ansys/aedt/core/modeler/cad/elements_3d.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/modeler/cad/elements_3d.py#L1438

Added line #L1438 was not covered by tests
if settings.aedt_version >= "2024.2":
try:
from ansys.aedt.core.application import _get_data_model
Expand Down Expand Up @@ -1464,18 +1483,28 @@
bool
``True`` when successful, ``False`` when failed.
"""
if prop_value is None:
settings.logger.warning(f"Property {prop_name} set to None ignored.")
return
try:
self.child_object.SetPropValue(prop_name, prop_value)
return True
result = self.child_object.SetPropValue(prop_name, prop_value)
if result:
if prop_name == "Name" and getattr(self, "_name", False):
setattr(self, "_name", prop_value)
else:
settings.logger.warning(f"Property {prop_name} is read-only.")
# Property Name duplicated
return
except Exception: # pragma: no cover
return False
# Property read-only
raise KeyError

@pyaedt_function_handler
def _jsonalize_tree(self, binary_tree_node):
childrend_dict = {}
for _, node in binary_tree_node.children.items():
childrend_dict.update(self._jsonalize_tree(node))
return {binary_tree_node.node: {"Props": binary_tree_node.properties, "Children": childrend_dict}}
return {binary_tree_node._node: {"Props": binary_tree_node.properties, "Children": childrend_dict}}

@pyaedt_function_handler
def jsonalize_tree(self):
Expand All @@ -1496,7 +1525,7 @@
"NAME:AllTabs",
[
"NAME:Geometry3DCmdTab",
["NAME:PropServers", node.child_object.GetObjPath().split("/")[3] + ":" + node.node],
["NAME:PropServers", node.child_object.GetObjPath().split("/")[3] + ":" + node._node],
["NAME:ChangedProps", ["NAME:Suppress Command", "Value:=", suppress]],
],
]
Expand Down
Loading
Loading