diff --git a/src/ansys/dpf/core/field_definition.py b/src/ansys/dpf/core/field_definition.py index 547aef932f..4796c9ab7b 100644 --- a/src/ansys/dpf/core/field_definition.py +++ b/src/ansys/dpf/core/field_definition.py @@ -155,7 +155,7 @@ def dimensionality(self): # @version_requires("4.0") #TODO @property - def quantity_type(self): + def quantity_types(self): """Getter for Quantity Types Returns @@ -166,7 +166,6 @@ def quantity_type(self): quantity_types = [] for i in range(self.num_quantity_types()): qt = self._api.csfield_definition_get_quantity_type(self, i) - print(qt) quantity_types.append(str(qt)) return quantity_types diff --git a/src/ansys/dpf/gate/field_definition_grpcapi.py b/src/ansys/dpf/gate/field_definition_grpcapi.py index 9988fb421d..70814b665f 100644 --- a/src/ansys/dpf/gate/field_definition_grpcapi.py +++ b/src/ansys/dpf/gate/field_definition_grpcapi.py @@ -25,7 +25,7 @@ def csfield_definition_fill_unit(fieldDef, symbol, size, homogeneity, factor, sh @staticmethod def csfield_definition_get_quantity_type(fieldDef, index): - return _get_stub(fieldDef._server).List(fieldDef._internal_obj).quantity_type[index] + return _get_stub(fieldDef._server).List(fieldDef._internal_obj).quantity_types.quantity_types[index] @staticmethod def csfield_definition_set_quantity_type(fieldDef, quantityType): @@ -33,11 +33,11 @@ def csfield_definition_set_quantity_type(fieldDef, quantityType): @staticmethod def csfield_definition_get_num_available_quantity_types(fieldDef): - return len(_get_stub(fieldDef._server).List(fieldDef._internal_obj).quantity_type) + return len(_get_stub(fieldDef._server).List(fieldDef._internal_obj).quantity_types.quantity_types) @staticmethod def csfield_definition_is_of_quantity_type(fieldDef, quantityType): - return quantityType in _get_stub(fieldDef._server).List(fieldDef._internal_obj).quantity_type + return quantityType in _get_stub(fieldDef._server).List(fieldDef._internal_obj).quantity_types.quantity_types @staticmethod def csfield_definition_get_shell_layers(fieldDef): @@ -107,6 +107,6 @@ def _modify_field_def( if name != None: request.name.string = name if quantity_type != None: - request.quantity_types.quantity_types = quantity_type + request.quantity_types.quantity_types.append(quantity_type) _get_stub(fieldDef._server).Update(request) diff --git a/tests/test_field.py b/tests/test_field.py index f749d43025..5fe917039a 100644 --- a/tests/test_field.py +++ b/tests/test_field.py @@ -526,18 +526,18 @@ def test_field_definition_quantity_type(server_type): fieldDef.add_quantity_type(qt) # Testing the getter - assert fieldDef.quantity_type[0] == qt + assert fieldDef.quantity_types[0] == qt # Adding a second quantity type qt2 = "another_quantity_type" fieldDef.add_quantity_type(qt2) # Testing the getter again - assert fieldDef.quantity_type[1] == qt2 + assert fieldDef.quantity_types[1] == qt2 # Testing the getter with an index out of range with pytest.raises(Exception): - fieldDef.quantity_type[2] + fieldDef.quantity_types[2] # Getting the number of available quantity types assert fieldDef.num_quantity_types() == 2