Create springs based on named selections of faces

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

I have two named selections of faces (with the same number of faces in each one). I would like to create a spring connection between face1 of NS1 and face1 of NS2, face2 of NS1 and face2 of NS2, etc. How do I do that?

Tagged:

Answers

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

    The following code can be adapted:

    NS1 = ExtAPI.DataModel.GetObjectsByName("Selection1")[0]
    NS2 = ExtAPI.DataModel.GetObjectsByName("Selection2")[0]
    
    for item in range(len(NS1.Location.Ids)):
        spring = ExtAPI.DataModel.Project.Model.Connections.AddSpring()
        tempRefSel= ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
        tempRefSel.Ids= [NS1.Location.Ids[item]]
        spring.ReferenceScopeLocation = tempRefSel
        tempMobSel= ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
        tempMobSel.Ids= [NS2.Location.Ids[item]]
        spring.MobileScopeLocation = tempMobSel