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 How to retrieve results from PLAXIS Output by the node number
    • Sign in
    • -PLAXIS 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
          • 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. 

    How to retrieve results from PLAXIS Output by the node number

    Application PLAXIS 2D
    PLAXIS 3D
    Version PLAXIS 2D CONNECT Edition V21
    PLAXIS 3D CONNECT Edition V21
    Date created 30 July 2021
    Date modified 30 July 2021

    Description

    In this article, a simple example is provided on how to retrieve results from the PLAXIS 2D Output program by providing the node number. The Python script can be used in combination with a phase and considering various results defined by the user.

    Python solution

    By using the Remote Scripting Server in the Plaxis 2D Output program, we can create a Python script to automatically retrieve the results for a specified node. The attached script requires the user to define the following variables:

    • phase_ref: the specific Output phase to consider
    • node_number: the exact node number 

    The Python script will then:

    • gather the results for x, y coordinates, and the horizontal displacements (ux) of soil using the getresults command
    • print all the results in an organized way

    Boilerplate code

    In order to use the Python script, you must make sure that your Python script can communicate with the PLAXIS application. For more information on the boilerplate code please check the following article on Using PLAXIS Remote scripting with the Python wrapper.

    Note that the Python script uses the g_o variable. This variable is bound to the global object of the current open Plaxis model in Output.

    Python code

    from plxscripting.easy import *
    
    port = 'YOUR PORT ID'
    password = r'YOUR_PASSWORD'
    s_o, g_o = new_server('localhost', port, password=password)
    
    
    def getnodeid_result(phase, resulttype, nodeid):
        """
        finds the index in the results lists for the node id 
    and then returns the value for the resulttype for soil data
    :param phase: Output phase object :param resulttype: PLAXIS Output Soil Result Type :param nodeid: integer of the node ID :return: result value """ nodeindex = None resultLocation = 'Node' _resulttypeID = g_o.ResultTypes.Soil.NodeID _nodeids = g_o.getresults(phase, _resulttypeID, resultLocation) # use local list to find the index, otherwise an index command will be send to PLAXIS: nodeindex = _nodeids[:].index(nodeid) if nodeindex is not None: _resultvalues = g_o.getresults(phase, resulttype, resultLocation) _requestedvalue = _resultvalues[nodeindex] return _requestedvalue print('Could not find the requested node number in the results of this phase') return None def getnodeid_ux(phase, nodeid): """ returns the result for Ux for the specific phase and node number """ return getnodeid_result(phase, g_o.ResultTypes.Soil.Ux, nodeid) def getnodeid_x(phase, nodeid): """ returns the result for X-coordinate for the specific phase and node number """ return getnodeid_result(phase, g_o.ResultTypes.Soil.X, nodeid) def getnodeid_y(phase, nodeid): """ returns the result for Y-coordinate for the specific phase and node number """ return getnodeid_result(phase, g_o.ResultTypes.Soil.Y, nodeid) # set your input for the Phase reference and the selected node number phase_ref = g_o.Phase_1 node_number = 1903 # retrieve values x = getnodeid_x(phase_ref, node_number) y = getnodeid_y(phase_ref, node_number) ux = getnodeid_ux(phase_ref, node_number) # show the result print("Node {}: [X={}; Y={}]: ux = {} m".format(node_number, x, y, ux))

    Version

    This script has been made for PLAXIS 2D CONNECT Edition V21 Update 1 using Python 3.7.x.

    Notes

    The current Python script can also be used with the PLAXIS 3D Output application considering the extra axis (z-axis) for 3D models.
    Furthermore, it can be used for retrieving any available result provided in the PLAXIS Output. This requires:

    • adding/editing function(s) accordingly, following the logic of the existing functions, such as the getnodeid_x()
    • adding/editing the call to the function(s) at the retrieve values
    • adding/editing the lists in the print statement (in the format() function)

    Disclaimer

    Copyright (c) Plaxis bv. All rights reserved. Unless explicitly acquired and licensed from Licensor under another license, the contents of this file are subject to the Plaxis Public License ("PPL") Version 1.0, or subsequent versions as allowed by the PPL, and You may not copy or use this file in either source code or executable form, except in compliance with the terms and conditions of the PPL.

    All software distributed under the PPL is provided strictly on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND LICENSOR HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT, OR NON-INFRINGEMENT. See the PPL for specific language governing rights and limitations under the PPL.

     

    See also

    Using PLAXIS Remote scripting with the Python wrapper    [Tips and Tricks]


    Output scripting example: create curve data    [Python Scripts]


    Identify Python commands from Plaxis command line    [Python Scripts]


    Output scripting example: get maximum bending moment    [Python Scripts]

    • output
    • PLAXIS 3D
    • python
    • API
    • Automation
    • Scripting
    • PLAXIS
    • Remote scripting
    • python cookbook
    • PLAXIS 2D
    • Share
    • History
    • More
    • Cancel
    • Stefanos Papavasileiou Created by Bentley Colleague Stefanos Papavasileiou
    • When: Wed, Jul 28 2021 10:55 AM
    • Stefanos Papavasileiou Last revision by Bentley Colleague Stefanos Papavasileiou
    • When: Tue, Feb 15 2022 6:11 AM
    • Revisions: 8
    • 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