When using boreholes in PLAXIS to define soil layers, Plaxis automatically creates soil polygons (2D) and soil volumes (3D) for these soil layers. When assigning materials to these soils, normally you would use a command in PLAXIS 2D like this:
setmaterial Polygon_1.Soil Sand
g_i.setmaterial(g_i.Polygon_1.Soil, g_i.Sand)
or
set Polygon_1.Soil.Material Sand
g_i.Polygon_1.Soil.Material = g_i.Sand
However, any soil layer might consist of any number of soil polygons, depending on the soil layer configuration (e.g. when a soil layer has zero thickness).For this, you can also assign the material to the Soillayer objects. The Soillayers object is a listable that is updated after any change to the borehole soil layer settings and lists the Soillayer objects top-down.
0010> echo Soillayers SoilLayerList named "Soillayers" Count: 5 0/-5. Soillayer named "Soillayer_1" 1/-4. Soillayer named "Soillayer_2" 2/-3. Soillayer named "Soillayer_3" 3/-2. Soillayer named "Soillayer_4" 4/-1. Soillayer named "Soillayer_5"
To assign a new material to a newly added soil layer (not an inserted soil layer) you can use:
setmaterial Soillayers[-1] Sand
g_i.setmaterial(g_i.Soillayers[-1], g_i.Sand)
For more complex geometries, you can for example do this:
borehole 0 soillayer 1 # add a soil layer with 1 m thickness soillayer 1 soillayer 1 soillayer 1 soillayer 1 set Soillayer_1.Soil.Material SoilMat_1 # assign material to the top soil layer set Soillayer_2.Soil.Material SoilMat_2 # assign material to the second layer set Soillayer_3.Soil.Material SoilMat_3 # assign material to the third layer set Soillayer_4.Soil.Material SoilMat_4 # assign material to the fourth layer set Soillayer_5.Soil.Material SoilMat_5 # assign material to the fifth and final layer
g_i.borehole(0) # add soil layers, each 1 m thick: g_i.soillayer(1) g_i.soillayer(1) g_i.soillayer(1) g_i.soillayer(1) g_i.soillayer(1) # assign materials to the current configured soil layers g_i.Soillayers[0].Soil.Material = g_i.SoilMat_1 g_i.Soillayers[1].Soil.Material = g_i.SoilMat_2 g_i.Soillayers[2].Soil.Material = g_i.SoilMat_3 g_i.Soillayers[3].Soil.Material = g_i.SoilMat_4 g_i.Soillayers[4].Soil.Material = g_i.SoilMat_5
This Python script can also be nicely written as:
g_i.borehole(0) # add soil layers, each 1 m thick: for i in range(5): g_i.soillayer(1) # material list: materials = [g_i.SoilMat_1, g_i.SoilMat_2, g_i.SoilMat_3, g_i.SoilMat_4, g_i.SoilMat_5] # assign materials to the current configured soil layers for layer, material in zip(g_i.Soillayers, materials): layer.Soil.Material = material
The above examples are made with PLAXIS 2D 2017.00 using Python 3.4.x.
Using PLAXIS Remote scripting with the Python wrapper
[Tips and Tricks]
Identify Python commands from Plaxis command line
[Python Scripts]
Plaxis Soil model numbers in command line
Retrieving soil layer info from boreholes using Python
Access to Staged Construction settings using Python