Beam End Release On Multiple Beams

This script creates Beam End Release objects. Create an edge named selection named edges_ and a named selection scoped to the corresponding vertices and name it vertices_. Then, specify the DOFs to Fix/Free and run the script!

# named selection with edges:
nse = "edges_"
# named selection with vertices:
nsv = "vertices_"
 
UX   = 'Fixed'
UY   = 'Fixed'
UZ   = 'Fixed'
ROTX = 'Free'
ROTY = 'Fixed'
ROTZ = 'Fixed'
myEdges = [i for i in DataModel.GetObjectsByType(DataModelObjectCategory.NamedSelection) if i.Name == nse][0].Location.Entities
myVertices = [i for i in DataModel.GetObjectsByType(DataModelObjectCategory.NamedSelection) if i.Name == nsv][0].Location
coupling_ = {'ID':{}}
for index in myVertices: coupling_['ID'].Add(index,[])
for refVertex in myVertices:
    for edge in myEdges:
        edgeVertices_ = edge.Vertices
        for vertex in edgeVertices_:
            if vertex.Id == refVertex: coupling_['ID'][refVertex].append(edge)
endRels_=[]
with Transaction():
    for index,key in enumerate(coupling_['ID'].keys()):
        endRel_ = Model.Connections.AddEndRelease()
        if UX   == 'Free': endRel_.TranslationX = FixedOrFree.Free
        if UY   == 'Free': endRel_.TranslationY = FixedOrFree.Free
        if UZ   == 'Free': endRel_.TranslationZ = FixedOrFree.Free
        if ROTX == 'Free': endRel_.RotationX = FixedOrFree.Free
        if ROTY == 'Free': endRel_.RotationY = FixedOrFree.Free
        if ROTZ == 'Free': endRel_.RotationZ = FixedOrFree.Free
        edge_ = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
        edge_.Entities = coupling_['ID'][key]
        vertex_ = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
        vertex_.Ids = [key]
        endRel_.VertexLocation = vertex_
        endRel_.EdgeLocation = edge_
        endRels_.append(endRel_)
endRels_group = Tree.Group(endRels_)
endRels_group.Name = 'Beam End Release'