get name of assigned material using Python

I have a model with some plate element (e.g. tunnel lining). In dfiferent phases, different materials are assigned to this plate element. Using python, how could I determine, what material was assigned to plate element in a specified phase? I've tried the following command,

MaterialName = g_o.getresults(phasename, g_o.ResultTypes.Plate.Name, 'node') 

Basically, I would like to collect internal forces in plate element, but only in phases, where specific materials were assigned.

  • Hello Sasa,

    Good question. Actually in Output this cannot be retrieved in such way.

    To clarify, via the ResultTypes, you can check the Plate.MaterialID. This is the only available information on which material is used where. That is why Output simply reads data from the calculation kernel files. 

    The caveat here (and something for us to improve) is the fact that with the current data structure, the materials are organized per category and they have their own indexing which is 1-based, which is unlike the 0-based counting we know for listables elsewhere.

    So, for instance let's say you have 3 plate material data sets, based on order of creation, you will have IDs: 1, 2, 3.
    When you run the command: 
    platemat_ids = g_o.getresults(phasename, g_o.ResultTypes.Plate.MaterialID, "node")

    You can see in the results a list of numbers based on the number of plates you have.

    Therefore, you will need to match the ID you get with the creation order of the plate materials to know which material is used where.

    We are planning to improve this in the future, but I hope that this gives you a solution for now.

    A completely different approach is to check the material in Input for a specific object (e.g., Plate_2_1) in a specific phase (e.g., Phase_6) and then switch to Output and run the getresults commands specifically to that object:

    g_o.getresults(plateobj, phasename, g_o.ResultTypes.Plate.M2D, 'node')

    Answer Verified By: Sasa Galuf 

  • Hello Sasa,

    A detailed article was published on this matter, and the new changed property introduced in our PLAXIS 2023.2 to help with 
    How to identify the material name of an object in Output using Python scripting