In ACT, how can I print the material properties and values defined for each body in the Mechanical t

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
100 Answers 500 Comments 250 Likes First Anniversary
✭✭✭✭
edited June 2023 in Structures

In ACT, how can I print the material properties and values defined for each body in the Mechanical tree?

Tagged:

Answers

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

    The following code can be used:

    import materials
    
    bodies = ExtAPI.DataModel.Project.Model.GetChildren(DataModelObjectCategory.Body,True) # create list with all bodies in the Mechanical tree
    for body in bodies: #  loop on all bodies in Mechanical Tree
        print(body.Name) #  print body name
        geo_body = body.GetGeoBody() #  get GeoData of this current body
        material = geo_body.Material #  access material class for this geo body
        print(materials.GetListMaterialProperties(material)) #  print material properties defined for this body
        properties = materials.GetMaterialPropertyByName(material,"Elasticity") #  list values for Elasticity property
        print(properties) # print values