Skip to main content
PLAXIS Scripting

Setting Design Approach

Download: #

OneDrive Link

Preamble: #

While PLAXIS has implemented design approaches in accordance to Eurocode, there are no in-built functions to allow automatic allocation of partial factors to basic soil parameters such as c', phi' and Su especially for DA1C2.

Users must manually allocate partial factors to the soil materials, which is tedious and prone to errors.

Function: #

The Python script is written in a way to be a one-click solution to set design approaches.

  1. Create 2 design approaches in accordance to Singapore DA1C1* and DA1C2.
  2. Allocate material links for all soil materials of type "Drained", "Undrained (A)", "Undrained (B)" and "Undrained (C)", to their respective partial factors for DA1C2.
  3. Set all line loads across all phases to Unfavourable Variable.
  4. Set all phases to one of the two design approaches.

Script: #

import plxscripting.easy
import easygui

class ChangeSoilDA():

    def __init__(self, g_i):
        self.name = "PLAXIS 2D Design Approach Script"
        self.g_i = g_i

    def run(self):
        msg = 'This script will set all soil parameters to the respective design approach factors. Continue?'
        selection = easygui.ynbox(msg=msg, title='Design Approach Soil Material Allocation')

        if selection:
            design_approach_i=g_i.designapproach("DA1C1*")
            design_approach_i.LoadFactorTable[0].Factor.set(1)
            design_approach_i.LoadFactorTable[1].Factor.set(1)
            design_approach_i.LoadFactorTable[2].Factor.set(1.11)
            design_approach_i.LoadFactorTable[3].Factor.set(1)
            design_approach_i.MaterialFactorTable[0].Factor.set(1)
            design_approach_i.MaterialFactorTable[1].Factor.set(1)
            design_approach_i.MaterialFactorTable[2].Factor.set(1)

            design_approach_ii=g_i.designapproach("DA1C2")
            design_approach_ii.LoadFactorTable[0].Factor.set(1)
            design_approach_ii.LoadFactorTable[1].Factor.set(1)
            design_approach_ii.LoadFactorTable[2].Factor.set(1.3)
            design_approach_ii.LoadFactorTable[3].Factor.set(1)
            design_approach_ii.MaterialFactorTable[0].Factor.set(1)
            design_approach_ii.MaterialFactorTable[1].Factor.set(1.25)
            design_approach_ii.MaterialFactorTable[2].Factor.set(1.4)
            soilmaterials = [mat for mat in g_i.Materials[:] if mat.TypeName.value == 'SoilMat']

            for soil in soilmaterials:

                if soil.DrainageType == 0 or soil.DrainageType == 1:
                    g_i.adddesignapproachmateriallink(design_approach_ii,soil.cRef,g_i.MaterialFactorLabel_2)
                    g_i.adddesignapproachmateriallink(design_approach_ii,soil.cInc,g_i.MaterialFactorLabel_2)
                    g_i.adddesignapproachmateriallink(design_approach_ii,soil.phi,g_i.MaterialFactorLabel_2)
                    print ('{} - {} Effective Stress Parameters'.format(soil.Name.value, soil.Identification.value))
                elif soil.DrainageType == 2 or soil.DrainageType == 3:
                    g_i.adddesignapproachmateriallink(design_approach_ii,soil.sURef,g_i.MaterialFactorLabel_3)
                    g_i.adddesignapproachmateriallink(design_approach_ii,soil.sUInc,g_i.MaterialFactorLabel_3)
                    print ('{} - {} Total Stress Parameters'.format(soil.Name.value, soil.Identification.value))

            msg2 = 'Do you also want to set all load to Variable Unfavourable?'
            selection2 = easygui.ynbox(msg=msg2, title='Design Approach Load Factor Allocation')

            if selection2:
                for phase in g_i.Phases[:]:
                    for line in g_i.LineLoads:
                        g_i.set(line.LoadFactorLabel, phase, g_i.LoadFactorLabel_3)

            msg3 = 'Do you also want to set all phases except InitialPhase to a design approach?'
            button_list=["DA1C1*","DA1C2","NIL"]
            selection3 = easygui.buttonbox(msg=msg3, title='Design Approach Phase Allocation', choices = button_list)

            if selection3 == "DA1C1*":
                for phase in g_i.Phases[1:]:
                    g_i.set(phase.DesignApproach, design_approach_i)
            elif selection3 == "DA1C2":
                for phase in g_i.Phases[:]:
                    g_i.set(phase.DesignApproach, design_approach_ii)
            else:
                pass

            selection4 = easygui.buttonbox(msg='Close the python window by clicking the button below.', title='Close the window', choices = ["Close","About"])

            if selection4 == "About":
                easygui.msgbox(msg='v1.0, released 09/05/2023\n\nChangelog:\nNil, initial release.\n\n- Chen Teck, 2023',title='About',ok_button='OK')

        else:
            easygui.msgbox(msg='Close the python window by clicking the button below.',title='Close the window',ok_button='OK')




if __name__ == "__main__":
    s_i, g_i = plxscripting.easy.new_server()
    soilDA = ChangeSoilDA(g_i)
    soilDA.run()

Customization #

Users can customize the design approaches by changing the LoadFactorTable and MaterialFactorTable parameters.

In the excerpt below, the table of factors are formed, and the factors can be changed by changing the number within set().

design_approach_ii = g_i.designapproach("DA1C2");
#sets load factor to 1, 1, 1.3, 1.
design_approach_ii.LoadFactorTable[0].Factor.set(1);
design_approach_ii.LoadFactorTable[1].Factor.set(1);
design_approach_ii.LoadFactorTable[2].Factor.set(1.3);
design_approach_ii.LoadFactorTable[3].Factor.set(1);

#sets material factor to 1, 1.25, 1.4.
design_approach_ii.MaterialFactorTable[0].Factor.set(1);
design_approach_ii.MaterialFactorTable[1].Factor.set(1.25);
design_approach_ii.MaterialFactorTable[2].Factor.set(1.4);

Note that within this code implementation, MaterialFactorTable[1] is allocated to drained parameters and [2] is for undrained parameters.