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: 741
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
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: 741
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    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