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

Member, Moderator, Employee Posts: 311
50 Answers 100 Comments Second Anniversary 25 Likes
✭✭✭✭
edited September 2023 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

  • Member, Moderator, Employee Posts: 311
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    edited September 2023 Answer ✓

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

    1. allfaces=[]
    2. allBodies = GetRootPart().GetAllBodies()
    3. for body in allBodies:
    4. faces=body.Faces
    5. for face in faces:
    6. if face.Area<=0.0002: # max face size in m2
    7. edges = face.Edges
    8. for edge in edges:
    9. if edge.Shape.Length<=0.007: # max edge length in m
    10. allfaces.append((face))
    11. primarySelection = FaceSelection.Create(allfaces)
    12. secondarySelection = Selection.Empty()
    13. resultns = NamedSelection.Create(primarySelection, secondarySelection)
    14.  

Welcome!

It looks like you're new here. Sign in or register to get started.