How to get Young's Modulus for each element in the mesh?

Erik Kostson
Erik Kostson Member, Moderator, Employee Posts: 327
50 Answers 100 Comments Second Anniversary 25 Likes
✭✭✭✭
edited October 2024 in Structures

How to get Young's Modulus for each element in the mesh using ACT mechanical scripting?

Best Answer

  • Erik Kostson
    Erik Kostson Member, Moderator, Employee Posts: 327
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    edited October 2024 Answer ✓

    Below is one way of doing this:

    import materials
    elements = ExtAPI.DataModel.MeshDataByName('Global').Elements
    
    for element in elements:
        current_geo_body = element.GetBody()
        current_material=current_geo_body.Material # access material class for this geo bodycurrent_geo_body=body.GetGeoBody() # get GeoData of this current body
        print(current_material.DisplayName)
        current_properties=materials.GetMaterialPropertyByName(current_material,"Elasticity") # list values for Elasticity property
        print("Element nr: " + str(element.Id) + ", Mod.: " + str(current_properties.get("Young's Modulus")[1]))
    

    or if we have a element named selection (main_NS):

    import materials
    
    elementids = ExtAPI.DataModel.GetObjectsByName("main_NS")[0].Ids # Element named selection
    
    mesh = ExtAPI.DataModel.AnalysisList[0].MeshData
    
    
    for el in elementids:
        element=mesh.ElementById(el)
        current_geo_body = element.GetBody()
        current_material=current_geo_body.Material # access material class for this geo bodycurrent_geo_body=body.GetGeoBody() # get GeoData of this current body
        print(current_material.DisplayName)
        current_properties=materials.GetMaterialPropertyByName(current_material,"Elasticity") # list values for Elasticity property
        print("Element nr: " + str(element.Id) + ", Mod.: " + str(current_properties.get("Young's Modulus")[1]))
    
This discussion has been closed.