diff --git a/src/ansys/acp/core/_tree_objects/stackup.py b/src/ansys/acp/core/_tree_objects/stackup.py index 54fe69b6d6..3b68c62670 100644 --- a/src/ansys/acp/core/_tree_objects/stackup.py +++ b/src/ansys/acp/core/_tree_objects/stackup.py @@ -222,8 +222,12 @@ def _create_stub(self) -> stackup_pb2_grpc.ObjectServiceStub: locked: ReadOnlyProperty[bool] = grpc_data_property_read_only("properties.locked") status = grpc_data_property_read_only("properties.status", from_protobuf=status_type_from_pb) - thickness: ReadOnlyProperty[float] = grpc_data_property_read_only("properties.thickness") - area_weight: ReadOnlyProperty[float] = grpc_data_property_read_only("properties.area_weight") + thickness: ReadOnlyProperty[float] = grpc_data_property_read_only( + "properties.thickness", check_optional=True + ) + area_weight: ReadOnlyProperty[float] = grpc_data_property_read_only( + "properties.area_weight", check_optional=True + ) symmetry = grpc_data_property( "properties.symmetry", diff --git a/tests/unittests/test_stackup.py b/tests/unittests/test_stackup.py index 0bbbae7ab0..8e8123aadc 100644 --- a/tests/unittests/test_stackup.py +++ b/tests/unittests/test_stackup.py @@ -190,9 +190,22 @@ def test_add_fabric(parent_object): assert stackup.fabrics[-1].angle == 45.0 -def test_fabric_wit_angle(parent_object): +def test_fabric_with_angle(parent_object): fabric1 = parent_object.create_fabric() fabric_with_angle = FabricWithAngle(fabric=fabric1, angle=45.0) assert fabric_with_angle != FabricWithAngle(fabric=parent_object.create_fabric(), angle=45.0) assert fabric_with_angle != FabricWithAngle(fabric=fabric1, angle=55.0) assert fabric_with_angle == FabricWithAngle(fabric=fabric1, angle=45.0) + + +def test_fabric_without_material(parent_object, skip_before_version): + """Verify that a fabric without material can be added to a stackup. + + Checks that the properties which should not be computable are 'None'. + """ + skip_before_version("26.1") + fabric = parent_object.create_fabric() + stackup = parent_object.create_stackup() + stackup.add_fabric(fabric) + assert stackup.thickness is None + assert stackup.area_weight is None