how to rename line bodies in the Mechanical tree based on their assigned cross-section?

Rohith Patchigolla
Rohith Patchigolla Member, Moderator, Employee Posts: 251
50 Answers 100 Comments Second Anniversary 25 Likes
✭✭✭✭
edited May 27 in Structures

how to rename line bodies in the Mechanical tree based on their assigned cross-section?

Tagged:

Answers

  • Rohith Patchigolla
    Rohith Patchigolla Member, Moderator, Employee Posts: 251
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    Try using the below code in Mechanical scripting console

    linebodies = [child for child in DataModel.GetObjectsByType(DataModelObjectCategory.Body) if child.GeometryType == GeometryType.Line]
    for linebody in linebodies:
        linebody.Name = "Beam CS - " + linebody.CrossSectionName