From bb441f8c2bb965a4a20e87210b0828d2f9c2e021 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Thu, 28 Nov 2024 11:10:48 +0100 Subject: [PATCH 1/6] Rename 'Cutoff' to 'CutOff' and 'cutoff' to 'cut_off' --- doc/source/api/enum_types.rst | 6 +- doc/source/api/mesh_data.rst | 4 +- doc/source/api/tree_objects.rst | 2 +- doc/source/user_guide/howto/print_model.rst | 2 +- examples/modeling_features/020-solid_model.py | 6 +- .../03-advanced-selection-rules.py | 26 +++---- src/ansys/acp/core/__init__.py | 16 ++-- src/ansys/acp/core/_tree_objects/__init__.py | 26 +++---- ...tion_rule.py => cut_off_selection_rule.py} | 78 +++++++++---------- src/ansys/acp/core/_tree_objects/enums.py | 30 +++---- src/ansys/acp/core/_tree_objects/fabric.py | 6 +- .../_tree_objects/linked_selection_rule.py | 12 +-- src/ansys/acp/core/_tree_objects/model.py | 12 +-- src/ansys/acp/core/_tree_objects/stackup.py | 6 +- src/ansys/acp/core/mesh_data.py | 8 +- ...rule.py => test_cut_off_selection_rule.py} | 32 ++++---- tests/unittests/test_fabric.py | 12 +-- tests/unittests/test_modeling_ply.py | 10 +-- tests/unittests/test_stackup.py | 6 +- tests/unittests/test_tree_printer.py | 6 +- type_checks/add_methods.py | 4 +- 21 files changed, 155 insertions(+), 155 deletions(-) rename src/ansys/acp/core/_tree_objects/{cutoff_selection_rule.py => cut_off_selection_rule.py} (71%) rename tests/unittests/{test_cutoff_selection_rule.py => test_cut_off_selection_rule.py} (70%) diff --git a/doc/source/api/enum_types.rst b/doc/source/api/enum_types.rst index 45f9808735..2777caae14 100644 --- a/doc/source/api/enum_types.rst +++ b/doc/source/api/enum_types.rst @@ -11,8 +11,8 @@ Enumeration data types BaseElementMaterialHandling BooleanOperationType CutOffGeometryOrientationType - CutoffMaterialHandling - CutoffRuleType + CutOffMaterialHandling + CutOffRuleType DimensionType DrapingMaterialModel DrapingType @@ -42,7 +42,7 @@ Enumeration data types SolidModelOffsetDirectionType OffsetType SnapToGeometryOrientationType - PlyCutoffType + PlyCutOffType PlyGeometryExportFormat PlyType ReinforcingBehavior diff --git a/doc/source/api/mesh_data.rst b/doc/source/api/mesh_data.rst index 1423ace5d6..3246a99aa5 100644 --- a/doc/source/api/mesh_data.rst +++ b/doc/source/api/mesh_data.rst @@ -10,8 +10,8 @@ Mesh data objects AnalysisPlyNodalData BooleanSelectionRuleElementalData BooleanSelectionRuleNodalData - CutoffSelectionRuleElementalData - CutoffSelectionRuleNodalData + CutOffSelectionRuleElementalData + CutOffSelectionRuleNodalData CylindricalSelectionRuleElementalData CylindricalSelectionRuleNodalData ElementSetElementalData diff --git a/doc/source/api/tree_objects.rst b/doc/source/api/tree_objects.rst index 170610f494..9905adf6da 100644 --- a/doc/source/api/tree_objects.rst +++ b/doc/source/api/tree_objects.rst @@ -12,7 +12,7 @@ ACP objects CADComponent CADGeometry CutOffGeometry - CutoffSelectionRule + CutOffSelectionRule CylindricalSelectionRule EdgeSet ElementSet diff --git a/doc/source/user_guide/howto/print_model.rst b/doc/source/user_guide/howto/print_model.rst index 8eaa709f90..fdf3fd3838 100644 --- a/doc/source/user_guide/howto/print_model.rst +++ b/doc/source/user_guide/howto/print_model.rst @@ -90,7 +90,7 @@ The ``hide_empty`` label can be set to ``False`` to also show empty groups: Cylindrical Selection Rules Spherical Selection Rules Tube Selection Rules - Cutoff Selection Rules + CutOff Selection Rules Geometrical Selection Rules Variable Offset Selection Rules Boolean Selection Rules diff --git a/examples/modeling_features/020-solid_model.py b/examples/modeling_features/020-solid_model.py index 9a62941a45..f4d7270381 100644 --- a/examples/modeling_features/020-solid_model.py +++ b/examples/modeling_features/020-solid_model.py @@ -167,17 +167,17 @@ def plot_model_with_geometry(cad_geometry: CADGeometry, cad_geom_opacity: float # --------------- # # The :class:`.CutOffGeometry` is used to crop elements from the solid model. -cutoff_cad_geom, cutoff_virtual_geom = create_virtual_geometry_from_file( +cut_off_cad_geom, cut_off_virtual_geom = create_virtual_geometry_from_file( ExampleKeys.CUT_OFF_GEOMETRY_SOLID_MODEL ) solid_model.create_cut_off_geometry( name="Cut-off Geometry", - cad_geometry=cutoff_virtual_geom, + cad_geometry=cut_off_virtual_geom, orientation_type=CutOffGeometryOrientationType.UP, ) model.update() -plot_model_with_geometry(cutoff_cad_geom) +plot_model_with_geometry(cut_off_cad_geom) # %% diff --git a/examples/modeling_features/03-advanced-selection-rules.py b/examples/modeling_features/03-advanced-selection-rules.py index 17a0743697..1379d373db 100644 --- a/examples/modeling_features/03-advanced-selection-rules.py +++ b/examples/modeling_features/03-advanced-selection-rules.py @@ -179,14 +179,14 @@ plotter.show() # %% -# Create a cutoff selection rule -# ------------------------------ +# Create a cut off selection rule +# ------------------------------- # %% -# Add the cutoff CAD geometry to the model. -cutoff_plane_path = get_example_file(ExampleKeys.CUT_OFF_GEOMETRY, WORKING_DIR) +# Add the cut off CAD geometry to the model. +cut_off_plane_path = get_example_file(ExampleKeys.CUT_OFF_GEOMETRY, WORKING_DIR) cut_off_plane = model.create_cad_geometry() -cut_off_plane.refresh(cutoff_plane_path) +cut_off_plane.refresh(cut_off_plane_path) # Note: It is important to update the model here, because the root_shapes of the # cad_geometry are not available until the model is updated. @@ -194,22 +194,22 @@ # %% # Create a virtual geometry from the CAD geometry. -cutoff_virtual_geometry = model.create_virtual_geometry( - name="cutoff_virtual_geometry", cad_components=cut_off_plane.root_shapes.values() +cut_off_virtual_geometry = model.create_virtual_geometry( + name="cut_off_virtual_geometry", cad_components=cut_off_plane.root_shapes.values() ) # %% -# Create the cutoff selection rule. -cutoff_selection_rule = model.create_cutoff_selection_rule( - name="cutoff_rule", - cutoff_geometry=cutoff_virtual_geometry, +# Create the cut_off selection rule. +cut_off_selection_rule = model.create_cut_off_selection_rule( + name="cut_off_rule", + cut_off_geometry=cut_off_virtual_geometry, ) # %% -# Assign the cutoff selection rule to the ply. Plot the ply extent with +# Assign the cut_off selection rule to the ply. Plot the ply extent with # the outline of the geometry. -modeling_ply.selection_rules = [LinkedSelectionRule(cutoff_selection_rule)] +modeling_ply.selection_rules = [LinkedSelectionRule(cut_off_selection_rule)] model.update() assert model.elemental_data.thickness is not None diff --git a/src/ansys/acp/core/__init__.py b/src/ansys/acp/core/__init__.py index 63186aacf7..40879b3760 100644 --- a/src/ansys/acp/core/__init__.py +++ b/src/ansys/acp/core/__init__.py @@ -57,9 +57,9 @@ CoordinateTransformation, CutOffGeometry, CutOffGeometryOrientationType, - CutoffMaterialHandling, - CutoffRuleType, - CutoffSelectionRule, + CutOffMaterialHandling, + CutOffRuleType, + CutOffSelectionRule, CylindricalSelectionRule, DimensionType, DrapingMaterialModel, @@ -115,7 +115,7 @@ OffsetType, OrientedSelectionSet, ParallelSelectionRule, - PlyCutoffType, + PlyCutOffType, PlyGeometryExportFormat, PlyType, PrimaryPly, @@ -175,9 +175,9 @@ "CoordinateTransformation", "CutOffGeometry", "CutOffGeometryOrientationType", - "CutoffMaterialHandling", - "CutoffRuleType", - "CutoffSelectionRule", + "CutOffMaterialHandling", + "CutOffRuleType", + "CutOffSelectionRule", "CylindricalSelectionRule", "DimensionType", "DirectLaunchConfig", @@ -245,7 +245,7 @@ "OffsetType", "OrientedSelectionSet", "ParallelSelectionRule", - "PlyCutoffType", + "PlyCutOffType", "PlyGeometryExportFormat", "SolidModelOffsetDirectionType", "PlyType", diff --git a/src/ansys/acp/core/_tree_objects/__init__.py b/src/ansys/acp/core/_tree_objects/__init__.py index 3968b7e434..e045e5efae 100644 --- a/src/ansys/acp/core/_tree_objects/__init__.py +++ b/src/ansys/acp/core/_tree_objects/__init__.py @@ -32,10 +32,10 @@ from .cad_component import CADComponent from .cad_geometry import CADGeometry, TriangleMesh from .cut_off_geometry import CutOffGeometry -from .cutoff_selection_rule import ( - CutoffSelectionRule, - CutoffSelectionRuleElementalData, - CutoffSelectionRuleNodalData, +from .cut_off_selection_rule import ( + CutOffSelectionRule, + CutOffSelectionRuleElementalData, + CutOffSelectionRuleNodalData, ) from .cylindrical_selection_rule import ( CylindricalSelectionRule, @@ -49,8 +49,8 @@ BaseElementMaterialHandling, BooleanOperationType, CutOffGeometryOrientationType, - CutoffMaterialHandling, - CutoffRuleType, + CutOffMaterialHandling, + CutOffRuleType, DimensionType, DrapingMaterialModel, DrapingType, @@ -72,7 +72,7 @@ MeshImportType, NodalDataType, OffsetType, - PlyCutoffType, + PlyCutOffType, PlyGeometryExportFormat, PlyType, ReinforcingBehavior, @@ -196,11 +196,11 @@ "CoordinateTransformation", "CutOffGeometry", "CutOffGeometryOrientationType", - "CutoffMaterialHandling", - "CutoffRuleType", - "CutoffSelectionRule", - "CutoffSelectionRuleElementalData", - "CutoffSelectionRuleNodalData", + "CutOffMaterialHandling", + "CutOffRuleType", + "CutOffSelectionRule", + "CutOffSelectionRuleElementalData", + "CutOffSelectionRuleNodalData", "CylindricalSelectionRule", "CylindricalSelectionRuleElementalData", "CylindricalSelectionRuleNodalData", @@ -276,7 +276,7 @@ "ParallelSelectionRule", "ParallelSelectionRuleElementalData", "ParallelSelectionRuleNodalData", - "PlyCutoffType", + "PlyCutOffType", "PlyGeometryExportFormat", "PlyType", "PrimaryPly", diff --git a/src/ansys/acp/core/_tree_objects/cutoff_selection_rule.py b/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py similarity index 71% rename from src/ansys/acp/core/_tree_objects/cutoff_selection_rule.py rename to src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py index a297f4ec00..38299f7d96 100644 --- a/src/ansys/acp/core/_tree_objects/cutoff_selection_rule.py +++ b/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py @@ -45,12 +45,12 @@ from .base import CreatableTreeObject, IdTreeObject from .edge_set import EdgeSet from .enums import ( - CutoffRuleType, - PlyCutoffType, - cutoff_rule_type_from_pb, - cutoff_rule_type_to_pb, - ply_cutoff_type_from_pb, - ply_cutoff_type_to_pb, + CutOffRuleType, + PlyCutOffType, + cut_off_rule_type_from_pb, + cut_off_rule_type_to_pb, + ply_cut_off_type_from_pb, + ply_cut_off_type_to_pb, status_type_from_pb, ) from .object_registry import register @@ -63,50 +63,50 @@ __all__ = [ - "CutoffSelectionRule", - "CutoffSelectionRuleElementalData", - "CutoffSelectionRuleNodalData", + "CutOffSelectionRule", + "CutOffSelectionRuleElementalData", + "CutOffSelectionRuleNodalData", ] @dataclasses.dataclass -class CutoffSelectionRuleElementalData(ElementalData): - """Represents elemental data for a Cutoff Selection Rule.""" +class CutOffSelectionRuleElementalData(ElementalData): + """Represents elemental data for a CutOff Selection Rule.""" normal: VectorData | None = None @dataclasses.dataclass -class CutoffSelectionRuleNodalData(NodalData): - """Represents nodal data for a Cutoff Selection Rule.""" +class CutOffSelectionRuleNodalData(NodalData): + """Represents nodal data for a CutOff Selection Rule.""" @mark_grpc_properties @register -class CutoffSelectionRule(CreatableTreeObject, IdTreeObject): - """Instantiate a Cutoff Selection Rule. +class CutOffSelectionRule(CreatableTreeObject, IdTreeObject): + """Instantiate a Cut Off Selection Rule. Parameters ---------- name : - Name of the Cutoff Selection Rule. - cutoff_rule_type : + Name of the Cut Off Selection Rule. + cut_off_rule_type : Determines if the cut-off is defined by a geometry or by a tapering edge. - cutoff_geometry : + cut_off_geometry : Geometry used to define the cut-off. Only applies if - ``cutoff_rule_type`` is GEOMETRY. + ``cut_off_rule_type`` is GEOMETRY. taper_edge_set : Edge used to define the cut-off. Only applies if - ``cutoff_rule_type`` is :attr:`.CutoffRuleType.TAPER`. + ``cut_off_rule_type`` is :attr:`.CutOffRuleType.TAPER`. offset : Moves the cutting plane along the out-of-plane direction. Always measured from the reference surface. angle : Defines the angle between the cutting plane and the reference surface. - ply_cutoff_type : + ply_cut_off_type : Either the complete production ply is cut-off - (:attr:`PlyCutoffType.PRODUCTION_PLY_CUTOFF`) or individual analysis plies - (:attr:`PlyCutoffType.ANALYSIS_PLY_CUTOFF`). + (:attr:`PlyCutOffType.PRODUCTION_PLY_CUTOFF`) or individual analysis plies + (:attr:`PlyCutOffType.ANALYSIS_PLY_CUTOFF`). ply_tapering : Whether the tapering of analysis plies is enabled. """ @@ -121,22 +121,22 @@ class CutoffSelectionRule(CreatableTreeObject, IdTreeObject): def __init__( self, *, - name: str = "CutoffSelectionrule", - cutoff_rule_type: CutoffRuleType = CutoffRuleType.GEOMETRY, - cutoff_geometry: VirtualGeometry | None = None, + name: str = "CutOffSelectionrule", + cut_off_rule_type: CutOffRuleType = CutOffRuleType.GEOMETRY, + cut_off_geometry: VirtualGeometry | None = None, taper_edge_set: EdgeSet | None = None, offset: float = 0.0, angle: float = 0.0, - ply_cutoff_type: PlyCutoffType = PlyCutoffType.PRODUCTION_PLY_CUTOFF, + ply_cut_off_type: PlyCutOffType = PlyCutOffType.PRODUCTION_PLY_CUTOFF, ply_tapering: bool = False, ): super().__init__(name=name) - self.cutoff_rule_type = cutoff_rule_type - self.cutoff_geometry = cutoff_geometry + self.cut_off_rule_type = cut_off_rule_type + self.cut_off_geometry = cut_off_geometry self.taper_edge_set = taper_edge_set self.offset = offset self.angle = angle - self.ply_cutoff_type = ply_cutoff_type + self.ply_cut_off_type = ply_cut_off_type self.ply_tapering = ply_tapering def _create_stub(self) -> cutoff_selection_rule_pb2_grpc.ObjectServiceStub: @@ -144,26 +144,26 @@ def _create_stub(self) -> cutoff_selection_rule_pb2_grpc.ObjectServiceStub: status = grpc_data_property_read_only("properties.status", from_protobuf=status_type_from_pb) - cutoff_rule_type = grpc_data_property( + cut_off_rule_type = grpc_data_property( "properties.cutoff_rule_type", - from_protobuf=cutoff_rule_type_from_pb, - to_protobuf=cutoff_rule_type_to_pb, + from_protobuf=cut_off_rule_type_from_pb, + to_protobuf=cut_off_rule_type_to_pb, ) - cutoff_geometry = grpc_link_property( + cut_off_geometry = grpc_link_property( "properties.cutoff_geometry", allowed_types=VirtualGeometry ) taper_edge_set = grpc_link_property("properties.taper_edge_set", allowed_types=EdgeSet) offset: ReadWriteProperty[float, float] = grpc_data_property("properties.offset") angle: ReadWriteProperty[float, float] = grpc_data_property("properties.angle") - ply_cutoff_type = grpc_data_property( + ply_cut_off_type = grpc_data_property( "properties.ply_cutoff_type", - from_protobuf=ply_cutoff_type_from_pb, - to_protobuf=ply_cutoff_type_to_pb, + from_protobuf=ply_cut_off_type_from_pb, + to_protobuf=ply_cut_off_type_to_pb, ) ply_tapering: ReadWriteProperty[bool, bool] = grpc_data_property("properties.ply_tapering") mesh = full_mesh_property shell_mesh = shell_mesh_property # selection rules don't have solid mesh data - elemental_data = elemental_data_property(CutoffSelectionRuleElementalData) - nodal_data = nodal_data_property(CutoffSelectionRuleNodalData) + elemental_data = elemental_data_property(CutOffSelectionRuleElementalData) + nodal_data = nodal_data_property(CutOffSelectionRuleNodalData) diff --git a/src/ansys/acp/core/_tree_objects/enums.py b/src/ansys/acp/core/_tree_objects/enums.py index d4715cdd91..fb39ac5f34 100644 --- a/src/ansys/acp/core/_tree_objects/enums.py +++ b/src/ansys/acp/core/_tree_objects/enums.py @@ -51,8 +51,8 @@ "ArrowType", "BooleanOperationType", "CutOffGeometryOrientationType", - "CutoffMaterialHandling", - "CutoffRuleType", + "CutOffMaterialHandling", + "CutOffRuleType", "DimensionType", "DrapingMaterialModel", "DrapingType", @@ -77,7 +77,7 @@ "NodalDataType", "SolidModelOffsetDirectionType", "OffsetType", - "PlyCutoffType", + "PlyCutOffType", "PlyGeometryExportFormat", "PlyType", "RosetteSelectionMethod", @@ -114,11 +114,11 @@ ) ( - CutoffMaterialHandling, + CutOffMaterialHandling, cut_off_material_type_to_pb, cut_off_material_type_from_pb, ) = wrap_to_string_enum( - "CutoffMaterialHandling", + "CutOffMaterialHandling", cut_off_material_pb2.MaterialHandlingType, module=__name__, doc="Options for how cut-off material is selected.", @@ -344,25 +344,25 @@ ) ( - CutoffRuleType, - cutoff_rule_type_to_pb, - cutoff_rule_type_from_pb, + CutOffRuleType, + cut_off_rule_type_to_pb, + cut_off_rule_type_from_pb, ) = wrap_to_string_enum( - "CutoffRuleType", + "CutOffRuleType", cutoff_selection_rule_pb2.CutoffRuleType, module=__name__, - doc="Options for how a cutoff rule is defined.", + doc="Options for how a cut off rule is defined.", ) ( - PlyCutoffType, - ply_cutoff_type_to_pb, - ply_cutoff_type_from_pb, + PlyCutOffType, + ply_cut_off_type_to_pb, + ply_cut_off_type_from_pb, ) = wrap_to_string_enum( - "PlyCutoffType", + "PlyCutOffType", cutoff_selection_rule_pb2.PlyCutoffType, module=__name__, - doc="Options for how ply cutoff is computed.", + doc="Options for how ply cut-off is computed.", ) ( diff --git a/src/ansys/acp/core/_tree_objects/fabric.py b/src/ansys/acp/core/_tree_objects/fabric.py index 4ff1fc2f0c..f5e103bcfd 100644 --- a/src/ansys/acp/core/_tree_objects/fabric.py +++ b/src/ansys/acp/core/_tree_objects/fabric.py @@ -35,7 +35,7 @@ ) from .base import CreatableTreeObject, IdTreeObject from .enums import ( - CutoffMaterialHandling, + CutOffMaterialHandling, DrapingMaterialModel, DropoffMaterialHandling, cut_off_material_type_from_pb, @@ -102,7 +102,7 @@ def __init__( ignore_for_postprocessing: bool = False, drop_off_material_handling: DropoffMaterialHandling = "global", drop_off_material: Material | None = None, - cut_off_material_handling: CutoffMaterialHandling = "computed", + cut_off_material_handling: CutOffMaterialHandling = "computed", cut_off_material: Material | None = None, draping_material_model: DrapingMaterialModel = "woven", draping_ud_coefficient: float = 0.0, @@ -115,7 +115,7 @@ def __init__( self.ignore_for_postprocessing = ignore_for_postprocessing self.drop_off_material_handling = DropoffMaterialHandling(drop_off_material_handling) self.drop_off_material = drop_off_material - self.cut_off_material_handling = CutoffMaterialHandling(cut_off_material_handling) + self.cut_off_material_handling = CutOffMaterialHandling(cut_off_material_handling) self.cut_off_material = cut_off_material self.draping_material_model = DrapingMaterialModel(draping_material_model) self.draping_ud_coefficient = draping_ud_coefficient diff --git a/src/ansys/acp/core/_tree_objects/linked_selection_rule.py b/src/ansys/acp/core/_tree_objects/linked_selection_rule.py index bd852527e7..146f87b685 100644 --- a/src/ansys/acp/core/_tree_objects/linked_selection_rule.py +++ b/src/ansys/acp/core/_tree_objects/linked_selection_rule.py @@ -34,7 +34,7 @@ from ._grpc_helpers.polymorphic_from_pb import tree_object_from_resource_path from ._grpc_helpers.property_helper import _exposed_grpc_property, mark_grpc_properties from .base import CreatableTreeObject -from .cutoff_selection_rule import CutoffSelectionRule +from .cut_off_selection_rule import CutOffSelectionRule from .cylindrical_selection_rule import CylindricalSelectionRule from .enums import ( BooleanOperationType, @@ -54,7 +54,7 @@ _LINKABLE_SELECTION_RULE_TYPES: TypeAlias = Union[ "BooleanSelectionRule", - CutoffSelectionRule, + CutOffSelectionRule, CylindricalSelectionRule, GeometricalSelectionRule, ParallelSelectionRule, @@ -101,7 +101,7 @@ class LinkedSelectionRule(GenericEdgePropertyType): :class:`.BooleanSelectionRule` \- \- ====================================== ================================== =================== - Note that :class:`.CutoffSelectionRule` and :class:`.BooleanSelectionRule` objects cannot be linked to + Note that :class:`.CutOffSelectionRule` and :class:`.BooleanSelectionRule` objects cannot be linked to a Boolean Selection Rule, only to a Modeling Ply.. """ @@ -147,11 +147,11 @@ def operation_type(self) -> BooleanOperationType: def operation_type(self, value: BooleanOperationType) -> None: # The backend converts the operation automatically; this is confusing # in the scripting context where the associated warning may not be visible. - if isinstance(self._selection_rule, CutoffSelectionRule): + if isinstance(self._selection_rule, CutOffSelectionRule): if value != BooleanOperationType.INTERSECT: raise ValueError( "Cannot use a boolean operation other than 'INTERSECT' with a " - "CutoffSelectionRule." + "CutOffSelectionRule." ) self._operation_type = value @@ -213,7 +213,7 @@ def _from_pb_object( VariableOffsetSelectionRule, ] if not isinstance(parent_object, BooleanSelectionRule): - allowed_types_list += [CutoffSelectionRule, BooleanSelectionRule] + allowed_types_list += [CutOffSelectionRule, BooleanSelectionRule] allowed_types = tuple(allowed_types_list) selection_rule = tree_object_from_resource_path( diff --git a/src/ansys/acp/core/_tree_objects/model.py b/src/ansys/acp/core/_tree_objects/model.py index 947dd24d73..c11ba8a4a4 100644 --- a/src/ansys/acp/core/_tree_objects/model.py +++ b/src/ansys/acp/core/_tree_objects/model.py @@ -94,7 +94,7 @@ from .base import ServerWrapper, TreeObject from .boolean_selection_rule import BooleanSelectionRule from .cad_geometry import CADGeometry -from .cutoff_selection_rule import CutoffSelectionRule +from .cut_off_selection_rule import CutOffSelectionRule from .cylindrical_selection_rule import CylindricalSelectionRule from .edge_set import EdgeSet from .element_set import ElementSet @@ -855,14 +855,14 @@ def export_modeling_ply_geometries( TubeSelectionRule, tube_selection_rule_pb2_grpc.ObjectServiceStub ) - create_cutoff_selection_rule = define_create_method( - CutoffSelectionRule, - func_name="create_cutoff_selection_rule", + create_cut_off_selection_rule = define_create_method( + CutOffSelectionRule, + func_name="create_cut_off_selection_rule", parent_class_name="Model", module_name=__module__, ) - cutoff_selection_rules = define_mutable_mapping( - CutoffSelectionRule, cutoff_selection_rule_pb2_grpc.ObjectServiceStub + cut_off_selection_rules = define_mutable_mapping( + CutOffSelectionRule, cutoff_selection_rule_pb2_grpc.ObjectServiceStub ) create_geometrical_selection_rule = define_create_method( diff --git a/src/ansys/acp/core/_tree_objects/stackup.py b/src/ansys/acp/core/_tree_objects/stackup.py index aeb33a82f9..0f469cef6b 100644 --- a/src/ansys/acp/core/_tree_objects/stackup.py +++ b/src/ansys/acp/core/_tree_objects/stackup.py @@ -44,7 +44,7 @@ ) from .base import CreatableTreeObject, IdTreeObject from .enums import ( - CutoffMaterialHandling, + CutOffMaterialHandling, DrapingMaterialModel, DropoffMaterialHandling, SymmetryType, @@ -200,7 +200,7 @@ def __init__( drop_off_material_handling: DropoffMaterialHandling = "global", drop_off_material: Material | None = None, cut_off_material: Material | None = None, - cut_off_material_handling: CutoffMaterialHandling = "computed", + cut_off_material_handling: CutOffMaterialHandling = "computed", draping_material_model: DrapingMaterialModel = "woven", draping_ud_coefficient: float = 0.0, ): @@ -212,7 +212,7 @@ def __init__( self.fabrics = fabrics self.drop_off_material_handling = DropoffMaterialHandling(drop_off_material_handling) self.drop_off_material = drop_off_material - self.cut_off_material_handling = CutoffMaterialHandling(cut_off_material_handling) + self.cut_off_material_handling = CutOffMaterialHandling(cut_off_material_handling) self.cut_off_material = cut_off_material self.draping_material_model = DrapingMaterialModel(draping_material_model) self.draping_ud_coefficient = draping_ud_coefficient diff --git a/src/ansys/acp/core/mesh_data.py b/src/ansys/acp/core/mesh_data.py index 1d235fcf33..58ec11a016 100644 --- a/src/ansys/acp/core/mesh_data.py +++ b/src/ansys/acp/core/mesh_data.py @@ -30,8 +30,8 @@ AnalysisPlyNodalData, BooleanSelectionRuleElementalData, BooleanSelectionRuleNodalData, - CutoffSelectionRuleElementalData, - CutoffSelectionRuleNodalData, + CutOffSelectionRuleElementalData, + CutOffSelectionRuleNodalData, CylindricalSelectionRuleElementalData, CylindricalSelectionRuleNodalData, ElementSetElementalData, @@ -71,8 +71,8 @@ "AnalysisPlyNodalData", "BooleanSelectionRuleElementalData", "BooleanSelectionRuleNodalData", - "CutoffSelectionRuleElementalData", - "CutoffSelectionRuleNodalData", + "CutOffSelectionRuleElementalData", + "CutOffSelectionRuleNodalData", "CylindricalSelectionRuleElementalData", "CylindricalSelectionRuleNodalData", "ElementSetElementalData", diff --git a/tests/unittests/test_cutoff_selection_rule.py b/tests/unittests/test_cut_off_selection_rule.py similarity index 70% rename from tests/unittests/test_cutoff_selection_rule.py rename to tests/unittests/test_cut_off_selection_rule.py index 2157117777..3d996270e2 100644 --- a/tests/unittests/test_cutoff_selection_rule.py +++ b/tests/unittests/test_cut_off_selection_rule.py @@ -22,8 +22,8 @@ import pytest -from ansys.acp.core import CutoffRuleType, PlyCutoffType -from ansys.acp.core.mesh_data import CutoffSelectionRuleElementalData, CutoffSelectionRuleNodalData +from ansys.acp.core import CutOffRuleType, PlyCutOffType +from ansys.acp.core.mesh_data import CutOffSelectionRuleElementalData, CutOffSelectionRuleNodalData from .common.tree_object_tester import NoLockedMixin, ObjectPropertiesToTest, TreeObjectTester @@ -36,27 +36,27 @@ def parent_object(load_model_from_tempfile): @pytest.fixture def tree_object(parent_object): - return parent_object.create_cutoff_selection_rule() + return parent_object.create_cut_off_selection_rule() -class TestCutoffSelectionRule(NoLockedMixin, TreeObjectTester): - COLLECTION_NAME = "cutoff_selection_rules" +class TestCutOffSelectionRule(NoLockedMixin, TreeObjectTester): + COLLECTION_NAME = "cut_off_selection_rules" @staticmethod @pytest.fixture def default_properties(): return { "status": "NOTUPTODATE", - "cutoff_rule_type": CutoffRuleType.GEOMETRY, - "cutoff_geometry": None, + "cut_off_rule_type": CutOffRuleType.GEOMETRY, + "cut_off_geometry": None, "taper_edge_set": None, "offset": 0.0, "angle": 0.0, - "ply_cutoff_type": PlyCutoffType.PRODUCTION_PLY_CUTOFF, + "ply_cut_off_type": PlyCutOffType.PRODUCTION_PLY_CUTOFF, "ply_tapering": False, } - CREATE_METHOD_NAME = "create_cutoff_selection_rule" + CREATE_METHOD_NAME = "create_cut_off_selection_rule" @staticmethod @pytest.fixture @@ -66,13 +66,13 @@ def object_properties(parent_object): edge_set = model.create_edge_set() return ObjectPropertiesToTest( read_write=[ - ("name", "Cutoff Selection Rule name"), - ("cutoff_rule_type", CutoffRuleType.TAPER), - ("cutoff_geometry", geometry), + ("name", "CutOff Selection Rule name"), + ("cut_off_rule_type", CutOffRuleType.TAPER), + ("cut_off_geometry", geometry), ("taper_edge_set", edge_set), ("offset", 1.2), ("angle", 2.3), - ("ply_cutoff_type", PlyCutoffType.ANALYSIS_PLY_CUTOFF), + ("ply_cut_off_type", PlyCutOffType.ANALYSIS_PLY_CUTOFF), ("ply_tapering", True), ], read_only=[ @@ -83,6 +83,6 @@ def object_properties(parent_object): def test_mesh_data(parent_object): - rule = parent_object.create_cutoff_selection_rule() - assert isinstance(rule.elemental_data, CutoffSelectionRuleElementalData) - assert isinstance(rule.nodal_data, CutoffSelectionRuleNodalData) + rule = parent_object.create_cut_off_selection_rule() + assert isinstance(rule.elemental_data, CutOffSelectionRuleElementalData) + assert isinstance(rule.nodal_data, CutOffSelectionRuleNodalData) diff --git a/tests/unittests/test_fabric.py b/tests/unittests/test_fabric.py index 70b251c591..0d4ef5c0a3 100644 --- a/tests/unittests/test_fabric.py +++ b/tests/unittests/test_fabric.py @@ -23,7 +23,7 @@ from packaging.version import parse as parse_version import pytest -from ansys.acp.core import CutoffMaterialHandling, DrapingMaterialModel, DropoffMaterialHandling +from ansys.acp.core import CutOffMaterialHandling, DrapingMaterialModel, DropoffMaterialHandling from .common.tree_object_tester import NoLockedMixin, ObjectPropertiesToTest, TreeObjectTester @@ -52,7 +52,7 @@ def default_properties(acp_instance): "area_price": 0.0, "ignore_for_postprocessing": False, "drop_off_material_handling": DropoffMaterialHandling.GLOBAL, - "cut_off_material_handling": CutoffMaterialHandling.COMPUTED, + "cut_off_material_handling": CutOffMaterialHandling.COMPUTED, "draping_material_model": DrapingMaterialModel.WOVEN, "draping_ud_coefficient": 0.0, "material": None, @@ -65,7 +65,7 @@ def default_properties(acp_instance): "ignore_for_postprocessing": False, "drop_off_material_handling": DropoffMaterialHandling.GLOBAL, "drop_off_material": None, - "cut_off_material_handling": CutoffMaterialHandling.COMPUTED, + "cut_off_material_handling": CutOffMaterialHandling.COMPUTED, "cut_off_material": None, "draping_material_model": DrapingMaterialModel.WOVEN, "draping_ud_coefficient": 0.0, @@ -89,7 +89,7 @@ def object_properties(parent_object, acp_instance): ("area_price", 5.98), ("ignore_for_postprocessing", True), ("drop_off_material_handling", DropoffMaterialHandling.GLOBAL), - ("cut_off_material_handling", CutoffMaterialHandling.COMPUTED), + ("cut_off_material_handling", CutOffMaterialHandling.COMPUTED), ("draping_material_model", DrapingMaterialModel.UD), ("draping_ud_coefficient", 0.55), ("material", material), @@ -112,7 +112,7 @@ def object_properties(parent_object, acp_instance): ("ignore_for_postprocessing", True), ("drop_off_material_handling", DropoffMaterialHandling.CUSTOM), ("drop_off_material", drop_off_material), - ("cut_off_material_handling", CutoffMaterialHandling.CUSTOM), + ("cut_off_material_handling", CutOffMaterialHandling.CUSTOM), ("cut_off_material", cut_off_material), ("draping_material_model", DrapingMaterialModel.UD), ("draping_ud_coefficient", 0.55), @@ -131,7 +131,7 @@ def object_properties(parent_object, acp_instance): @pytest.mark.parametrize("material_type", ["cut_off_material", "drop_off_material"]) def test_solid_model_materials(parent_object, tree_object, acp_instance, material_type): """Check that solid model materials are supported since 25.1.""" - tree_object.cut_off_material_handling = CutoffMaterialHandling.CUSTOM + tree_object.cut_off_material_handling = CutOffMaterialHandling.CUSTOM tree_object.drop_off_material_handling = DropoffMaterialHandling.CUSTOM if parse_version(acp_instance.server_version) < parse_version("25.1"): with pytest.raises(RuntimeError) as exc: diff --git a/tests/unittests/test_modeling_ply.py b/tests/unittests/test_modeling_ply.py index b676db551a..84878e3425 100644 --- a/tests/unittests/test_modeling_ply.py +++ b/tests/unittests/test_modeling_ply.py @@ -26,7 +26,7 @@ from ansys.acp.core import ( BooleanOperationType, - CutoffSelectionRule, + CutOffSelectionRule, DrapingType, ElementalDataType, Fabric, @@ -148,7 +148,7 @@ def object_properties(request, parent_model): parameter_2=0.0, ), LinkedSelectionRule( - selection_rule=parent_model.create_cutoff_selection_rule(), + selection_rule=parent_model.create_cut_off_selection_rule(), operation_type=BooleanOperationType.INTERSECT, template_rule=True, parameter_1=1.2, @@ -447,11 +447,11 @@ def test_linked_selection_rule_parameters(simple_modeling_ply, minimal_complete_ @pytest.mark.parametrize( "operation_type", [e for e in BooleanOperationType if e != BooleanOperationType.INTERSECT] ) -def test_linked_cutoff_selection_rule_operation_type(operation_type): - """Check that CutoffSelectionRule only allows INTERSECT operation type.""" +def test_linked_cut_off_selection_rule_operation_type(operation_type): + """Check that CutOffSelectionRule only allows INTERSECT operation type.""" with pytest.raises(ValueError) as exc: LinkedSelectionRule( - selection_rule=CutoffSelectionRule(), + selection_rule=CutOffSelectionRule(), operation_type=operation_type, ) assert "INTERSECT" in str(exc.value) diff --git a/tests/unittests/test_stackup.py b/tests/unittests/test_stackup.py index 036b89d391..43f7185cdb 100644 --- a/tests/unittests/test_stackup.py +++ b/tests/unittests/test_stackup.py @@ -23,7 +23,7 @@ import pytest from ansys.acp.core import ( - CutoffMaterialHandling, + CutOffMaterialHandling, DrapingMaterialModel, DropoffMaterialHandling, FabricWithAngle, @@ -58,7 +58,7 @@ def default_properties(): "symmetry": SymmetryType.NO_SYMMETRY, "drop_off_material_handling": DropoffMaterialHandling.GLOBAL, "drop_off_material": None, - "cut_off_material_handling": CutoffMaterialHandling.COMPUTED, + "cut_off_material_handling": CutOffMaterialHandling.COMPUTED, "cut_off_material": None, "draping_material_model": DrapingMaterialModel.WOVEN, "draping_ud_coefficient": 0.0, @@ -88,7 +88,7 @@ def object_properties(parent_object): ("symmetry", SymmetryType.EVEN_SYMMETRY), ("drop_off_material_handling", DropoffMaterialHandling.CUSTOM), ("drop_off_material", material), - ("cut_off_material_handling", CutoffMaterialHandling.CUSTOM), + ("cut_off_material_handling", CutOffMaterialHandling.CUSTOM), ("cut_off_material", material), ("draping_material_model", DrapingMaterialModel.UD), ("draping_ud_coefficient", 0.55), diff --git a/tests/unittests/test_tree_printer.py b/tests/unittests/test_tree_printer.py index ad53f495e6..d3ebe4d131 100644 --- a/tests/unittests/test_tree_printer.py +++ b/tests/unittests/test_tree_printer.py @@ -73,7 +73,7 @@ def case_more_objects(acp_instance, model_data_dir): model.create_parallel_selection_rule() model.create_cylindrical_selection_rule() model.create_tube_selection_rule() - model.create_cutoff_selection_rule() + model.create_cut_off_selection_rule() model.create_geometrical_selection_rule() model.create_boolean_selection_rule() model.create_lookup_table_1d() @@ -116,8 +116,8 @@ def case_more_objects(acp_instance, model_data_dir): 'CylindricalSelectionrule' Tube Selection Rules 'TubeSelectionrule' - Cutoff Selection Rules - 'CutoffSelectionrule' + Cut Off Selection Rules + 'CutOffSelectionrule' Geometrical Selection Rules 'GeometricalSelectionrule' Boolean Selection Rules diff --git a/type_checks/add_methods.py b/type_checks/add_methods.py index 552e077547..7d06eb821c 100644 --- a/type_checks/add_methods.py +++ b/type_checks/add_methods.py @@ -7,7 +7,7 @@ from ansys.acp.core import ( BooleanOperationType, BooleanSelectionRule, - CutoffSelectionRule, + CutOffSelectionRule, CylindricalSelectionRule, GeometricalSelectionRule, LinkedSelectionRule, @@ -30,7 +30,7 @@ Arg( Union[ BooleanSelectionRule, - CutoffSelectionRule, + CutOffSelectionRule, CylindricalSelectionRule, GeometricalSelectionRule, ParallelSelectionRule, From b7c30b67367fc78d37a9d52b2125f57eb5ced555 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Thu, 28 Nov 2024 11:15:21 +0100 Subject: [PATCH 2/6] Rename 'Dropoff' to 'DropOff' and 'dropoff' to 'drop_off' --- doc/source/api/enum_types.rst | 2 +- src/ansys/acp/core/__init__.py | 4 +- src/ansys/acp/core/_tree_objects/__init__.py | 4 +- src/ansys/acp/core/_tree_objects/enums.py | 6 +- src/ansys/acp/core/_tree_objects/fabric.py | 6 +- .../acp/core/_tree_objects/solid_model.py | 32 ++++---- src/ansys/acp/core/_tree_objects/stackup.py | 6 +- tests/unittests/test_fabric.py | 12 +-- tests/unittests/test_solid_model.py | 78 +++++++++---------- tests/unittests/test_stackup.py | 6 +- 10 files changed, 78 insertions(+), 78 deletions(-) diff --git a/doc/source/api/enum_types.rst b/doc/source/api/enum_types.rst index 2777caae14..f725fd0875 100644 --- a/doc/source/api/enum_types.rst +++ b/doc/source/api/enum_types.rst @@ -16,7 +16,7 @@ Enumeration data types DimensionType DrapingMaterialModel DrapingType - DropoffMaterialHandling + DropOffMaterialHandling DropOffType EdgeSetType ElementalDataType diff --git a/src/ansys/acp/core/__init__.py b/src/ansys/acp/core/__init__.py index 40879b3760..5d793e7944 100644 --- a/src/ansys/acp/core/__init__.py +++ b/src/ansys/acp/core/__init__.py @@ -64,7 +64,7 @@ DimensionType, DrapingMaterialModel, DrapingType, - DropoffMaterialHandling, + DropOffMaterialHandling, DropOffSettings, DropOffType, EdgeSet, @@ -184,7 +184,7 @@ "DockerComposeLaunchConfig", "DrapingMaterialModel", "DrapingType", - "DropoffMaterialHandling", + "DropOffMaterialHandling", "DropOffSettings", "DropOffType", "EdgeSet", diff --git a/src/ansys/acp/core/_tree_objects/__init__.py b/src/ansys/acp/core/_tree_objects/__init__.py index e045e5efae..3559a48a2f 100644 --- a/src/ansys/acp/core/_tree_objects/__init__.py +++ b/src/ansys/acp/core/_tree_objects/__init__.py @@ -54,7 +54,7 @@ DimensionType, DrapingMaterialModel, DrapingType, - DropoffMaterialHandling, + DropOffMaterialHandling, DropOffType, EdgeSetType, ElementalDataType, @@ -207,7 +207,7 @@ "DimensionType", "DrapingMaterialModel", "DrapingType", - "DropoffMaterialHandling", + "DropOffMaterialHandling", "DropOffSettings", "DropOffType", "EdgeSet", diff --git a/src/ansys/acp/core/_tree_objects/enums.py b/src/ansys/acp/core/_tree_objects/enums.py index fb39ac5f34..dda255f9b1 100644 --- a/src/ansys/acp/core/_tree_objects/enums.py +++ b/src/ansys/acp/core/_tree_objects/enums.py @@ -56,7 +56,7 @@ "DimensionType", "DrapingMaterialModel", "DrapingType", - "DropoffMaterialHandling", + "DropOffMaterialHandling", "DropOffType", "EdgeSetType", "ElementalDataType", @@ -125,11 +125,11 @@ ) ( - DropoffMaterialHandling, + DropOffMaterialHandling, drop_off_material_type_to_pb, drop_off_material_type_from_pb, ) = wrap_to_string_enum( - "DropoffMaterialHandling", + "DropOffMaterialHandling", drop_off_material_pb2.MaterialHandlingType, module=__name__, doc="Options for how drop-off material is selected.", diff --git a/src/ansys/acp/core/_tree_objects/fabric.py b/src/ansys/acp/core/_tree_objects/fabric.py index f5e103bcfd..5fd8e69afa 100644 --- a/src/ansys/acp/core/_tree_objects/fabric.py +++ b/src/ansys/acp/core/_tree_objects/fabric.py @@ -37,7 +37,7 @@ from .enums import ( CutOffMaterialHandling, DrapingMaterialModel, - DropoffMaterialHandling, + DropOffMaterialHandling, cut_off_material_type_from_pb, cut_off_material_type_to_pb, draping_material_type_from_pb, @@ -100,7 +100,7 @@ def __init__( thickness: float = 0.0, area_price: float = 0.0, ignore_for_postprocessing: bool = False, - drop_off_material_handling: DropoffMaterialHandling = "global", + drop_off_material_handling: DropOffMaterialHandling = "global", drop_off_material: Material | None = None, cut_off_material_handling: CutOffMaterialHandling = "computed", cut_off_material: Material | None = None, @@ -113,7 +113,7 @@ def __init__( self.thickness = thickness self.area_price = area_price self.ignore_for_postprocessing = ignore_for_postprocessing - self.drop_off_material_handling = DropoffMaterialHandling(drop_off_material_handling) + self.drop_off_material_handling = DropOffMaterialHandling(drop_off_material_handling) self.drop_off_material = drop_off_material self.cut_off_material_handling = CutOffMaterialHandling(cut_off_material_handling) self.cut_off_material = cut_off_material diff --git a/src/ansys/acp/core/_tree_objects/solid_model.py b/src/ansys/acp/core/_tree_objects/solid_model.py index 3e279efe4f..ed23dc7eeb 100644 --- a/src/ansys/acp/core/_tree_objects/solid_model.py +++ b/src/ansys/acp/core/_tree_objects/solid_model.py @@ -118,14 +118,14 @@ class DropOffSettings(TreeObjectAttributeWithCache): drop_off_type : Determines whether the ply's drop-off is inside or outside the boundary of the ply. - disable_dropoffs_on_bottom : + disable_drop_offs_on_bottom : Whether to remove drop-offs on the bottom surface of the laminate. - dropoff_disabled_on_bottom_sets : + drop_off_disabled_on_bottom_sets : Element sets or oriented selection sets on which drop-offs at the bottom surface are disabled. - disable_dropoffs_on_top : + disable_drop_offs_on_top : Whether to remove drop-offs on the top surface of the laminate. - dropoff_disabled_on_top_sets : + drop_off_disabled_on_top_sets : Element sets or oriented selection sets on which drop-offs at the top surface are disabled. connect_butt_joined_plies : @@ -139,10 +139,10 @@ def __init__( self, *, drop_off_type: DropOffType = DropOffType.INSIDE_PLY, - disable_dropoffs_on_bottom: bool = False, - dropoff_disabled_on_bottom_sets: Iterable[ElementSet | OrientedSelectionSet] = (), - disable_dropoffs_on_top: bool = False, - dropoff_disabled_on_top_sets: Iterable[ElementSet | OrientedSelectionSet] = (), + disable_drop_offs_on_bottom: bool = False, + drop_off_disabled_on_bottom_sets: Iterable[ElementSet | OrientedSelectionSet] = (), + disable_drop_offs_on_top: bool = False, + drop_off_disabled_on_top_sets: Iterable[ElementSet | OrientedSelectionSet] = (), connect_butt_joined_plies: bool = True, _parent_object: SolidModel | None = None, _pb_object: Any | None = None, @@ -160,10 +160,10 @@ def __init__( # values. if _parent_object is None and _pb_object is None: self.drop_off_type = drop_off_type - self.disable_dropoffs_on_bottom = disable_dropoffs_on_bottom - self.dropoff_disabled_on_bottom_sets = dropoff_disabled_on_bottom_sets - self.disable_dropoffs_on_top = disable_dropoffs_on_top - self.dropoff_disabled_on_top_sets = dropoff_disabled_on_top_sets + self.disable_drop_offs_on_bottom = disable_drop_offs_on_bottom + self.drop_off_disabled_on_bottom_sets = drop_off_disabled_on_bottom_sets + self.disable_drop_offs_on_top = disable_drop_offs_on_top + self.drop_off_disabled_on_top_sets = drop_off_disabled_on_top_sets self.connect_butt_joined_plies = connect_butt_joined_plies @classmethod @@ -187,17 +187,17 @@ def _create_default_pb_object(self) -> solid_model_pb2.DropOffSettings: to_protobuf=drop_off_type_to_pb, ) - disable_dropoffs_on_bottom: ReadWriteProperty[bool, bool] = grpc_data_property( + disable_drop_offs_on_bottom: ReadWriteProperty[bool, bool] = grpc_data_property( "disable_dropoffs_on_bottom" ) - dropoff_disabled_on_bottom_sets = define_polymorphic_linked_object_list( + drop_off_disabled_on_bottom_sets = define_polymorphic_linked_object_list( "dropoff_disabled_on_bottom_sets", allowed_types=(ElementSet, OrientedSelectionSet) ) - disable_dropoffs_on_top: ReadWriteProperty[bool, bool] = grpc_data_property( + disable_drop_offs_on_top: ReadWriteProperty[bool, bool] = grpc_data_property( "disable_dropoffs_on_top" ) - dropoff_disabled_on_top_sets = define_polymorphic_linked_object_list( + drop_off_disabled_on_top_sets = define_polymorphic_linked_object_list( "dropoff_disabled_on_top_sets", allowed_types=(ElementSet, OrientedSelectionSet) ) diff --git a/src/ansys/acp/core/_tree_objects/stackup.py b/src/ansys/acp/core/_tree_objects/stackup.py index 0f469cef6b..031ecfe599 100644 --- a/src/ansys/acp/core/_tree_objects/stackup.py +++ b/src/ansys/acp/core/_tree_objects/stackup.py @@ -46,7 +46,7 @@ from .enums import ( CutOffMaterialHandling, DrapingMaterialModel, - DropoffMaterialHandling, + DropOffMaterialHandling, SymmetryType, cut_off_material_type_from_pb, cut_off_material_type_to_pb, @@ -197,7 +197,7 @@ def __init__( topdown: bool = True, fabrics: Sequence[FabricWithAngle] = tuple(), area_price: float = 0.0, - drop_off_material_handling: DropoffMaterialHandling = "global", + drop_off_material_handling: DropOffMaterialHandling = "global", drop_off_material: Material | None = None, cut_off_material: Material | None = None, cut_off_material_handling: CutOffMaterialHandling = "computed", @@ -210,7 +210,7 @@ def __init__( self.topdown = topdown self.area_price = area_price self.fabrics = fabrics - self.drop_off_material_handling = DropoffMaterialHandling(drop_off_material_handling) + self.drop_off_material_handling = DropOffMaterialHandling(drop_off_material_handling) self.drop_off_material = drop_off_material self.cut_off_material_handling = CutOffMaterialHandling(cut_off_material_handling) self.cut_off_material = cut_off_material diff --git a/tests/unittests/test_fabric.py b/tests/unittests/test_fabric.py index 0d4ef5c0a3..b4b8fa198a 100644 --- a/tests/unittests/test_fabric.py +++ b/tests/unittests/test_fabric.py @@ -23,7 +23,7 @@ from packaging.version import parse as parse_version import pytest -from ansys.acp.core import CutOffMaterialHandling, DrapingMaterialModel, DropoffMaterialHandling +from ansys.acp.core import CutOffMaterialHandling, DrapingMaterialModel, DropOffMaterialHandling from .common.tree_object_tester import NoLockedMixin, ObjectPropertiesToTest, TreeObjectTester @@ -51,7 +51,7 @@ def default_properties(acp_instance): "thickness": 0.0, "area_price": 0.0, "ignore_for_postprocessing": False, - "drop_off_material_handling": DropoffMaterialHandling.GLOBAL, + "drop_off_material_handling": DropOffMaterialHandling.GLOBAL, "cut_off_material_handling": CutOffMaterialHandling.COMPUTED, "draping_material_model": DrapingMaterialModel.WOVEN, "draping_ud_coefficient": 0.0, @@ -63,7 +63,7 @@ def default_properties(acp_instance): "thickness": 0.0, "area_price": 0.0, "ignore_for_postprocessing": False, - "drop_off_material_handling": DropoffMaterialHandling.GLOBAL, + "drop_off_material_handling": DropOffMaterialHandling.GLOBAL, "drop_off_material": None, "cut_off_material_handling": CutOffMaterialHandling.COMPUTED, "cut_off_material": None, @@ -88,7 +88,7 @@ def object_properties(parent_object, acp_instance): ("thickness", 1e-6), ("area_price", 5.98), ("ignore_for_postprocessing", True), - ("drop_off_material_handling", DropoffMaterialHandling.GLOBAL), + ("drop_off_material_handling", DropOffMaterialHandling.GLOBAL), ("cut_off_material_handling", CutOffMaterialHandling.COMPUTED), ("draping_material_model", DrapingMaterialModel.UD), ("draping_ud_coefficient", 0.55), @@ -110,7 +110,7 @@ def object_properties(parent_object, acp_instance): ("thickness", 1e-6), ("area_price", 5.98), ("ignore_for_postprocessing", True), - ("drop_off_material_handling", DropoffMaterialHandling.CUSTOM), + ("drop_off_material_handling", DropOffMaterialHandling.CUSTOM), ("drop_off_material", drop_off_material), ("cut_off_material_handling", CutOffMaterialHandling.CUSTOM), ("cut_off_material", cut_off_material), @@ -132,7 +132,7 @@ def object_properties(parent_object, acp_instance): def test_solid_model_materials(parent_object, tree_object, acp_instance, material_type): """Check that solid model materials are supported since 25.1.""" tree_object.cut_off_material_handling = CutOffMaterialHandling.CUSTOM - tree_object.drop_off_material_handling = DropoffMaterialHandling.CUSTOM + tree_object.drop_off_material_handling = DropOffMaterialHandling.CUSTOM if parse_version(acp_instance.server_version) < parse_version("25.1"): with pytest.raises(RuntimeError) as exc: setattr(tree_object, material_type, parent_object.create_material(name="Material")) diff --git a/tests/unittests/test_solid_model.py b/tests/unittests/test_solid_model.py index 3347870d4f..d6cd0eaf01 100644 --- a/tests/unittests/test_solid_model.py +++ b/tests/unittests/test_solid_model.py @@ -105,13 +105,13 @@ def object_properties(parent_object): PropertyWithCustomComparison( initial_value=pyacp.DropOffSettings( drop_off_type=pyacp.DropOffType.OUTSIDE_PLY, - disable_dropoffs_on_bottom=True, - dropoff_disabled_on_bottom_sets=[ + disable_drop_offs_on_bottom=True, + drop_off_disabled_on_bottom_sets=[ model.create_element_set(), model.create_oriented_selection_set(), ], - disable_dropoffs_on_top=True, - dropoff_disabled_on_top_sets=[ + disable_drop_offs_on_top=True, + drop_off_disabled_on_top_sets=[ model.create_oriented_selection_set(), model.create_element_set(), ], @@ -155,83 +155,83 @@ def object_properties(parent_object): @given( - disable_dropoffs_on_bottom=st.booleans(), - disable_dropoffs_on_top=st.booleans(), + disable_drop_offs_on_bottom=st.booleans(), + disable_drop_offs_on_top=st.booleans(), connect_butt_joined_plies=st.booleans(), ) @settings(suppress_health_check=[HealthCheck.function_scoped_fixture], deadline=None) def test_drop_off_settings_on_init( - parent_object, disable_dropoffs_on_bottom, disable_dropoffs_on_top, connect_butt_joined_plies + parent_object, disable_drop_offs_on_bottom, disable_drop_offs_on_top, connect_butt_joined_plies ): """Check that the drop-off settings are correctly set when passed to the SolidModel constructor.""" - dropoff_disabled_on_bottom_sets = [ + drop_off_disabled_on_bottom_sets = [ parent_object.create_element_set(), parent_object.create_oriented_selection_set(), ] - dropoff_disabled_on_top_sets = [ + drop_off_disabled_on_top_sets = [ parent_object.create_oriented_selection_set(), parent_object.create_element_set(), ] drop_off_settings = pyacp.DropOffSettings( - disable_dropoffs_on_bottom=disable_dropoffs_on_bottom, - dropoff_disabled_on_bottom_sets=dropoff_disabled_on_bottom_sets, - disable_dropoffs_on_top=disable_dropoffs_on_top, - dropoff_disabled_on_top_sets=dropoff_disabled_on_top_sets, + disable_drop_offs_on_bottom=disable_drop_offs_on_bottom, + drop_off_disabled_on_bottom_sets=drop_off_disabled_on_bottom_sets, + disable_drop_offs_on_top=disable_drop_offs_on_top, + drop_off_disabled_on_top_sets=drop_off_disabled_on_top_sets, connect_butt_joined_plies=connect_butt_joined_plies, ) solid_model = parent_object.create_solid_model(drop_off_settings=drop_off_settings) - assert solid_model.drop_off_settings.disable_dropoffs_on_bottom == disable_dropoffs_on_bottom - assert solid_model.drop_off_settings.disable_dropoffs_on_top == disable_dropoffs_on_top + assert solid_model.drop_off_settings.disable_drop_offs_on_bottom == disable_drop_offs_on_bottom + assert solid_model.drop_off_settings.disable_drop_offs_on_top == disable_drop_offs_on_top assert solid_model.drop_off_settings.connect_butt_joined_plies == connect_butt_joined_plies assert ( - solid_model.drop_off_settings.dropoff_disabled_on_bottom_sets - == dropoff_disabled_on_bottom_sets + solid_model.drop_off_settings.drop_off_disabled_on_bottom_sets + == drop_off_disabled_on_bottom_sets ) assert ( - solid_model.drop_off_settings.dropoff_disabled_on_top_sets == dropoff_disabled_on_top_sets + solid_model.drop_off_settings.drop_off_disabled_on_top_sets == drop_off_disabled_on_top_sets ) @given( - disable_dropoffs_on_bottom=st.booleans(), - disable_dropoffs_on_top=st.booleans(), + disable_drop_offs_on_bottom=st.booleans(), + disable_drop_offs_on_top=st.booleans(), connect_butt_joined_plies=st.booleans(), ) @settings(suppress_health_check=[HealthCheck.function_scoped_fixture], deadline=None) def test_drop_off_settings_assign( - parent_object, disable_dropoffs_on_bottom, disable_dropoffs_on_top, connect_butt_joined_plies + parent_object, disable_drop_offs_on_bottom, disable_drop_offs_on_top, connect_butt_joined_plies ): """Check that the drop-off settings are correctly set when assigned to the SolidModel.""" - dropoff_disabled_on_bottom_sets = [ + drop_off_disabled_on_bottom_sets = [ parent_object.create_element_set(), parent_object.create_oriented_selection_set(), ] - dropoff_disabled_on_top_sets = [ + drop_off_disabled_on_top_sets = [ parent_object.create_oriented_selection_set(), parent_object.create_element_set(), ] drop_off_settings = pyacp.DropOffSettings( - disable_dropoffs_on_bottom=disable_dropoffs_on_bottom, - dropoff_disabled_on_bottom_sets=dropoff_disabled_on_bottom_sets, - disable_dropoffs_on_top=disable_dropoffs_on_top, - dropoff_disabled_on_top_sets=dropoff_disabled_on_top_sets, + disable_drop_offs_on_bottom=disable_drop_offs_on_bottom, + drop_off_disabled_on_bottom_sets=drop_off_disabled_on_bottom_sets, + disable_drop_offs_on_top=disable_drop_offs_on_top, + drop_off_disabled_on_top_sets=drop_off_disabled_on_top_sets, connect_butt_joined_plies=connect_butt_joined_plies, ) solid_model = parent_object.create_solid_model() solid_model.drop_off_settings = drop_off_settings - assert solid_model.drop_off_settings.disable_dropoffs_on_bottom == disable_dropoffs_on_bottom - assert solid_model.drop_off_settings.disable_dropoffs_on_top == disable_dropoffs_on_top + assert solid_model.drop_off_settings.disable_drop_offs_on_bottom == disable_drop_offs_on_bottom + assert solid_model.drop_off_settings.disable_drop_offs_on_top == disable_drop_offs_on_top assert solid_model.drop_off_settings.connect_butt_joined_plies == connect_butt_joined_plies assert ( - solid_model.drop_off_settings.dropoff_disabled_on_bottom_sets - == dropoff_disabled_on_bottom_sets + solid_model.drop_off_settings.drop_off_disabled_on_bottom_sets + == drop_off_disabled_on_bottom_sets ) assert ( - solid_model.drop_off_settings.dropoff_disabled_on_top_sets == dropoff_disabled_on_top_sets + solid_model.drop_off_settings.drop_off_disabled_on_top_sets == drop_off_disabled_on_top_sets ) @@ -246,21 +246,21 @@ def test_drop_off_settings_assign_wrong_type(parent_object): def test_drop_off_settings_string_representation(parent_object): """Check that the string representation of the drop-off settings is correct.""" solid_model = parent_object.create_solid_model() - dropoff_disabled_on_bottom_sets = [ + drop_off_disabled_on_bottom_sets = [ parent_object.create_element_set(), parent_object.create_oriented_selection_set(), ] - dropoff_disabled_on_top_sets = [ + drop_off_disabled_on_top_sets = [ parent_object.create_oriented_selection_set(), parent_object.create_element_set(), ] drop_off_settings = pyacp.DropOffSettings( drop_off_type=pyacp.DropOffType.OUTSIDE_PLY, - disable_dropoffs_on_bottom=True, - dropoff_disabled_on_bottom_sets=dropoff_disabled_on_bottom_sets, - disable_dropoffs_on_top=True, - dropoff_disabled_on_top_sets=dropoff_disabled_on_top_sets, + disable_drop_offs_on_bottom=True, + drop_off_disabled_on_bottom_sets=drop_off_disabled_on_bottom_sets, + disable_drop_offs_on_top=True, + drop_off_disabled_on_top_sets=drop_off_disabled_on_top_sets, connect_butt_joined_plies=False, ) # When the drop-off settings are not yet linked to the server, the linked @@ -272,7 +272,7 @@ def test_drop_off_settings_string_representation(parent_object): solid_model.drop_off_settings = drop_off_settings str_repr = str(solid_model.drop_off_settings) assert "DropOffSettings" in str_repr - for val in dropoff_disabled_on_bottom_sets + dropoff_disabled_on_top_sets: + for val in drop_off_disabled_on_bottom_sets + drop_off_disabled_on_top_sets: assert repr(val) in str_repr diff --git a/tests/unittests/test_stackup.py b/tests/unittests/test_stackup.py index 43f7185cdb..b28ced9271 100644 --- a/tests/unittests/test_stackup.py +++ b/tests/unittests/test_stackup.py @@ -25,7 +25,7 @@ from ansys.acp.core import ( CutOffMaterialHandling, DrapingMaterialModel, - DropoffMaterialHandling, + DropOffMaterialHandling, FabricWithAngle, SymmetryType, ) @@ -56,7 +56,7 @@ def default_properties(): "topdown": True, "fabrics": [], "symmetry": SymmetryType.NO_SYMMETRY, - "drop_off_material_handling": DropoffMaterialHandling.GLOBAL, + "drop_off_material_handling": DropOffMaterialHandling.GLOBAL, "drop_off_material": None, "cut_off_material_handling": CutOffMaterialHandling.COMPUTED, "cut_off_material": None, @@ -86,7 +86,7 @@ def object_properties(parent_object): ], ), ("symmetry", SymmetryType.EVEN_SYMMETRY), - ("drop_off_material_handling", DropoffMaterialHandling.CUSTOM), + ("drop_off_material_handling", DropOffMaterialHandling.CUSTOM), ("drop_off_material", material), ("cut_off_material_handling", CutOffMaterialHandling.CUSTOM), ("cut_off_material", material), From c6f46f4b3c919eddd7d269e157ba0eddd8654728 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Thu, 28 Nov 2024 11:19:59 +0100 Subject: [PATCH 3/6] Update doc/source/user_guide/howto/print_model.rst --- doc/source/user_guide/howto/print_model.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/user_guide/howto/print_model.rst b/doc/source/user_guide/howto/print_model.rst index fdf3fd3838..3930f7f901 100644 --- a/doc/source/user_guide/howto/print_model.rst +++ b/doc/source/user_guide/howto/print_model.rst @@ -90,7 +90,7 @@ The ``hide_empty`` label can be set to ``False`` to also show empty groups: Cylindrical Selection Rules Spherical Selection Rules Tube Selection Rules - CutOff Selection Rules + Cut Off Selection Rules Geometrical Selection Rules Variable Offset Selection Rules Boolean Selection Rules From 7ad8494da785943a0985eba965dba76365fdbbdf Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Thu, 28 Nov 2024 11:21:32 +0100 Subject: [PATCH 4/6] Update src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py --- src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py b/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py index 38299f7d96..3514e08054 100644 --- a/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py +++ b/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py @@ -71,7 +71,7 @@ @dataclasses.dataclass class CutOffSelectionRuleElementalData(ElementalData): - """Represents elemental data for a CutOff Selection Rule.""" + """Represents elemental data for a Cut Off Selection Rule.""" normal: VectorData | None = None From af6fa1d98083387b59e6da036ac674c6c9250912 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Thu, 28 Nov 2024 11:21:38 +0100 Subject: [PATCH 5/6] Update src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py --- src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py b/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py index 3514e08054..0bc381f206 100644 --- a/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py +++ b/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py @@ -78,7 +78,7 @@ class CutOffSelectionRuleElementalData(ElementalData): @dataclasses.dataclass class CutOffSelectionRuleNodalData(NodalData): - """Represents nodal data for a CutOff Selection Rule.""" + """Represents nodal data for a Cut Off Selection Rule.""" @mark_grpc_properties From ac5307bfc4b57acb70e0cf2d21a5fb87b4e37d35 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Thu, 28 Nov 2024 19:56:46 +0100 Subject: [PATCH 6/6] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: René Roos <105842014+roosre@users.noreply.github.com> --- examples/modeling_features/03-advanced-selection-rules.py | 2 +- .../acp/core/_tree_objects/cut_off_selection_rule.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/modeling_features/03-advanced-selection-rules.py b/examples/modeling_features/03-advanced-selection-rules.py index 1379d373db..32074e9497 100644 --- a/examples/modeling_features/03-advanced-selection-rules.py +++ b/examples/modeling_features/03-advanced-selection-rules.py @@ -179,7 +179,7 @@ plotter.show() # %% -# Create a cut off selection rule +# Create a cut-off selection rule # ------------------------------- # %% diff --git a/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py b/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py index 0bc381f206..402abcfaa1 100644 --- a/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py +++ b/src/ansys/acp/core/_tree_objects/cut_off_selection_rule.py @@ -71,25 +71,25 @@ @dataclasses.dataclass class CutOffSelectionRuleElementalData(ElementalData): - """Represents elemental data for a Cut Off Selection Rule.""" + """Represents elemental data for a Cut-Off Selection Rule.""" normal: VectorData | None = None @dataclasses.dataclass class CutOffSelectionRuleNodalData(NodalData): - """Represents nodal data for a Cut Off Selection Rule.""" + """Represents nodal data for a Cut-Off Selection Rule.""" @mark_grpc_properties @register class CutOffSelectionRule(CreatableTreeObject, IdTreeObject): - """Instantiate a Cut Off Selection Rule. + """Instantiate a Cut-Off Selection Rule. Parameters ---------- name : - Name of the Cut Off Selection Rule. + Name of the Cut-Off Selection Rule. cut_off_rule_type : Determines if the cut-off is defined by a geometry or by a tapering edge. cut_off_geometry :