Application | PLAXIS 2D PLAXIS 3D |
Version | PLAXIS 2D 2023.2 PLAXIS 3D 2023.2 |
Date created | 21 September 2023 |
Date modified | 31 January 2025 |
Original author | Stefanos Papavasileiou - Bentley Technical Support Group |
The PLAXIS Output program, apart from displaying calculation results of numerical analyses, also provides essential information on the model definition, such as assigned materials on soil/rock polygons or volumes as well as on structural elements, such as plates and embedded beams.
It is common to have different materials assigned to different objects depending on the settings applied in each phase. This is specified in the Staged construction in the PLAXIS Input program.
Figure 1. Example project and material shown for selected plate in Phase_7 (PLAXIS Input).
Figure 2. Material sets shown in PLAXIS Output
This article will show how to use the HTTP REST API / Remote Scripting feature to identify the material name used for plates in a particular phase.
Note that in this code example, we will use a case based on the PLAXIS 2D Tutorial 06: Dry excavation using a tie back wall project to describe how to retrieve the information required.
The PLAXIS Output material object contains a specific property to store the information on the material index shown in plots and tables. This depends on the material object itself, e.g., Soil, Plate, EmbeddedBeam, etc., and can be queried as:
g_o.ResultTypes.Plate.MaterialIndex
This property can be retrieved via the getresults command, which will return a list of material indices per element. This can be done for each plate_part that is present in the model.
Note that the “element” is a parameter of the getresults command; we can also query this per “node” and “stress point”. For example:
materialIndices = g_o.getresults(plate_part, phase, g_o.ResultTypes.Plate.MaterialIndex, 'element')
The created list of material indices can now be queried to provide the .Identification property per element per plate part. The result can be another list, which will have the same order as the material index list (materialIndices) generated before.
materialNames = [g_o.Materials[index].Identification.value for index in materialIndices]
Since we want to show the material object for each plate part, a separate list can be created for the plate .Name property:
plateNames = [plate_part.Name.value for plates in g_o.Plates for plate_part in plates for index in materialIndices]
Finally, the two created lists need to be combined using Python to give us the relevant plate_part name and material identification.
An example of how you can achieve this is explained in the next article section "Example with code".
In the following example, we will use the information learnt to collect the material information and retrieve it using a simple Python script.
Let’s assume that in this project, a different plate material is assigned in the last phase of the project (Phase_7). Note that, generally, a Reduction of stiffness does not lead to a change in displacements.
This Python script aims to retrieve the material identification for every plate in the last two phases (Phase_6 and Phase_7) of the calculated project.
for phase in g_o.Phases[6:]: plateNames = [] materialNames = [] combined_list = [] print(phase.Name, "===========") for plate in g_o.Plates: for plate_part in plate: if plate_part.Active: # retrieve all values for MaterialIndex for each element in each plate_part materialIndices = g_o.getresults(plate_part, phase, g_o.ResultTypes.Plate.MaterialIndex, 'element') # for each value of the materialIndices (which is per element) find each # unique (plate(-part) name, material name) combination for index in materialIndices: # for each plate_part, get its Name plateNames.append(plate_part.Name.value) # for the MaterialIndex number, get the Identification of the material materialNames.append(g_o.Materials[index].Identification.value) # do not add duplicate (platename, materialname) combinations if (plateNames[-1], materialNames[-1]) not in combined_list: combined_list.append((plateNames[-1], materialNames[-1])) # print the information for plates in combined_list: print('\t'.join(["{}".format(i) for i in plates]))
Figure 3. Python script providing the material identification per plate object for the last two phases (PLAXIS Output)