How can I create Groups inside SC from selected faces that are obtained by the small faces tool

Erik Kostson
Erik Kostson Member, Employee Posts: 52
25 Likes 10 Comments Ansys Employee Photogenic
edited September 18 in General Language Questions

How can I create a Group/Named Selection inside SC from selected faces that are obtained by the small faces tool?

Best Answer

  • Erik Kostson
    Erik Kostson Member, Employee Posts: 52
    25 Likes 10 Comments Ansys Employee Photogenic
    edited September 18 Answer ✓

    Below is a script that does that (SC small faces tool is not used but the below code does the same):

    allfaces=[]
    allBodies = GetRootPart().GetAllBodies()
    for body in allBodies:
        faces=body.Faces
        for face in faces:
            if face.Area<=0.0002: # max face size in m2
                edges = face.Edges
                for edge in edges:
                    if edge.Shape.Length<=0.007: # max edge length in m
                        allfaces.append((face))
    primarySelection = FaceSelection.Create(allfaces)
    secondarySelection = Selection.Empty()
    resultns = NamedSelection.Create(primarySelection, secondarySelection)