Skip to content

Allow stackup thickness and area weight to be None #873

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 6 additions & 2 deletions src/ansys/acp/core/_tree_objects/stackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 14 additions & 1 deletion tests/unittests/test_stackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading