Printing "structure plots" of embedded beams to png files
This section introduces a tool for exporting the "structure plots" of embedded beams of a PLAXIS model to png format using the PLAXIS API.
To ensure smooth execution, it is recommended to divide the script into smaller segments and run them sequentially in a Jupyter Notebook.
Markdown
General set up for remote control
Python
# This is a compulsory step
from plxscripting.easy import *
# Change the password as shown on your computer below.
user_password = 'use your own password here'
s_i, g_i = new_server('localhost', 10000, password = user_password)
s_o, g_o = new_server('localhost', 10001, password = user_password)
Markdown
Plot all embedded beam elements graphically in a single phase
Python
# Updated: 2025-11-03
# Get all embedded beam elements in a single phase, plot and save to files in order
# Adjust the output types to Ux, Uy, Utot, M2D, Q2D, SPUx, Nx2D
# Be careful, Python is case sensitive
folderpath = r"C:\Users\username\Desktop\Plaxis_playground\plotting\\" # use your own path
embedded_beams = g_o.EmbeddedBeams
phase = g_o.Phase_1
# if all phases are required, simply use "phases = g_o.Phases" without parenthesis. Then add an outer loop to iterate all phases.
# Activate the phase that you like to show the results
g_i.view(phase) # This adds a plot window to show the calculation results of the selected phase. The default setting is deformed mesh.
g_o.Plots[-1].Phase = phase # This parse the data of the selected phase to list of Plots[].
for index, beam in enumerate(embedded_beams): # loop through all beam elements in embedded_beams
g_o.structureplot(beam) # This adds a plot window to show the "distribution type" of plot as the last plot, i.e.Plots[-1]
g_o.Plots[-1].ResultType = g_o.ResultTypes.EmbeddedBeam.Nx2D # change the result type to axial force N. Other types are Ux, Uy, Utot, M2D, Q2D, SPUx.
filename_str = "beam_"+str(index)
file_name = f"{folderpath}{filename_str}.png"
g_o.Plots[-1].export(file_name)
# Refer to the deformed mesh section for more details about changing the project description and other settings.
# If needed, add a outer loop to iterate all phases. This will increase the number of unorganised plots in a folder. It is recommended to design a output template to present the plots in a proper order.