Retrieve material properties

Hi all,

I am trying to use Python to control PLAXIS and would like to retrieve material properties from PLAXIS so that they can be automatically updated accordingly. 

Does anybody know where can find the files contain all the properties in the PLAXIS project? Or have experience in how to do that?

Thanks,

Kevin

Parents
  • Hi Micha,

    Thanks for your information and I played a bit with them. Some of the command such as "Changing the material colour using Python scripting" or "Access to Staged Construction settings using Python" works well, but when I tried "How to get a load - displacement curve using Scripting interface", by copying the commands it turns out following:

    Traceback (most recent call last):
    File "C:\ProgramData\Bentley\Geotechnical\PLAXIS Python Distribution V1\python\lib\site-packages\plxscripting\requests\packages\urllib3\connectionpool.py", line 480, in urlopen
    body=body, headers=headers)
    File "C:\ProgramData\Bentley\Geotechnical\PLAXIS Python Distribution V1\python\lib\site-packages\plxscripting\requests\packages\urllib3\connectionpool.py", line 285, in _make_request
    conn.request(method, url, **httplib_request_kw)
    File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\client.py", line 1244, in request
    File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\client.py", line 1290, in _send_request
    File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\client.py", line 1239, in endheaders
    File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\client.py", line 1026, in _send_output
    File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\client.py", line 966, in send
    File "C:\ProgramData\Bentley\Geotechnical\PLAXIS Python Distribution V1\python\lib\site-packages\plxscripting\requests\packages\urllib3\connection.py", line 88, in connect
    conn = self._new_conn()
    File "C:\ProgramData\Bentley\Geotechnical\PLAXIS Python Distribution V1\python\lib\site-packages\plxscripting\requests\packages\urllib3\connection.py", line 70, in _new_conn
    self.source_address,
    File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\socket.py", line 727, in create_connection
    File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\socket.py", line 716, in create_connection
    ConnectionRefusedError: [WinError 10061]

    Do you have any recommendations? 

    Thanks 

    Kevin

    I am using the example "Settlement of a circular footing on sand" and the code for load displacement curve as follows:

    # # change the colour of the Given material:
    # setMaterialColourRGB(soilmat, *RGB)


    g_i.LineLoad_1_1.qy_start[g_i.Phase_1]


    # creating the function that will retrieve
    # the values later in the script
    def getphasevalue(plxobject, phase):
    return plxobject[phase].value

    import math

    def create_phases_name_map(phases):
    result = {}
    for phase in phases[:]:
    result[phase.Name.value] = phase
    return result

    def get_table_qactive_vs_displacement(filename, phases_i):
    # initial data for eventual table columns
    col_step = ["Step"]
    col_sum_mstage = ["SumMStage"]
    col_phases = ["Phase"]
    col_utot = ["Utot"]
    col_qactive = ["qactive [kN/m2]"]
    col_load = ["Load [kN]"] # load for axisymmetric models
    radius = 1
    area = math.pi * radius ** 2

    phasesmap_o = create_phases_name_map(g_o.Phases)
    # look into all phases, all steps:
    loadfeature_i = g_i.LineLoad_1_1
    for phase_i in phases_i:
    qphase_end = getphasevalue(loadfeature_i.qy_start, phase_i)
    # check if previous phase has a Line Load
    # that is deactivated (then load=0)
    if loadfeature_i.Active[phase_i.PreviousPhase]:
    qphase_start = loadfeature_i.qy_start[phase_i.PreviousPhase]
    else:
    qphase_start = 0
    phase_o = phasesmap_o[phase_i.Name.value]
    for step in phase_o.Steps:
    sumMstage = step.Reached.SumMstage.value
    col_phases.append(phase_o.Name.value)
    col_step.append(int(step.Name.value.replace("Step_", "")))
    col_utot.append(g_o.getcurveresults(g_o.Nodes[0], step, g_o.ResultTypes.Soil.Utot))
    col_sum_mstage.append(sumMstage)
    col_qactive.append(-qphase_start + sumMstage * (-qphase_end + qphase_start))
    col_load.append(col_qactive[-1] * area)
    print(phase_i)

    if filename is not None:
    with open(filename,"w") as file:
    for results in zip(col_phases, col_step, col_utot, col_qactive, col_load):
    print('\t'.join(["{}".format(i) for i in results]), file=file)

    get_table_qactive_vs_displacement(filename = r'D:\dataload_displ_data.txt', phases_i = [ g_i.Phase_1 ] )
  • Hi Kevin,

    In the feedback/error you got from running the script, I read this near the end:

    File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\socket.py", line 727, in create_connection
    File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\socket.py", line 716, in create_connection
    ConnectionRefusedError: [WinError 10061]

    It seems that the connection is refused. Is PLAXIS launched with the correct remote scripting settings as was set in your script using the proper port and password?

    If you really get stuck in getting this to work, please submit a service request and upload the relevant file there: https://apps.bentley.com/srmanager/ProductSupport 

  • Hi Micha,

    Thank you for your comments. What I just found was I put a "g_i" to a "g_o" by mistake. The code now runs perfectly. 

    Best,

    Kevin

Reply Children
No Data