Extract information on beams

Options
Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 827
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
edited June 2023 in Structures

How can I extract beam properties through scripting?

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 827
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Answer ✓
    Options

    The following function can be used:

    def ExtractBeamData():
        '''
        Extract information on beams
        '''
        listExportBeamData = []
        for part in ExtAPI.DataModel.Project.Model.Geometry.Children:
            for body in part.Children:
                if body.Suppressed is False:
                    geoBody = body.GetGeoBody()
                    if geoBody.BodyType.ToString() == "GeoBodyWire":
                        name = body.Name
                        section = geoBody.CrossSection.Name.ToString()
                        lengthValue = round(body.Length.Value, 5)
                        lengthUnit = body.Length.Unit
                        length = str(lengthValue) + str(lengthUnit)
                        sectionValue = round(body.CrossSectionArea.Value, 5)
                        sectionUnit = body.CrossSectionArea.Unit
                        sectionArea = str(sectionValue) + str(sectionUnit)
                        listExportBeamData.append(
                            [name, section, length, sectionArea])
        return listExportBeamData