@@ -1270,12 +1270,12 @@ def faces_on_bounding_box(self):
1270
1270
1271
1271
Returns
1272
1272
-------
1273
- list
1273
+ List of :class:`pyaedt.modeler.Object3d.FacePrimitive`
1274
1274
"""
1275
1275
f_list = []
1276
1276
for face in self .faces :
1277
1277
if face .is_on_bounding ():
1278
- f_list .append (face . id )
1278
+ f_list .append (face )
1279
1279
return f_list
1280
1280
1281
1281
@property
@@ -1284,7 +1284,7 @@ def face_closest_to_bounding_box(self):
1284
1284
1285
1285
Returns
1286
1286
-------
1287
- int
1287
+ :class:`pyaedt.modeler.Object3d.FacePrimitive`
1288
1288
"""
1289
1289
b = [float (i ) for i in list (self .m_Editor .GetModelBoundingBox ())]
1290
1290
f_id = None
@@ -1303,10 +1303,72 @@ def face_closest_to_bounding_box(self):
1303
1303
)
1304
1304
1305
1305
if f_val and p_dist < f_val or not f_val :
1306
- f_id = face . id
1306
+ f_id = face
1307
1307
f_val = p_dist
1308
1308
return f_id
1309
1309
1310
+ @pyaedt_function_handler ()
1311
+ def largest_face (self , n = 1 ):
1312
+ """Return only the face with the greatest area.
1313
+
1314
+ Returns
1315
+ -------
1316
+ List of :class:`pyaedt.modeler.Object3d.FacePrimitive`
1317
+ """
1318
+ f = []
1319
+ for face in self .faces :
1320
+ f .append ((face .area , face ))
1321
+ f .sort (key = lambda tup : tup [0 ], reverse = True )
1322
+ f_sorted = [x for y , x in f ]
1323
+ return f_sorted [:n ]
1324
+
1325
+ @pyaedt_function_handler ()
1326
+ def longest_edge (self , n = 1 ):
1327
+ """Return only the edge with the greatest length.
1328
+
1329
+ Returns
1330
+ -------
1331
+ List of :class:`pyaedt.modeler.Object3d.EdgePrimitive`
1332
+ """
1333
+ e = []
1334
+ for edge in self .edges :
1335
+ e .append ((edge .length , edge ))
1336
+ e .sort (key = lambda tup : tup [0 ], reverse = True )
1337
+ e_sorted = [x for y , x in e ]
1338
+ return e_sorted [:n ]
1339
+
1340
+ @pyaedt_function_handler ()
1341
+ def smallest_face (self , n = 1 ):
1342
+ """Return only the face with the smallest area.
1343
+
1344
+ Returns
1345
+ -------
1346
+ List of :class:`pyaedt.modeler.Object3d.FacePrimitive`
1347
+ """
1348
+ f = []
1349
+ for face in self .faces :
1350
+ f .append ((face .area , face ))
1351
+ f .sort (key = lambda tup : tup [0 ])
1352
+ f_sorted = [x for y , x in f ]
1353
+ return f_sorted [:n ]
1354
+
1355
+ @pyaedt_function_handler ()
1356
+ def shortest_edge (self , n = 1 ):
1357
+ """Return only the edge with the smallest length.
1358
+
1359
+ Returns
1360
+ -------
1361
+ List of :class:`pyaedt.modeler.Object3d.EdgePrimitive`
1362
+ """
1363
+ e = []
1364
+ for edge in self .edges :
1365
+ e .append ((edge .length , edge ))
1366
+ e .sort (
1367
+ key = lambda tup : tup [0 ],
1368
+ )
1369
+ e_sorted = [x for y , x in e ]
1370
+ return e_sorted [:n ]
1371
+
1310
1372
@property
1311
1373
def top_face_z (self ):
1312
1374
"""Top face in the Z direction of the object.
0 commit comments