Skip to content

Commit 41770cf

Browse files
committed
feat: Implement named-object commands using root-level commands
1 parent 0764f6f commit 41770cf

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/ansys/fluent/core/solver/flobject.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,22 @@ def __add__(self, other):
14861486
)
14871487
return CombinedNamedObject([self, other])
14881488

1489+
def list(self):
1490+
"""Print the object names."""
1491+
return self._root.list(object_path=self.path)
1492+
1493+
def list_properties(self, object_name):
1494+
"""Print the properties of the given object name.
1495+
1496+
Parameters
1497+
----------
1498+
object_name : str
1499+
Name of the object whose properties are to be listed.
1500+
"""
1501+
return self._root.list_properties(
1502+
object_path=self.path, object_name=object_name
1503+
)
1504+
14891505

14901506
class CombinedNamedObject:
14911507
"""A ``CombinedNamedObject`` contains the concatenated named-objects."""
@@ -2218,6 +2234,11 @@ def _process_cls_names(info_dict, names, write_doc=False):
22182234
commands.pop("exit", None)
22192235
if commands and not user_creatable:
22202236
commands.pop("create", None)
2237+
# Temporary code for testing
2238+
if commands and parent is not None and version == "261":
2239+
for cmd in ["list", "list-properties"]:
2240+
if cmd in commands:
2241+
commands.pop(cmd, None)
22212242
if commands:
22222243
cls.command_names = []
22232244
_process_cls_names(commands, cls.command_names)

tests/test_settings_api.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,3 +790,11 @@ def test_setting_string_constants(mixing_elbow_settings_session):
790790

791791
with pytest.raises(ValueError):
792792
viscous.k_epsilon_model = viscous.k_epsilon_model.EASM
793+
794+
795+
def test_named_object_commands(mixing_elbow_settings_session):
796+
solver = mixing_elbow_settings_session
797+
solver.settings.setup.boundary_conditions.velocity_inlet.list()
798+
solver.settings.setup.boundary_conditions.velocity_inlet.list_properties(
799+
object_name="hot-inlet"
800+
)

0 commit comments

Comments
 (0)