The PLAXIS Output program offers the possibility of using the command line to configure the plot settings to export a plot to an image file to be used in post-processing. The main article which covers the commands that can be used directly in the PLAXIS Output command line can be found here: Export and format plots from PLAXIS Output
In this article, the equivalent Python commands are presented to assist when handling the Output plots with the PLAXIS scripting environment.
To find the current settings applied to the last plot created in Output, one can use the following Python command:
Examples of changing some of the plot settings are provided below.
Show the rulers in your plot:
g_o.Plots[-1].DrawRulers = True
Hide the axes:
Exclude the legend of the plot:
g_o.Plots[-1].DrawLegend = False
Below are some special items in the properties of a plot object that concern every plot to be exported:
These will be explained in more detail below.
The ResultTypes is the property that controls which result is visualized in the plot. This is related to the numerous options available via the menus, e.g. Deformations, Stresses, Forces, etc.
Some examples are provided below:
Set the plot result to Total horizontal displacement ux:
g_o.Plots[-1].ResultType = g_o.ResultTypes.Soil.Ux
Set the plot result to Incremental vertical cartesian strains: Δεyy:
g_o.Plots[-1].ResultType = g_o.ResultTypes.Soil.dEpsyy
Set the plot results to Active pore pressures:
g_o.Plots[-1].ResultType = g_o.ResultTypes.Soil.PActive
For every plot you can also switch between the available visualisation options of the results:
Set the plot type to show the Contour lines instead of the Shadings:
g_o.Plots[-1].PlotType = "ContourLines"
Set the plot type to show the Coloured principal directions of a plot. Note that this is relevant to some of the plots, such as the stresses and pore pressure plots:
g_o.Plots[-1].PlotType = "PrincipalDirections"
In any case that a typo is made, the error message contains all allowed values for the command.
This allows for changing the settings of the legend that is next to the plot. For example:
Change the number of intervals of the legend to 10:
g_o.Plots[-1].LegendSettings.Intervals = 10
Set the minimum value of the legend to -160 in project units:
g_o.Plots[-1].LegendSettings.MinValue = -160
Various options about the current visualisation of the mesh are stored in the MeshSettings of a plot. For example:
Show the Phreatic level in the plot:
g_o.Plots[-1].MeshSettings.PhreaticLevel = True
Show the Fixities of the model:
g_o.Plots[-1].MeshSettings.Fixities = True
Hide the Cluster contours of the model:
g_o.Plots[-1].MeshSettings.ClusterContours = False
Every plot in PLAXIS Output has a Phase property, which corresponds to the phase for which the results are displayed.
By default, the Phase property is set to the phase selected in Input when the command is run to view the results, or it is set to the phase selected when a project is opened directly in Output.
In the GUI (Graphic User Interface) it is possible to switch to any other phase in the Output program using the dropdown box from the top bar, however, the internal Phase property of the plot remains unchanged.
You can query the Phase property using the echo command:
To change the Phase property, you can directly set it using the command:
g_o.Plots[-1].Phase = g_o.Phase_x
Along with the Phase property, the PhaseBehaviour property allows for controlling to which phase the Phase property will be set for the current plot when used in automation.
The PhaseBehaviour property has two options:
By default, the PhaseBehaviour is set to plotphase, which means that any change via the GUI does not make any change to the internal Phase property. The Phase property is used for export options via the command line and/or with remote scripting facilities (Python).
When dealing with a Python script and automation, it is recommended to change the PhaseBehaviour behaviour to projectphase using the command:
g_o.Plots[-1].PhaseBehaviour = "projectphase"
An Output plot can contain various objects (soil elements, plate elements, interfaces, loads, etc). In complex models where many objects are included, it is possible to hide or show them in order to make the plot easier for review. A few examples of the hide command are given below. Note that in order to show the objects you can use the show command in place of the hide command.
g_o.Plots[-1].hide(g_o.Plates) # hides all plates in the visualisation
g_o.Plots[-1].hide(g_o.Plate_1_1) # only hides the specific plate in the visualisation
g_o.Plots[-1].hide(g_o.WaterLoads) # hides any external waterloads in the visualisation
g_o.Plots[-1].hide(g_o.LineLoads) # only hides the line load, e.g. LineLoad_1_2
In many cases to review the results, the focus needs to be adjusted to a smaller part of the model. On this occasion, the zoom command can be used.A few examples of the zoom command are given below:
g_o.Plots[-1].zoom() # resets the zoom to show the whole model inside the Plot’s size
g_o.Plots[-1].zoom(g_o.Plate_2) # zooms to fit Plate_2 into the plot’s visualisation
g_o.Plots[-1].zoom(0, 1) # zooms the plot centering to point (0 1)
g_o.Plots[-1].zoom(0, 1, 2, 2) # zooms the plot to a bounding box by points (0 1) and (2 2)
The different viewpoints in PLAXIS 3D can be used to view the plot at a certain angle/side. A few examples of the view command are given below:
g_o.Plots[-1].view("bottom") # standard view angles, options are: left, right, front, back, bottom, top
g_o.Plots[-1].view("default") # change the view to the standard perspective view angle
After setting up the plot the final step is to use the command line to export the plot to an image file.An example of the export command is given below:
g_o.Plots[-1].export(r"C:\Plaxis\Plots\my_plot.png", 1920, 1080)
This command will export the lastly created plot (Plots[-1]) to the location specified within the quotation marks using a width of 1920 and height of 1080 pixels.Note that the width and height are optional parameters that can be omitted. If those parameters are not mentioned the program will export the plot using 2880 x 2160 pixels.
Note that the export command for Plots[-1] will use the value of the Phase property according to what the PhaseBehaviour dictates.
An alternative option is to export the plot to a PIL image object for further processing. This can be done by running the following command:
pil_image = g_o.Plots[-1].export()