Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions doc/changelog.d/7264.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve consistency
21 changes: 13 additions & 8 deletions src/ansys/aedt/core/modeler/cad/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -7463,23 +7463,28 @@ def get_obj_id(self, assignment):
return None

@pyaedt_function_handler()
def get_object_from_name(self, assignment):
"""Return the object from an object name.
def get_objects_by_name(self, assignment, case_sensitive: bool = True):
"""Return the objects given a search string.

Parameters
----------
assignment : str
Name of the object.
String used to filter by object names..
case_sensitive : bool, optional
Whether the string is case-sensitive. The default is ``True``.

Returns
-------
:class:`ansys.aedt.core.modeler.cad.object_3d.Object3d`
3D object returned.
list of class:`ansys.aedt.core.modeler.cad.object_3d.Object3d`
Returns a list of objects whose names contain the
search string..

"""
if assignment in self.object_names:
# object_id = self.get_obj_id(objname)
return self.objects[assignment]
if case_sensitive:
return [o for name, o in self.objects_by_name.items() if assignment in name]
else:
return [o for name, o in self.objects_by_name.items() if assignment.lower() in name.lower()]
return None

@pyaedt_function_handler()
def get_objects_w_string(self, string_name, case_sensitive: bool = True):
Expand Down
Loading