23
23
24
24
from typing import TYPE_CHECKING
25
25
26
- from beartype import beartype as check_input_types
27
26
from google .protobuf .wrappers_pb2 import BoolValue , DoubleValue
28
27
29
28
from ansys .api .dbu .v0 .dbumodels_pb2 import EntityIdentifier
41
40
get_design_from_edge ,
42
41
get_design_from_face ,
43
42
)
44
- from ansys .geometry .core .misc .checks import min_backend_version
43
+ from ansys .geometry .core .misc .checks import check_type_all_elements_in_iterable , min_backend_version
45
44
from ansys .geometry .core .typing import Real
46
45
47
46
if TYPE_CHECKING : # pragma: no cover
@@ -65,7 +64,6 @@ def __init__(self, grpc_client: GrpcClient):
65
64
self ._prepare_stub = PrepareToolsStub (self ._grpc_client .channel )
66
65
67
66
@protect_grpc
68
- @check_input_types
69
67
@min_backend_version (25 , 1 , 0 )
70
68
def extract_volume_from_faces (
71
69
self , sealing_faces : list ["Face" ], inside_faces : list ["Face" ]
@@ -87,10 +85,16 @@ def extract_volume_from_faces(
87
85
list[Body]
88
86
List of created bodies.
89
87
"""
88
+ from ansys .geometry .core .designer .face import Face
89
+
90
90
if not sealing_faces or not inside_faces :
91
91
self ._grpc_client .log .info ("No sealing faces or inside faces provided..." )
92
92
return []
93
93
94
+ # Verify inputs
95
+ check_type_all_elements_in_iterable (sealing_faces , Face )
96
+ check_type_all_elements_in_iterable (inside_faces , Face )
97
+
94
98
parent_design = get_design_from_face (sealing_faces [0 ])
95
99
96
100
response = self ._prepare_stub .ExtractVolumeFromFaces (
@@ -110,10 +114,9 @@ def extract_volume_from_faces(
110
114
return []
111
115
112
116
@protect_grpc
113
- @check_input_types
114
117
@min_backend_version (25 , 1 , 0 )
115
118
def extract_volume_from_edge_loops (
116
- self , sealing_edges : list ["Edge" ], inside_faces : list ["Face" ]
119
+ self , sealing_edges : list ["Edge" ], inside_faces : list ["Face" ] = None
117
120
) -> list ["Body" ]:
118
121
"""Extract a volume from input edge loops.
119
122
@@ -124,18 +127,28 @@ def extract_volume_from_edge_loops(
124
127
----------
125
128
sealing_edges : list[Edge]
126
129
List of faces that seal the volume.
127
- inside_faces : list[Face]
128
- List of faces that define the interior of the solid (Not always necessary).
130
+ inside_faces : list[Face], optional
131
+ List of faces that define the interior of the solid (not always necessary).
129
132
130
133
Returns
131
134
-------
132
135
list[Body]
133
136
List of created bodies.
134
137
"""
138
+ from ansys .geometry .core .designer .edge import Edge
139
+ from ansys .geometry .core .designer .face import Face
140
+
135
141
if not sealing_edges :
136
142
self ._grpc_client .log .info ("No sealing edges provided..." )
137
143
return []
138
144
145
+ # Assign default values to inside_faces
146
+ inside_faces = [] if inside_faces is None else inside_faces
147
+
148
+ # Verify inputs
149
+ check_type_all_elements_in_iterable (sealing_edges , Edge )
150
+ check_type_all_elements_in_iterable (inside_faces , Face )
151
+
139
152
parent_design = get_design_from_edge (sealing_edges [0 ])
140
153
141
154
response = self ._prepare_stub .ExtractVolumeFromEdgeLoops (
@@ -155,7 +168,6 @@ def extract_volume_from_edge_loops(
155
168
return []
156
169
157
170
@protect_grpc
158
- @check_input_types
159
171
@min_backend_version (24 , 2 , 0 )
160
172
def share_topology (
161
173
self , bodies : list ["Body" ], tol : Real = 0.0 , preserve_instances : bool = False
@@ -176,9 +188,14 @@ def share_topology(
176
188
bool
177
189
``True`` if successful, ``False`` if failed.
178
190
"""
191
+ from ansys .geometry .core .designer .body import Body
192
+
179
193
if not bodies :
180
194
return False
181
195
196
+ # Verify inputs
197
+ check_type_all_elements_in_iterable (bodies , Body )
198
+
182
199
share_topo_response = self ._prepare_stub .ShareTopology (
183
200
ShareTopologyRequest (
184
201
selection = [GRPCBody (id = body .id ) for body in bodies ],
0 commit comments