Extract Young Modulus for each body
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 864
✭✭✭✭
How can I extract Young Modulus value for each body in Mechanical, through scripting?
Tagged:
0
Answers
-
The following function can be used:
def ExtractMaterialYoungModulus(): ''' Extract Young Modulus value for each body in model ''' listExportMaterialYoungModulusProperties = [] import materials for part in ExtAPI.DataModel.Project.Model.Geometry.Children: for body in part.Children: if body.Suppressed is False: geoBody = body.GetGeoBody() bodyName = body.Name bodyMaterial = body.Material geoBodyMaterial = geoBody.Material try: bodyElasticityValues = materials.GetMaterialPropertyByName( geoBodyMaterial, "Elasticity") bodyYoungModulus = bodyElasticityValues[ "Young's Modulus"] bodyYoungModulusUnit = bodyYoungModulus[0] bodyYoungModulusValue = bodyYoungModulus[1] except: bodyYoungModulusUnit = "No aplica" bodyYoungModulusValue = "No aplica" listExportMaterialYoungModulusProperties.append([ str(bodyName), str(bodyMaterial), str(bodyYoungModulusUnit), str(bodyYoungModulusValue) ]) return listExportMaterialYoungModulusProperties
2