Check face types in Mechanical
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 871
✭✭✭✭
In Mechanical, how can I check the face type (ie, plane, cylinder, etc) for each body in the Mechanical tree?
Tagged:
0
Answers
-
This code can be used and adapted:
bodies = ExtAPI.DataModel.Project.Model.Geometry.GetChildren(DataModelObjectCategory.Body, True) for body in bodies: geo_body = body.GetGeoBody() for face in geo_body.Faces: if face.SurfaceType == GeoSurfaceTypeEnum.GeoSurfaceCylinder: print('Face is a cylinder') elif face.SurfaceType == GeoSurfaceTypeEnum.GeoSurfacePlane: print('Face is a plane') else: print("Face type was neither recognized as a cylinder nor a plane")
For a geometry with only one cylindrical body, this is obtained:
0