Bulk processing Plaxis results from multiple files

I have written a Python file to export plaxis results. Now I want to use it for multiple files.

I tried to run it in the command line:

"C:\Program Files\Seequent\PLAXIS 2D 2023.1\Plaxis2DOutput.exe" --AppServerPassword=YOURPASSWORD --AppServerPort=10001 " first plaxis file location and name here"

"C:\ProgramData\Seequent\PLAXIS Python Distribution V2\python\pythonw.exe" -u "python file here"

"C:\Program Files\Seequent\PLAXIS 2D 2023.1\Plaxis2DOutput.exe" --AppServerPassword=YOURPASSWORD --AppServerPort=10001 "second file here"

"C:\ProgramData\Seequent\PLAXIS Python Distribution V2\python\pythonw.exe" -u "python file here"

.......

I could open the output file, however, the Python file wouldn't run, unless I closed it, but once I closed it. Python file wouldn't find the results. The only way I open the output file, manually create the remote/port number and run the python file. Open the second file manually and run the python file.

Any way to run it in Python?

  • Hello Zhenhe,

    Any reason why not running it from any Python IDE, such as SciTE we deliver?

    Your code can be like the following:

    import subprocess
    
    # setting constants
    plx_input_path = r"C:\Program Files\Seequent\PLAXIS 2D 2023.1\Plaxis2DXInput.exe"
    plx_output_path = r"C:\Program Files\Seequent\PLAXIS 2D 2023.1\Plaxis2DOutput.exe"
    plx_input_port = 10000
    plx_output_port = 10001
    plx_pass = r'YOUR_PASSWORD'
    
    # launch PLAXIS application with port and password
    plx_i = subprocess.Popen([plx_input_path,
                              "--AppServerPort={}".format(plx_input_port),
                              "--AppServerPassword={}".format(plx_pass)])
    
    # Launch Output program
    plx_o = subprocess.Popen([plx_output_path,
                              "@",
                              "--AppServerPort={}".format(plx_output_port),
                              "--AppServerPassword={}".format(plx_pass)])
    
    # boilerplate for Plaxis remote scripting server
    from plxscripting.easy import *
    s_i, g_i = new_server('localhost', plx_input_port, password=plx_pass)
    s_o, g_o = new_server('localhost', plx_output_port, password=plx_pass)
    
    projects_to_run = [r'D:\Projects\Project_1.p2dx', r'D:\Projects\Project_2.p2dx', r'D:\Projects\Project_3.p2dx']
    
    # for-loop that has code that will run for all projects; here projects are in a list
    for project in projects_to_run:
        print('Running: {}'.format(project))
        s_i.open(project)
        g_i.Project.echo()  # command for Input
        g_i.view(g_i.Phases[-1])
        print(g_o.getresults(g_o.Phases[-1], g_o.ResultTypes.Soil.Uy, 'node')[-1])  # command for Output
        s_i.close()
        s_o.close()
    
    plx_i.terminate()    
    plx_o.terminate()    
    

    If you want to use a different Python file per project, then it can be that the Command Prompt you are launching is not using the python.exe we deliver but another one you have installed on your PC.

    I would recommend that you navigate to the PLAXIS Python distribution we deliver and start the Command Prompt via the pycmd.bat (batch file) we have created:
    C:\ProgramData\Seequent\PLAXIS Python Distribution V2\python\pycmd.bat