Hello,
I am working out the way to create an excavation with a complex soil layering in Plaxis 2D by means of python scripting.
The problem:
I have complex stratigraphy, non horizontal layers, many layers going diagonal within the zone of excavation.
The geometry of the excavation (trench with slopes) is modelled with lines
When it comes to stages of construction, I need to choose which borehole polygones to be deactivated.
Because of complex layering the naming of individual borehole polygones does not help, e.g. I need to deactivate borehole polygone 1_1, 1_2, 1_3, 2_2, 2_5, but keep 2_1 and 2_3 and so on.
So probably the way forward would be extracting coordinates of individual borehole polygones and then sorting out which lie within the excavation (deactivate) and which one are outside (keep activated).
I could use command :
echo BoreholePolygone_1.BoundingBox
which gives me the information I need for sorting.
But!
I cannot find the python command to call all BoreholePolygones to loop through them. It works for soils (g.Soils[:] gives a list of all soil elements) but soils do not have the option BoundingBox.
g.BoreholePolygones doesn't work unfortunately.
Is there a command to call all BoreholePolygones?
Is there a better way to assign borehole polygones for excavation?
Looking forward to your response!
Nataly
And as soon as I asked this question in the forum, I found the solution. In case someone else is searching for the same command:
access to all borehole polygons --> pol = g.SoilPolygons[i]
find coordinates of the BP: --> g.echo(pol.BoundingBox)
sorting loop to check the coordinates and define whether to deactivate or not
I leave this question open for now as I am looking forward to maybe a better suggestion how to solve this task.
This would be the way to go.You could also loop over all the soil items like this (to prevent that you miss other Polygons):
for soil in g_i.Soils[:]: print(soil.Parent.Name.value) print(soil.Parent.BoundingBox.value) # add logic to check on location soil.deactivate(g_i.Phase_3)