Since PLAXIS CONNECT Edition V20, extensive documentation is available regarding the Remote Scripting functionality.This can be found under Help > Scripting reference menu:
More information on the Scripting reference can be found in the article Scripting reference and how to use it.
The basics for starting the Remote Scripting and starting using the Python wrapper to interact with Plaxis can be found in the PLAXIS Reference manual's Appendices and in the article Using PLAXIS Remote scripting with the Python wrapper.
The first step to identifying the command syntax when using the Python scripting functionality is to understand the Plaxis native commands.
Inside the Plaxis programs, you can access the full Commands and Objects reference under the Help > Command reference menu. This will open an HTML-based documentation on your default browser. See also Command line reference.
The Commands and Object reference describes how to directly use the Commands in the Plaxis Command line. With this it is easy to construct the command to be used inside the Python wrapper:
In the examples below, we used the boilerplate code example from this page: Using PLAXIS Remote scripting with the Python wrapper, i.e. we can refer to g_i as the global object of the current open Plaxis model in Plaxis Input.
Setting a single value to a so-called intrinsic property can be achieved using different Python syntax:
g_i.Point_1.x = 9.3
Setting the Conditions property of the WaterConditions of a BoreholePolygon's Soil object (for PLAXIS 2D; in PLAXIS 3D that is BoreholeVolume) in Staged construction can be achieved using a different Python syntax:
g_i.WaterConditions_1_1.Conditions[g_i.Phase_1] = "Dry"
g_i.BoreholePolygon_1_1.Soil.WaterConditions.Conditions[g_i.Phase_1] = "Dry"
Practically, sometimes it is useful to use the info and echo command in the PLAXIS Input program to get more details about an object. For instance when using it for the Colours object or for a point object Point_1 to obtain more info about the available parameters and their spelling, and to see which commands and attributes are available:
0010> echo Colours
Colours named "Colours"
0011> info Colours
Commands: echo, commands, rename, set, info, setproperties
Attributes: Apple, Aqua, BabyBlue, Black, BlackBerry, Blue, Brown, ...
0012> echo Point_1
Point named "Point_1"
0013> info Point_1
Commands: echo, commands, rename, set, info, setproperties, movedisconnected
Attributes: Name, Comments, UserFeatures, x, y, z
A practical tip if you are trying to figure out what command to use in Python, is to do the action you want to perform by using the mouse and keyboard in the Graphical User Interface (GUI), and read the generated command in the Command Session pane. Then, this command should be easily transferable into a Python command.Example: change the top of a boreholeIn order to do this via the GUI, we need to open the Modify soil layers window and change the top of the first soil layer. e.g. we change it to y = 2 m:
This will generate the following command to apply the change from which we can create the Python equivalent:
g_i.Soillayer_1.Zones.Top = 2
Alternatively, this can be configured using the setsoillayerlevel command. For more documentation on the specific parameters for the used setsoillayerlevel command or any other command, please refer to the Commands reference.
For more details on this Python wrapper and some code examples, please see the article on Scripting reference and how to use it and the appendix on the Python HTTP REST API wrapper in the PLAXIS Reference manuals.
In the PLAXIS wiki, you can also find some scripting examples which can be used as a basis for your own Python script.
Command line reference
[Tips and Tricks]
Output scripting example: create curve data
Output scripting example: get anchor force
Output scripting example: get heave of excavation bottom
Output scripting example: get maximum bending moment
Receive instant notifications for finished calculations on your phone
Using PLAXIS Remote scripting with the Python wrapper
Remote Scripting API: Drivemining
Scripting reference and how to use it
Access to Staged Construction settings using Python