Create springs based on named selections of faces

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 741
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
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: 741
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    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