I want to get the material name for each element so ican get it's properties in engineering data. i am using dpf but it only gave me the matid and i don't know how to link it to the name of the material. Thank you in advance. @AKD-Scripting-Team
@mahmane How about going to from mesh to body and then from body to material. This is possible in the mechanical itself. Are you trying to get mesh from rst?
Not necessary from rst, i am using DPF to get the mesh and a Field with a mat_id for each element, but to extract the material propreties i use the libraries "materials" and "EngineeringData" with the name of the material, My problem here is that i can't have the material name by his mat_id. Otherwise i need to try another way as you suggested, do you have a script for that Please?
element = ExtAPI.DataModel.MeshDataByName('Global').Elements[0] body = element.GetBody() material = body.Material print(material.DisplayName)
hello Landon,
Very useful script. I wonder is there a way to get material ID? I faced trouble getting it using the function GetPropertyField("mat") which doesn't exist in the 21R2 release.
GetPropertyField("mat")
Thanks
material.ID
Hello Landon,
Maybe I didn't come right... I mean the unique material identifier (matid) which is assigned to each material in ds.dat, for example:
!*********** Model Summary ******************** !Part 12, Structural Steel, matid, 1 !Part 13, Structural Steel, matid, 2 !Part 14, Structural Steel, matid, 3 !Part 133, Structural Steel, matid, 4 !Part 134, Structural Steel, matid, 5 !Part 135, Structural Steel, matid, 6 !*********************** End Model Summary *****************
material.ID doesn't return matid.
The APDL matids are dynamically assigned when the ds.dat is generated (when you click solve) and can vary for each analysis. I am not sure if they are stored anywhere under ExtAPI.DataModel.
You may find this post helpful:https://discuss.ansys.com/discussion/comment/1428#Comment_1428
Otherwise, I would suggest creating a new Question on this topic.
@AKD-Scripting-Team, is there an existing post on how to obtain APDL matids in Mechanical?