Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
  • Welcome
  • Products
  • Support
  • About
  • More
  • Cancel
PLAXIS | SOILVISION
  • Product Communities
  • More
PLAXIS | SOILVISION
PLAXIS | SOILVISION Wiki Identify Python commands from Plaxis command line
    • Sign in
    • -Geotechnical Analysis Wiki
      • +Geotechnical SELECT Entitlements [GSE]
      • -PLAXIS
        • +Software and License - PLAXIS
        • +Documentation - PLAXIS
        • -API / Python scripting - PLAXIS
          • Access to Staged Construction settings using Python
          • Adding functionality to PLAXIS Calculation Manager: pre- and post-processing
          • Automatic line cross-section chart generation using Python
          • Automatically generated cross-sections of embankments
          • Changing the material colour using Python scripting
          • Combined plate results in one chart using Python
          • Create custom connection with selection API
          • Export and format plots from PLAXIS Output using Python
          • How to create a tunnel using Python
          • How to get a load - displacement curve using Scripting interface
          • How to install additional Python modules in PLAXIS
          • How to open and close a PLAXIS project with Python
          • How to retrieve results from PLAXIS Output by the node number
          • Identify Python commands from Plaxis command line
          • Material lists in PLAXIS – Python
          • Material Property changes for Python scripting
          • 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
          • Polycurves to Polygons in PLAXIS 2D using Python
          • Receive instant notifications for finished calculations on your phone
          • Remove invalid custom connections for PLAXIS 3D
          • Retrieve coordinates of a Polygon in PLAXIS 2D using Python
          • Retrieving soil layer info from boreholes using Python
          • Scripting reference and how to use it
          • Selection API for PLAXIS Input
          • Soil layer material assignment using Python
          • Tunnel advancement script for PLAXIS 3D
          • User defined Python script (3D): Extract displacements by coordinates
        • +Known issues - PLAXIS
        • +Models - PLAXIS
        • +Tips and Tricks
        • +Publications
        • +Videos - PLAXIS
      • +PLAXIS LE
      • +PLAXIS Monopile Designer
      • +SOILVISION
      • +Subscription Entitlement Service
    • +Working from home with PLAXIS
    • +Working from home with PLAXIS LE

     
     Questions about this article, topic, or product? Click here. 

    Identify Python commands from Plaxis command line

    Application PLAXIS 2D
    PLAXIS 3D
    Version PLAXIS 2D
    PLAXIS 3D
    Date created 28 October 2015
    Date modified 28 October 2015

    Introduction

    Since PLAXIS CONNECT Edition V20, extensive documentation is available regarding the Remote Scripting functionality.
    This can be found under Help > Scripting reference menu:

    scripting_reference_1

    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 start 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.

    Commands reference

    The first step to identify 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.

    Plaxis Commands in Python

    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:

    • To call a command, prefix the command with the global object reference (in the boilerplate referred to as g_i) and add the parameters in brackets
    • To refer to a Plaxis object, prefix the Plaxis object name also with this global object reference.

    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.

    Add a borehole in PLAXIS 2D

    Plaxis command borehole 5
    Python equivalent
    g_i.borehole(5)
    

    Add a point in PLAXIS 2D

    Plaxis command point 1 2
    Python equivalent
    g_i.point(1, 2)
    

    Change the x-coordinate for a point

    Setting a single value to a so-called intrinsic property can be achieved using different Python syntax:

    Plaxis command set Point_1.x 9.3
    Python equivalent (recommended)
    g_i.Point_1.x = 9.3
    
    alternatives in Python
    g_i.Point_1.x.set(9.3)
    

    Info and Echo

    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 
    Colours     
      Commands: echo, commands, rename, set, info, setproperties     
      Attributes: Apple, Aqua, BabyBlue, Black, BlackBerry, Blue, Brown, ...   
    0012> echo Point_1 
    Point named "Point_1"     
      x: 5     
      y: 5   
    0013> info Point_1 
    Point_1     
      Commands: echo, commands, rename, set, info, setproperties, movedisconnected   
      Attributes: Name, Comments, UserFeatures, x, y, z 

    Practical tip to obtain Python command

    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 borehole
    In 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:

    Plaxis command _set Soillayer_1.Zones[0].Top 2
    Python equivalent
    g_i.Soillayer_1.Zones[0].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.

    Python wrapper script examples

    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 of your own Python script.

    See also

    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]


    Receive instant notifications for finished calculations on your phone

    [Python Scripts]


    Using PLAXIS Remote scripting with the Python wrapper

    [Tips and Tricks]


    Remote Scripting API: Drivemining

    [Videos]


    Scripting reference and how to use it

    [Python Scripts]

    • PLAXIS 3D
    • python
    • API
    • Scripting
    • Reference
    • PLAXIS
    • Remote scripting
    • PLAXIS 2D
    • Share
    • History
    • More
    • Cancel
    • Micha van der Sloot Created by Bentley Colleague Micha van der Sloot
    • When: Wed, Dec 18 2019 9:35 AM
    • Stefanos Papavasileiou Last revision by Bentley Colleague Stefanos Papavasileiou
    • When: Tue, Feb 15 2022 6:11 AM
    • Revisions: 4
    • Comments: 0
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2021 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies