How to use python to change the existing soil materials and assgin them to the specific soil layer?

Hi,
I am trying to calculate the safety factors of many models by inputting different soil parameters to analyze the distribution of safety factors. I want to change the soil parameters for each model. I checked the example in manual. Using this manual, I can set up new soil materials and assign them to the specific soil layer. In order to improve the calculation efficiency, I want to change the existing soil materials. I succeeded in doing this. But when I want to provide soil layers for new soil materials, it says, "Invalid parameters. Make sure that the specified parameters match the ones that are expected."

This is my python script:


SAND_PARAMETERS = [('Identification', 'Sand'),
('SoilModel', 2),('DrainageType', 'Drained'),
('gammaUnsat', 18),('gammaSat', 18),('Gref', 33460),
('nu', 0.27),('phi', 40)]
sand = g_i.Sand.setproperties(*SAND_PARAMETERS)

LOWER_SAND_PARAMETERS = [('Identification', 'lowerSand'),
('SoilModel', 2),('DrainageType', 'Drained'),
('gammaUnsat', 18),('gammaSat', 18),('Gref', 33460),
('nu', 0.27),('phi', 35)]
g_i.lowerSand.setproperties(*LOWER_SAND_PARAMETERS)
g_i.Soil_1.Material=sand
g_i.Soil_2.Material=lowersand

Parents
  • Hi

    Please have a look at what is shown in the PLAXIS Input program to understand what is happening:

    As you can see, the program is given the instruction to set the Material assignment for Soillayer 1 to "OK".
    This is because in your script you set the parameter sand to the result of the g_i.Sand.setproperties(...) instruction, which is the string "OK" in this line:

    sand = g_i.Sand.setproperties(*SAND_PARAMETERS)

    To set the material assignment, you should either refer to g_i.Sand or if sand has been set earlier, do not set it again using the setproperties method,


    I do not know the rest of your script, but make sure that the other material assignment works correctly as well.
    Easiest would be to use the material object references:

    # assign materials:
    g_i.Soil_1.Material = g_i.Sand
    g_i.Soil_2.Material = g_i.lowerSand

      

      

Reply
  • Hi

    Please have a look at what is shown in the PLAXIS Input program to understand what is happening:

    As you can see, the program is given the instruction to set the Material assignment for Soillayer 1 to "OK".
    This is because in your script you set the parameter sand to the result of the g_i.Sand.setproperties(...) instruction, which is the string "OK" in this line:

    sand = g_i.Sand.setproperties(*SAND_PARAMETERS)

    To set the material assignment, you should either refer to g_i.Sand or if sand has been set earlier, do not set it again using the setproperties method,


    I do not know the rest of your script, but make sure that the other material assignment works correctly as well.
    Easiest would be to use the material object references:

    # assign materials:
    g_i.Soil_1.Material = g_i.Sand
    g_i.Soil_2.Material = g_i.lowerSand

      

      

Children