In PLAXIS Input it is very common to use the mouse to perform actions. It is typical to select a point load to activate or multi-select polygons to assign a material data set. In this workflow, the selection of such Plaxis objects is important for the Input program.
With Python scripting, it is now possible to take advantage of the interactive selection of objects and pass them to the scripting layer for further usage.
The new feature is called selection and it allows to “integrate” with the PLAXIS Input program. With the selection API, you can access any selected entities which allows for even more automated procedures to be implemented.
In a Python script or the interpreter, you can access any selected-by-mouse entities using following:g_i.selection
For example, the following allows printing the name of the geometric objects selected by mouse:
for item in g_i.selection:
Note that the selection is an object which is in between a list and a set in Python: it cannot contain duplicate items, but it is ordering-sensitive. The order of the selected items may influence the commands to be executed following the rules of the native Plaxis command line.
The selection object behaves as a list in the Plaxis scripting environment.
To find an example of the selection API, follow the Related posts below.
Create custom connection with selection API