Python command for Plaxis Output for a section

Hi plaxis community,

I am wondering if there is a python command to extract results from Plaxis Output for a given section. 

One can create a plot of the section using:

g_o.linecrosssectionplot(g_o.Plot_1, x1, y1, x2, y2)

My next steps would be choosing the type of the result and then opening the table output, so I only get results from the section drawn.

I would like to automate these steps, but could not find suitable commands for the steps of

Tool>Table (or ctrl+T)

copy / paste the results from the table

Would it be possible to do this via python command?

or do I need to go the long way, extracting all the nodes results, separating the near-by ones and interpolating to get the value for the section?

Many thanks and kind regards,

Nataly

 

 

Parents
  • Hello Nataly, 

    I guess you are searching for the getcrosssectionresults command.

    For example, in the screenshot above I use it as follows:

    g_o.getcrosssectionresults(g_o.Plots[-1], g_o.Phases[-1], g_o.ResultTypes.Soil.Ux, True)

    You can find more information about our commands under Help > Command reference.

  • Hello Stefanos,

    thank you for your response. Unfortunately this command is not recognized by Plaxis in my case (see screenshots attached). Can it be due to the version of Plaxis? I am using V22.

  • Yes, correct.

    The command was released on our first update of V22 (V22.01):  PLAXIS 2D CE V22.01.00 Release notes 

    But you can feely update to the latest of V22, which is V22.02 if your projects allow you, to get the most of the functionality we offer:
    PLAXIS 2D CE V22.02.00 Release notes 

  • I have only access to V22.00 or V23.

    I installed V23, to only find out that the syntax apparently changed again and my scripts that run on V22 do not run on V23.  

    Questions at this point:

    1. do you have a translation guide (like the one for V21 --> V22) now for V22 --> V23?

    e.g.

       s, g = new_server(server_address, localhostport_output, password=passwd)

        s.new()

    to start a new model is not working anymore and gives the following error:

        raise JSONDecodeError("Expecting value", s, err.value) from None

        JSONDecodeError: Expecting value

    In the command manual I could not find any reference to the change in commands related to starting a new project.

    2. do you plan at some point to stop changing the commands for the new Plaxis versions? It is extremely frustrating to have to re-write the scripts written for an older version, if an update is installed. 

    e.g. the BoundingBox command output has a new format that differs from the previous plaxis versions. I just can't see how that is a change that is essential for the software performance. 

  • Hello Nataly,

    Thank you for your feedback.

    With PLAXIS 2023.1 we made some changes to the materials as we dramatically improved the way we store things and to accommodate for changes in the future.

    For this reason, we have introduced this page in which you can find the major changes and apply a global replacement on the material properties:  Material Property changes for Python scripting 

    Other than that, you can always check our  PLAXIS 2D Command compatibility notes page, which covers the rest of the changes that can occur from time to time as we try to have consistency in our software. 

    To your questions:

    1. We did not change anything on this part. The error indicates some decoding issue so I am guessing something happened with the file itself. I can only suggest that you download this example code I have and compare the encoding with the one you created.
    boilerplate_with_SciTE.py

    If you need further assistance, please feel free to create a support case: https://bentleysystems.service-now.com/csp

    2. Apologies for the frustration caused. We try to improve our software to make things consistent. We are not planning any major changes to the commands and objects in the near future, however, we may make changes if we find mistakes or omissions. I guess that you can understand why we do this.
    These would be mentioned in the compatibility notes we release (see link above).

    The BoundingBox was an attribute that was before a simple string. We have now implemented it to be an object with attributes (intrinsic properties). 
    This means that you no longer need to parse the string to retrieve the coordinates but simply access them directly as properties:

    echo Polygon_1.BoundingBox.xMax

    This was a long request from multiple users and we believe that can enhance your automation scripts, too. 

  • Thank you for your extensive answer.

    1. I had a look at your code - it is identical with the one I had. Running your code results in the same error message for me:

    Using an older version of Plaxis (V22) gives no error.

    Tracing the scripts last calls, it comes from plxscripting\server.py --> plxscripting\connection.py --> plxscripting\requests\models.py which then runs json decoder.py which gives the error. 

    So, it is a decoder issue, but it is caused by some the plaxis related models.py code. I assume. It is hard to say, I am not a programmer.

    I managed to numb the error, forcing the script to ignore it and continue by exception, but this doesn't seem like a proper solution.

    Do you think it makes sense, to create a support case and share my script with Bentley - you might not get the same error message at all, if your s_i.new() does not cause an error.

    2. going back to the original topic:

    using g_o.getcrosssectionresults(g_o.Plots[-1], g_o.Phases[-1], g_o.ResultTypes.Soil.Uy, True) + g_o.echo() solved my problem.

    Thank you! 

  • Hello Nataly,

    Great to hear that the getcrosssectionresults helped you. Note that you can also just assign the command to a variable when you run it, and instead of echo, which is the PLAXIS command for print, simply print the result in Python. For example:

    cs_results = g_o.getcrosssectionresults(g_o.Plots[-1], g_o.Phases[-1], g_o.ResultTypes.Soil.Uy, True)
    print(*cs_results)

    Please open a Case as it seems a specific issue I cannot reproduce. Then, we can investigate.

    Also, I noticed that you are using Spyder, which is a third-party IDE that uses different modules, which, in some cases, conflicts with the PLAXIS Python distribution if there is a version mismatch.

    Reach out to support and we can help you with that: https://bentleysystems.service-now.com/csp

Reply
  • Hello Nataly,

    Great to hear that the getcrosssectionresults helped you. Note that you can also just assign the command to a variable when you run it, and instead of echo, which is the PLAXIS command for print, simply print the result in Python. For example:

    cs_results = g_o.getcrosssectionresults(g_o.Plots[-1], g_o.Phases[-1], g_o.ResultTypes.Soil.Uy, True)
    print(*cs_results)

    Please open a Case as it seems a specific issue I cannot reproduce. Then, we can investigate.

    Also, I noticed that you are using Spyder, which is a third-party IDE that uses different modules, which, in some cases, conflicts with the PLAXIS Python distribution if there is a version mismatch.

    Reach out to support and we can help you with that: https://bentleysystems.service-now.com/csp

Children
No Data