How to open and close a PLAXIS project with Python


ApplicationPLAXIS 2D
PLAXIS 3D
VersionCONNECT Edition V20 and later
Date created15 February 2022
Date modified24 August 2022
Original authorStefanos Papavasileiou - Bentley Technical Support Group

When using the PLAXIS scripting environment, it is possible to open and close any PLAXIS project using Python.

The following information can be used in both PLAXIS Input and Output applications. 

Functions to open and close

To open a project in PLAXIS Input program, you can use the Python function:

s_i.open('full path to PLAXIS project')
s_o.open('full path to PLAXIS project')  # for PLAXIS Output program

in which the <full path> is provided as a string including the PLAXIS file extension (.p2dx or .p3d).

For example:

s_i.open(r'C:\PLAXIS projects\2D\myproject.p2dx')
s_o.open(r'C:\PLAXIS projects\2D\myproject.p2dx')  # for PLAXIS Output program

Note: above the r means the string will be treated as a raw string and the backslashes used in the project path will not cause any conflicts in the Python language.

To close the current project in the session, you can use the command:

s_i.close()
s_o.close()  # for PLAXIS Output program

Note that there are no extra parameters to be defined in this case. Remember to always save your progress in PLAXIS Input before closing the project with the command:

g_i.save(r'C:\PLAXIS projects\2D\myproject.p2dx')

Extra options for PLAXIS Output

In PLAXIS Output a few extra commands are available depending on how the application should behave.

g_o.update()  # closes Output and stores the selected curve points
g_o.close()  # closes the PLAXIS Output program

About s_i, g_i, s_o and g_o variables

The article Using PLAXIS Remote scripting with the Python wrapper contains detailed information about the variables used in the boilerplate.

See also