Skip to content
Merged
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
1 change: 1 addition & 0 deletions doc/source/api/tree_objects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ACP objects
CylindricalSelectionRule
SphericalSelectionRule
TubeSelectionRule
VariableOffsetSelectionRule
BooleanSelectionRule
OrientedSelectionSet
ModelingGroup
Expand Down
185 changes: 95 additions & 90 deletions poetry.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/ansys/acp/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
SubLaminate,
TubeSelectionRule,
UnitSystemType,
VariableOffsetSelectionRule,
)

__version__ = importlib.metadata.version(__name__.replace(".", "-"))
Expand All @@ -47,6 +48,7 @@
"Model",
"Material",
"Fabric",
"SubLaminate",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did I miss this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I noticed it because my editor showed it as unused in this file 🙂

"ElementSet",
"EdgeSet",
"EdgeSetType",
Expand All @@ -59,6 +61,7 @@
"CylindricalSelectionRule",
"SphericalSelectionRule",
"TubeSelectionRule",
"VariableOffsetSelectionRule",
"BooleanSelectionRule",
"LinkedSelectionRule",
"OrientedSelectionSet",
Expand Down
2 changes: 2 additions & 0 deletions src/ansys/acp/core/_tree_objects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from .stackup import FabricWithAngle, Stackup
from .sublaminate import Lamina, SubLaminate
from .tube_selection_rule import TubeSelectionRule
from .variable_offset_selection_rule import VariableOffsetSelectionRule

__all__ = [
"Model",
Expand All @@ -43,6 +44,7 @@
"CylindricalSelectionRule",
"SphericalSelectionRule",
"TubeSelectionRule",
"VariableOffsetSelectionRule",
"BooleanSelectionRule",
"LinkedSelectionRule",
"OrientedSelectionSet",
Expand Down
7 changes: 7 additions & 0 deletions src/ansys/acp/core/_tree_objects/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"RosetteSelectionMethod",
"CutoffMaterialType",
"DropoffMaterialType",
"DrapingType",
"DrapingMaterialType",
"PlyType",
"UnitSystemType",
Expand Down Expand Up @@ -53,6 +54,12 @@
"DropoffMaterialType", drop_off_material_pb2.MaterialHandlingType, module=__name__
)

(
DrapingType,
draping_type_to_pb,
draping_type_from_pb,
) = wrap_to_string_enum("DrapingType", ply_material_pb2.DrapingType, module=__name__)

(
DrapingMaterialType,
draping_material_type_to_pb,
Expand Down
5 changes: 4 additions & 1 deletion src/ansys/acp/core/_tree_objects/linked_selection_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .parallel_selection_rule import ParallelSelectionRule
from .spherical_selection_rule import SphericalSelectionRule
from .tube_selection_rule import TubeSelectionRule
from .variable_offset_selection_rule import VariableOffsetSelectionRule

if typing.TYPE_CHECKING:
# Since the 'LinkedSelectionRule' class is used by the boolean selection rule,
Expand All @@ -30,6 +31,7 @@
CylindricalSelectionRule,
SphericalSelectionRule,
TubeSelectionRule,
VariableOffsetSelectionRule,
BooleanSelectionRule,
]

Expand Down Expand Up @@ -67,7 +69,7 @@ class LinkedSelectionRule(GenericEdgePropertyType):
:class:`.TubeSelectionRule` ``outer_radius`` ``inner_radius``
(TODO: CutOffSelectionRule) \- \-
(TODO: GeometricalSelectionRule) (TODO: in-plane capture tolerance) \-
(TODO: VariableOffsetSelectionRule) \- \-
:class:`.VariableOffsetSelectionRule` \- \-
:class:`.BooleanSelectionRule` \- \-
====================================== ================================== ===================
"""
Expand Down Expand Up @@ -154,6 +156,7 @@ def _from_pb_object(
CylindricalSelectionRule,
SphericalSelectionRule,
TubeSelectionRule,
VariableOffsetSelectionRule,
BooleanSelectionRule,
]
if not isinstance(parent_object, type_)
Expand Down
5 changes: 5 additions & 0 deletions src/ansys/acp/core/_tree_objects/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
stackup_pb2_grpc,
sublaminate_pb2_grpc,
tube_selection_rule_pb2_grpc,
variable_offset_selection_rule_pb2_grpc,
)
from ansys.api.acp.v0.base_pb2 import CollectionPath

Expand Down Expand Up @@ -63,6 +64,7 @@
from .stackup import Stackup
from .sublaminate import SubLaminate
from .tube_selection_rule import TubeSelectionRule
from .variable_offset_selection_rule import VariableOffsetSelectionRule

__all__ = ["MeshData", "Model", "ModelElementalData", "ModelNodalData"]

Expand Down Expand Up @@ -323,6 +325,9 @@ def export_materials(self, path: _PATH) -> None:
create_tube_selection_rule, tube_selection_rules = define_mutable_mapping(
TubeSelectionRule, tube_selection_rule_pb2_grpc.ObjectServiceStub
)
create_variable_offset_selection_rule, variable_offset_selection_rules = define_mutable_mapping(
VariableOffsetSelectionRule, variable_offset_selection_rule_pb2_grpc.ObjectServiceStub
)
create_boolean_selection_rule, boolean_selection_rules = define_mutable_mapping(
BooleanSelectionRule, boolean_selection_rule_pb2_grpc.ObjectServiceStub
)
Expand Down
73 changes: 71 additions & 2 deletions src/ansys/acp/core/_tree_objects/modeling_ply.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from ansys.api.acp.v0 import modeling_ply_pb2, modeling_ply_pb2_grpc, production_ply_pb2_grpc

from .._utils.array_conversions import to_1D_double_array, to_tuple_from_1D_array
from ._grpc_helpers.edge_property_list import define_edge_property_list
from ._grpc_helpers.linked_object_list import define_linked_object_list
from ._grpc_helpers.mapping import get_read_only_collection_property
Expand All @@ -19,9 +20,11 @@
)
from ._mesh_data import ElementalData, NodalData, elemental_data_property, nodal_data_property
from .base import CreatableTreeObject, IdTreeObject
from .enums import status_type_from_pb
from .enums import DrapingType, draping_type_from_pb, draping_type_to_pb, status_type_from_pb
from .fabric import Fabric
from .linked_selection_rule import LinkedSelectionRule
from .lookup_table_1d_column import LookUpTable1DColumn
from .lookup_table_3d_column import LookUpTable3DColumn
from .object_registry import register
from .oriented_selection_set import OrientedSelectionSet
from .production_ply import ProductionPly
Expand Down Expand Up @@ -70,9 +73,40 @@ class ModelingPly(CreatableTreeObject, IdTreeObject):
----------
name :
The name of the ModelingPly

ply_material :
The material (fabric, stackup or sub-laminate) of the ply.
ply_angle :
Design angle between the reference direction and the ply fiber direction.
number_of_layers :
Number of times the plies are generated.
active :
Inactive plies are ignored in ACP and the downstream analysis.
global_ply_nr :
Defines the global ply order.
selection_rules :
Selection Rules which may limit the extent of the ply.
draping :
Chooses between different draping formulations.
draping_seed_point :
Starting point of the draping algorithm.
auto_draping_direction :
If ``True``, the fiber direction of the production ply at the draping
seed point is used as draping direction.
draping_direction :
Set the primary draping direction for the draping algorithm. Only used if
``auto_draping_direction`` is ``False``.
draping_mesh_size :
Defines the mesh size for the draping algorithm. If set to ``-1.``, the
mesh size is automatically determined based on the average element size.
draping_thickness_correction :
Enables the thickness correction of draped plies based on the draping
shear angle.
draping_angle_1_field :
Correction angle between the fiber and draped fiber directions, in degree.
draping_angle_2_field :
Correction angle between the transverse and draped transverse directions,
in degree. Optional, uses the same values as ``draping_angle_1_field``
(no shear) by default.
"""

__slots__: Iterable[str] = tuple()
Expand All @@ -93,6 +127,14 @@ def __init__(
# if global_ply_nr == 0
global_ply_nr: int = 0,
selection_rules: Iterable[LinkedSelectionRule] = (),
draping: DrapingType = DrapingType.NO_DRAPING,
draping_seed_point: tuple[float, float, float] = (0.0, 0.0, 0.0),
auto_draping_direction: bool = True,
draping_direction: tuple[float, float, float] = (1.0, 0.0, 0.0),
draping_mesh_size: float = -1.0,
draping_thickness_correction: bool = True,
draping_angle_1_field: LookUpTable1DColumn | LookUpTable3DColumn | None = None,
draping_angle_2_field: LookUpTable1DColumn | LookUpTable3DColumn | None = None,
):
super().__init__(name=name)

Expand All @@ -103,6 +145,14 @@ def __init__(
self.active = active
self.global_ply_nr = global_ply_nr
self.selection_rules = selection_rules
self.draping = draping
self.draping_seed_point = draping_seed_point
self.auto_draping_direction = auto_draping_direction
self.draping_direction = draping_direction
self.draping_mesh_size = draping_mesh_size
self.draping_thickness_correction = draping_thickness_correction
self.draping_angle_1_field = draping_angle_1_field
self.draping_angle_2_field = draping_angle_2_field

def _create_stub(self) -> modeling_ply_pb2_grpc.ObjectServiceStub:
return modeling_ply_pb2_grpc.ObjectServiceStub(self._channel)
Expand All @@ -120,6 +170,25 @@ def _create_stub(self) -> modeling_ply_pb2_grpc.ObjectServiceStub:
active = grpc_data_property("properties.active")
global_ply_nr = grpc_data_property("properties.global_ply_nr")

draping = grpc_data_property(
"properties.draping", from_protobuf=draping_type_from_pb, to_protobuf=draping_type_to_pb
)
draping_seed_point = grpc_data_property(
"properties.draping_seed_point",
from_protobuf=to_tuple_from_1D_array,
to_protobuf=to_1D_double_array,
)
auto_draping_direction = grpc_data_property("properties.auto_draping_direction")
draping_direction = grpc_data_property(
"properties.draping_direction",
from_protobuf=to_tuple_from_1D_array,
to_protobuf=to_1D_double_array,
)
draping_mesh_size = grpc_data_property("properties.draping_mesh_size")
draping_thickness_correction = grpc_data_property("properties.draping_thickness_correction")
draping_angle_1_field = grpc_link_property("properties.draping_angle_1_field")
draping_angle_2_field = grpc_link_property("properties.draping_angle_2_field")

selection_rules = define_edge_property_list("properties.selection_rules", LinkedSelectionRule)

production_plies = property(
Expand Down
65 changes: 62 additions & 3 deletions src/ansys/acp/core/_tree_objects/oriented_selection_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
from .cylindrical_selection_rule import CylindricalSelectionRule
from .element_set import ElementSet
from .enums import (
DrapingMaterialType,
RosetteSelectionMethod,
draping_material_type_from_pb,
draping_material_type_to_pb,
rosette_selection_method_from_pb,
rosette_selection_method_to_pb,
status_type_from_pb,
Expand All @@ -34,6 +37,7 @@
from .rosette import Rosette
from .spherical_selection_rule import SphericalSelectionRule
from .tube_selection_rule import TubeSelectionRule
from .variable_offset_selection_rule import VariableOffsetSelectionRule

__all__ = [
"OrientedSelectionSet",
Expand Down Expand Up @@ -77,6 +81,26 @@ class OrientedSelectionSet(CreatableTreeObject, IdTreeObject):
Selection Method for Rosettes of the Oriented Selection Set.
selection_rules :
Selection Rules which may limit the extent of the Oriented Selection Set.
draping :
If ``True``, activate draping to adjust the reference directions.
draping_seed_point :
Starting point of the draping algorithm.
auto_draping_direction :
If ``True``, the reference direction of the Oriented Selection Set at
the seed point is used as draping direction.
draping_direction :
Set the primary draping direction for the draping algorithm. Only used if
``auto_draping_direction`` is ``False``.
draping_mesh_size :
Defines the mesh size for the draping algorithm. If set to ``-1.``, the
mesh size is automatically determined based on the average element size.
draping_material_model :
Chooses between different draping formulations.
draping_ud_coefficient :
Value between ``0`` and ``1`` which determines the amount of deformation
in the transverse direction if the draping material model is set to
:attr:`DrapingMaterialType.UD`.

"""

__slots__: Iterable[str] = tuple()
Expand All @@ -89,17 +113,31 @@ def __init__(
self,
name: str = "OrientedSelectionSet",
element_sets: Sequence[ElementSet] = tuple(),
orientation_point: tuple[float, ...] = (0.0, 0.0, 0.0),
orientation_direction: tuple[float, ...] = (0.0, 0.0, 0.0),
orientation_point: tuple[float, float, float] = (0.0, 0.0, 0.0),
orientation_direction: tuple[float, float, float] = (0.0, 0.0, 0.0),
rosettes: Sequence[Rosette] = tuple(),
rosette_selection_method: RosetteSelectionMethod = "minimum_angle",
draping: bool = False,
draping_seed_point: tuple[float, float, float] = (0.0, 0.0, 0.0),
auto_draping_direction: bool = True,
draping_direction: tuple[float, float, float] = (0.0, 0.0, 1.0),
draping_mesh_size: float = -1.0,
draping_material_model: DrapingMaterialType = DrapingMaterialType.WOVEN,
draping_ud_coefficient: float = 0.0,
):
super().__init__(name=name)
self.element_sets = element_sets
self.orientation_point = orientation_point
self.orientation_direction = orientation_direction
self.rosettes = rosettes
self.rosette_selection_method = RosetteSelectionMethod(rosette_selection_method)
self.draping = draping
self.draping_seed_point = draping_seed_point
self.auto_draping_direction = auto_draping_direction
self.draping_direction = draping_direction
self.draping_mesh_size = draping_mesh_size
self.draping_material_model = DrapingMaterialType(draping_material_model)
self.draping_ud_coefficient = draping_ud_coefficient

def _create_stub(self) -> oriented_selection_set_pb2_grpc.ObjectServiceStub:
return oriented_selection_set_pb2_grpc.ObjectServiceStub(self._channel)
Expand All @@ -126,13 +164,34 @@ def _create_stub(self) -> oriented_selection_set_pb2_grpc.ObjectServiceStub:
to_protobuf=rosette_selection_method_to_pb,
)

draping = grpc_data_property("properties.draping")
draping_seed_point = grpc_data_property(
"properties.draping_seed_point",
from_protobuf=to_tuple_from_1D_array,
to_protobuf=to_1D_double_array,
)
auto_draping_direction = grpc_data_property("properties.auto_draping_direction")
draping_direction = grpc_data_property(
"properties.draping_direction",
from_protobuf=to_tuple_from_1D_array,
to_protobuf=to_1D_double_array,
)
draping_mesh_size = grpc_data_property("properties.draping_mesh_size")
draping_material_model = grpc_data_property(
"properties.draping_material_model",
from_protobuf=draping_material_type_from_pb,
to_protobuf=draping_material_type_to_pb,
)
draping_ud_coefficient = grpc_data_property("properties.draping_ud_coefficient")

selection_rules = define_polymorphic_linked_object_list(
"properties.selection_rules",
(
allowed_types=(
ParallelSelectionRule,
CylindricalSelectionRule,
SphericalSelectionRule,
TubeSelectionRule,
VariableOffsetSelectionRule,
BooleanSelectionRule,
),
)
Expand Down
Loading