Extract information on beams

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
100 Answers 500 Comments 250 Likes First Anniversary
✭✭✭✭
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: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭
    Answer ✓

    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