How to retrieve results from PLAXIS Output by the node number


ApplicationPLAXIS 2D
PLAXIS 3D
VersionPLAXIS 2D CONNECT Edition V21
PLAXIS 3D CONNECT Edition V21
Date created30 July 2021
Date modified30 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:

The Python script will then:

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:

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