Python Output of data

      hi,dears!

             Using Python to output the result data can be output with coordinates (x, y) together?similar to the PLAXIS output interface.

      thx!

Parents
  • Hi Xiong,

    With PLAXIS Python scripting, you can get the data or results per node. Then you can combine them in Python.
    This small code block example shows you how to do this:

    output_port = 10001
    password = r'YOUR_PASSWORD'
    
    from plxscripting.easy import *
    s_o, g_o = new_server('localhost', output_port, password=password)
    
    # set your phase
    phase = g_o.Phase_6
    
    # collect the data/results per type
    X_values = g_o.getresults(phase, g_o.ResultTypes.Plate.X, "node")
    Y_values = g_o.getresults(phase, g_o.ResultTypes.Plate.Y, "node")
    ux_values = g_o.getresults(phase, g_o.ResultTypes.Plate.Ux, "node")
    uy_values = g_o.getresults(phase, g_o.ResultTypes.Plate.Uy, "node")
    utot_values = g_o.getresults(phase, g_o.ResultTypes.Plate.Utot, "node")
    
    # make a table:
    table_rows = []
    header = "\t".join(["X", "Y", "u_x", "u_y", "|u|"])
    table_rows.append(header)
    # loop over all data entries
    for x, y, ux, uy, utot in zip(X_values, Y_values, ux_values, uy_values, utot_values):
        # change to string representation for display purposes
        newrow = "\t".join(["{}".format(i) for i in [x, y, ux, uy, utot]])
        # add the new row to the table
        table_rows.append(newrow)
    
    # print full table
    print("\n".join(table_rows))
    

    Kind regards,

    Micha 

Reply
  • Hi Xiong,

    With PLAXIS Python scripting, you can get the data or results per node. Then you can combine them in Python.
    This small code block example shows you how to do this:

    output_port = 10001
    password = r'YOUR_PASSWORD'
    
    from plxscripting.easy import *
    s_o, g_o = new_server('localhost', output_port, password=password)
    
    # set your phase
    phase = g_o.Phase_6
    
    # collect the data/results per type
    X_values = g_o.getresults(phase, g_o.ResultTypes.Plate.X, "node")
    Y_values = g_o.getresults(phase, g_o.ResultTypes.Plate.Y, "node")
    ux_values = g_o.getresults(phase, g_o.ResultTypes.Plate.Ux, "node")
    uy_values = g_o.getresults(phase, g_o.ResultTypes.Plate.Uy, "node")
    utot_values = g_o.getresults(phase, g_o.ResultTypes.Plate.Utot, "node")
    
    # make a table:
    table_rows = []
    header = "\t".join(["X", "Y", "u_x", "u_y", "|u|"])
    table_rows.append(header)
    # loop over all data entries
    for x, y, ux, uy, utot in zip(X_values, Y_values, ux_values, uy_values, utot_values):
        # change to string representation for display purposes
        newrow = "\t".join(["{}".format(i) for i in [x, y, ux, uy, utot]])
        # add the new row to the table
        table_rows.append(newrow)
    
    # print full table
    print("\n".join(table_rows))
    

    Kind regards,

    Micha 

Children
No Data