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 Combined plate results in one chart using Python
    • Sign in
    • +Working from home with PLAXIS
    • Working from home with SOILVISION
    • -PLAXIS | SOILVISION Wiki
      • Geotechnical SELECT Entitlements [GSE]
      • -PLAXIS
        • PLAXIS CONNECT Edition and legacy versions
        • +License - PLAXIS
        • +PLAXIS Software downloads
        • +Release Notes PLAXIS 2D and PLAXIS 3D
        • +Manuals - PLAXIS
        • -API / Python scripting - PLAXIS
          • How to install additional Python modules in PLAXIS
          • Access to Staged Construction settings using Python
          • Automatic line cross-section chart generation using Python
          • Changing the material colour using Python scripting
          • Combined plate results in one chart using Python
          • Create custom connection with selection API
          • How to create a tunnel using Python
          • How to get a load - displacement curve using Scripting interface
          • Identify Python commands from Plaxis command line
          • Material lists in PLAXIS – Python
          • 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
          • 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
          • Adding functionality to PLAXIS Calculation Manager: pre- and post-processing
          • Remove invalid custom connections for PLAXIS 3D
        • +Downloads - PLAXIS
        • +Known issues - PLAXIS
        • +Models - PLAXIS
        • +Publications
        • +Tips and Tricks
        • +Tutorials - PLAXIS
        • +Verifications - PLAXIS
        • +Videos - PLAXIS
      • +PLAXIS MoDeTo
      • +SOILVISION
      • +Subscription Entitlement Service

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

    Combined plate results in one chart using Python

    Application PLAXIS 2D
    Version PLAXIS 2D 2017
    Date created 30 May 2017
    Date modified 30 May 2017

    A Python script combining forces and displacements for a single wall into a plot and table

    Introduction

    In order to retrieve and document results for retaining walls (vertical plates) in PLAXIS 2D Output, several plots and tables need to be inspected and copied separately. For instance:

    • A plot for the horizontal displacements (ux)
    • A plot for the axial forces (N)
    • A plot for the bending moments (M)
    • A table for the displacements ( |u|, ux, uy)
    • A table for the forces (N, Q, and M)

    When copying this data for many phases, this can be a lot of work, and is prone to human error, e.g. by taking the wrong phase or by forgetting to press Ctrl+C when inspecting a table.

    Python solution

    By using the Remote Scripting Server in the Plaxis Output program, we can create a Python script to automatically retrieve the desired displacements and forces for a certain vertical plate. The attached script will ask the user to define the X-coordinate for the vertical plate and to define for which phase the results should be obtained.

    The Python script will then:

    • Gather the plate results and filter them based on the X-coordinate
    • Create a table of these results and copy this table to the Windows clipboard (tab-delimited). This can then easily be pasted into a spreadsheet program.
    • Generate a chart, showing the wall with the results for horizontal displacement (ux), axial force (N) and bending moment (M) in one chart.

    Script output - table

    The resulting table will be copied to the clipboard to be used in e.g. a spreadsheet program. It will contain a header with info on the phase the results are for and for which X-coordinate the results are taken, followed by the actual data table. The data is stored as tab-separated values.

    Based on the final phase of Tutorial Lesson 2, this table will look like this:

    PLAXIS 2D Result script: Plate results
    For phase: Third excavation stage [Phase_5]
    Step number: Step_24
    Vertical plate at X = 50.0 m
    
    X    Y      u_x                  u_y                   |u|                 N                      Q                    M                      rotation
    [m]  [m]    [m]                  [m]                   [m]                 [kN/m]                 [kN/m]               [kNm/m]                [°]
    50   20     0.0224266240723166   -0.00775284541048889  0.0237288870206748  -0.000503572077390047   0.0171521096654468   2.87346535454702e-13  0.480217532450464
    50   19.75  0.0245219323623862   -0.00775279974664634  0.0257183022514521  -2.76566870972096      -1.16857362594199    -0.114778674602701     0.480218001424812
    50   19.5   0.0266170992800733   -0.00775265919316243  0.0277231617722547  -5.69441776254759      -3.73654034658163    -0.699885794686862     0.480223070463705
    50   19.25  0.028712053956832    -0.00775241824433458  0.029740242619305   -8.79201320755032      -7.67343619438683    -2.09749667300932      0.480241927766234
    50   19     0.0308067771926515   -0.00775207114821604  0.031767154862919   -12.0637175217222      -12.965949311491     -4.64903832929917      0.480288664180428
    [...]
    

    Script output - plot

    The Python script will define a matplotlib-chart with one vertical axis for the plate and three horizontal axes: u_x, N and M. This chart is based on the parasites example from Matplotlib.

    Based on the final phase of Tutorial Lesson 2, this chart will look like this:

    Python generated plot showing combined results for displacements and forces

    Figure 1. Python generated plot showing combined results for displacements and forces for Tutorial Lesson 2's final phase.

    Note: this Python script will directly use the data from the PLAXIS Output program. The only exception is for the horizontal displacement ux: when the SI unit for length [m] is used, the deformation values for the curve data are converted to [mm] to improve the reading of the generated graph.

    Modules used

    The Python script requires the following modules:

    • The plxscripting module to interact with PLAXIS 2D Output
    • The matplotlib module to create a chart
    • The pyperclip module to copy the content to the Windows clipboard
    • The easygui module to create a nice user interface for the user to set values in order to retrieve results: the X-coordinate of the vertical plate and the phase to retrieve the results for.

    All modules are part of the standard PLAXIS 2D 2017 installation that includes a full Python 3.4.x distribution.

    Usage instructions for Python script

    To use this file:

    1. Download the file (use Save As...)
    2. Unpack the zip file and copy the *.py file to this folder:
      <PLAXIS 2D installation folder>\pytools\output
      By default the installation folder for PLAXIS 2D is:
      C:\Program Files\Bentley\Geotechnical\PLAXIS 2D CONNECT Edition V20\
      For older versions, this is:
      C:\Program Files\Plaxis\Plaxis 2D\
    3. Restart PLAXIS 2D Output and open a Plaxis file with an activated retaining wall (vertical plate)
    4. In the Expert menu, go to Python > Run script > Tools. Here you should see the name of the Python file. When selecting it, it will execute the script to retrieve the results for the plate:
      •  As a table in the Windows clipboard
      •  Followed by generation of the chart

    When you do not have access rights to add the script in this folder, alternatively, you can choose to use Expert menu > Python > Run script > Open... to manually open and run the file.

    Version

    This script has been made for PLAXIS 2D 2017.00 using Python 3.4.x

    Disclaimer

    This Python script is made available as a service to PLAXIS users and can only be used in combination with a Bentley Geotechnical SELECT Entitlement [GSE] (former PLAXIS-VIP) license.
    You use this Python script at your own responsibility and you are solely responsible for its results and the use thereof. Plaxis does not accept any responsibility nor liability for the use of this Python script nor do we provide support on its use.

    Downloads

    • [Python script] Combined plate result in one chart
    • bending moment
    • bending
    • python
    • pytool
    • API
    • App
    • Automation
    • Scripting
    • PLAXIS
    • table
    • deflection
    • plot
    • matplotlib
    • tool
    • PLAXIS 2D
    • pyapp
    • 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, Oct 13 2020 6:20 AM
    • Revisions: 3
    • 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