The PLAXIS software provides an HTTP based API (REST HTTP API), for which a special Python wrapper was developed for an easy to use scripting API. Both PLAXIS Input and PLAXIS Output support this usage of a Remote Scripting server.
The information in this article applies to both 2D and 3D 2017 versions and later, as well as to 3D 2016 version. For older versions, please see the attachment at the end of this article.
In order to use this:
In order to start using this Remote Scripting/REST HTTP API, the remote scripting server inside PLAXIS needs to be activated. This can be done by opening the menu item Expert > Configure remote scripting server. The corresponding window will pop up, see Figure 1 for the latest versions of PLAXIS 2D and PLAXIS 3D and Figure 2 for PLAXIS 3D 2016:
Figure 1. Configure remote scripting server window in PLAXIS 2D and PLAXIS 3D
Figure 2. Configure remote scripting server window in PLAXIS 3D 2016
In order for the Remote Scripting server to run, you would need:
PLAXIS 2D 2017 and later, PLAXIS 3D 2017 and later
Figure 3. Run the remote scripting server requirements:1) valid license, 2) connection with the Remote Plaxis service website, 3) passwordand 4) a local connection port
PLAXIS 3D 2016
Figure 4. Run the remote scripting server requirements:1) valid license, 2) connection with the Remote Plaxis service websiteand 3) a local connection port
In order to start your first Python script, you can start SciTE from the Windows Start menu. First, we must import the Plaxis scripting library. Then, you must make sure that your Python script can communicate with the PLAXIS application (assuming the scripting server port was set to 10000, see above):
from plxscripting.easy import * s_i, g_i = new_server('localhost', 10000, password='yourpassword')
In this, we need to set the correct localhost port using the same number as set in the Configure remote scripting server window as well as the password field required (PLAXIS 2D only).
Now we have two new variables:
For PLAXIS Output, the recommended variable names are:
Note, if you want to use both PLAXIS Input and PLAXIS Output in your Python script, you will need to set up the connection with Input and Output separately by binding the server and the global object for Input and Output separately using each their own port number:
# PLAXIS 2D and PLAXIS 3D # [...] localhostport_input = 10000 localhostport_output = 10001 from plxscripting.easy import * s_i, g_i = new_server('localhost', localhostport_input, password='yourpassword') s_o, g_o = new_server('localhost', localhostport_output, password='yourpassword')
For older versions of PLAXIS 3D you can use the following boilerplate:
# PLAXIS 3D # [...] localhostport_input = 10000 localhostport_output = 10001 from plxscripting.easy import * s_i, g_i = new_server('localhost', localhostport_input) s_o, g_o = new_server('localhost', localhostport_output)
If your script gives an error, please check the following:
For more details on this Python wrapper and some code examples, please see the appendix on the Python HTTP REST API wrapper in the PLAXIS Reference manual and the related links.
Starting January 1st, 2022, the PLAXIS HWL versions and the VIP subscription have been discontinued. This includes access to the PLAXIS Remote Scripting services for these versions. To allow time for transition to the PLAXIS CONNECT Edition version, the Remote Scripting Server services for PLAXIS HWL versions will continue to function until December 31, 2022. After this date, the Remote Scripting Server services will be discontinued.
How to get a load - displacement curve using Scripting interface [Python Scripts]
Command line reference [Tips and Tricks]
Output scripting example: create curve data [Python Scripts]
Output scripting example: get anchor force [Python Scripts]
Output scripting example: get heave of excavation bottom [Python Scripts]
Output scripting example: get maximum bending moment [Python Scripts]
Identify Python commands from Plaxis command line [Python Scripts]
Receive instant notifications for finished calculations on your phone [Python Scripts]