Create custom connection with selection API


ApplicationPLAXIS 3D
VersionPLAXIS 3D 2018
Date created27 June 2019
Date modified27 June 2019

In order to create a custom connection in PLAXIS 3D Input program the following steps are needed (see also video):

  1. Select a beam or a plate
  2. Holding Ctrl+LMB multi-select the connecting plate (LMB=left-mouse button)
  3. RMB to open the popup window with options (RMB=right-mouse button)
  4. Select the option: Create a custom connection

Note that a custom connection is possible between two plates and between a beam and a plate. For more information please check our Reference manual.

The above procedure is easy and straightforward when only a few custom connections are to be defined. However, when many connections are to be created this starts becoming cumbersome (see attached video: Create custom connection with PLAXIS GUI).

With the selection API, this can be done even faster by directly clicking on the objects of interest one after the other and the Python script will do the rest (see attached video: Create custom connection with PLAXIS Python selection API):

from plxscripting.plx_scripting_exceptions import PlxScriptingError 

print('Python script running...') 

while True: 
    sel_objs = g_i.selection[:] 
    if not sel_objs: 
            pass  # nothing selected 
    else: 
        if len(sel_objs) == 2: 
            try: 
                g_i.connection(*sel_objs) 
                g_i.selection = []  # empty the selection 
            except PlxScriptingError: 
                print('Connection already exists. Choose next objects or quit.') 
                g_i.selection = []  # empty the selection                         
                pass  # command failed so back to the while-loop 
         else: 
            pass  # continue the while-loop until two items are selected

Conditions

The following should be considered about the code above:

Usage instructions for Python script 

To use this Python script: 

Alternatively, the Python script can be run from the dedicated folder for Python tools in the installation directory. By default, this is at:
C:\Program Files\Bentley\Geotechnical\PLAXIS 3D CONNECT Edition V20\pytools\input
For older versions, this is:
C:\Program Files\Plaxis\Plaxis 3D\pytools\input
The Python script can then be found in PLAXIS Input Expert menu, under Python > Run Python tool.

Note that for this approach the boilerplate needs to be adjusted to:
s_i, g_i = new_server()

Version

The script is tested with PLAXIS 3D 2018.01 and Python 3.4 using Tutorial 2 - Excavation in sand from the Plaxis Tutorial Manual.

Downloads

See also