Check face types in Mechanical

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
100 Answers 500 Comments 250 Likes First Anniversary
✭✭✭✭
edited June 2023 in Structures

In Mechanical, how can I check the face type (ie, plane, cylinder, etc) for each body in the Mechanical tree?

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭

    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: