How to retrieve Beam element cross section properties?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 467
100 Answers 250 Likes 100 Comments Second Anniversary
✭✭✭✭
edited June 2023 in Structures

How to retrieve Beam element cross section properties?

Tagged:

Best Answer

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 467
    100 Answers 250 Likes 100 Comments Second Anniversary
    ✭✭✭✭
    Answer ✓

    Get the body associated with the element and then the properties of the cross-section assigned to the Geo. Body

    body = element.GetBody()
    my_cs = filter(lambda x: (body.CrossSection.Name == x.Name), ExtAPI.DataModel.GetObjectsByType(Ansys.ACT.Automation.Mechanical.CrossSections)[0].Children)[0]
    # Cross-section area
    area = my_cs.PropertyByName("CrossSectionArea").StringValue
    
    # Polar moment of inertia Iyy
    iyy = my_cs.PropertyByName("CrossSectionIYY").StringValue
    
    # Polar moment of inertia Izz
    izz = my_cs.PropertyByName("CrossSectionIZZ").StringValue
    

Answers

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

    This solution also show how to extract such information: https://stackoverflow.com/c/ansys-field-engineering/questions/421

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

    This solution also show how to extract such information: https://stackoverflow.com/c/ansys-field-engineering/questions/421

  • Erik Kostson
    Erik Kostson Member, Moderator, Employee Posts: 275
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    edited June 6

    In case we want to find the body associated with a specific element (myelId below):

    model = ExtAPI.DataModel.Project.Model
    analysis=model.Analyses[0]
    meshData = analysis.MeshData
    elemList = meshData.Elements
    myelId=14
    
    def getbodyname(myelId):
        for el in elemList:
            if el.Id == myelId:
                body=el.GetBody()
                elid=el.Id
        return body,elid
    mybodyel=getbodyname(myelId)
    print('Element ' + str(mybodyel[1]) + ' belongs to the body : ' + str(mybodyel[0].Name))
    

    or with the filter:

    model = ExtAPI.DataModel.Project.Model
    analysis=model.Analyses[0]
    meshData = analysis.MeshData
    elemList = meshData.Elements
    myelId=14
    
    
    def getbodyname(myelId):
        el = filter(lambda el: (el.Id == myelId), elemList)[0]
        body=el.GetBody()
        elid=el.Id
        return body,elid
    mybodyel=getbodyname(myelId)
    print('Element ' + str(mybodyel[1]) + ' belongs to the body : ' + str(mybodyel[0].Name))