Information about the calculation status of a step via python API

I am trying to get iformation on a individual step. For example I want to extract data from each step. What I did so far was to iterate through my steps, but apperently each Phase has more steps, from which not all of them are calculated. An error is raised  if you try to call the getResults function on a not calculated step. Is there a possible way to determine of a step was calculated?

This is my workaround so far, but I would like to have a more clean version for my study project than this try catch line...

def get_plx_data (step_object):
    materialID_list = g_o.getresults(step_object, g_o.ResultTypes.Soil.MaterialID, 'Stresspoint')
    MeanEffStress_values_o = g_o.getresults(step_object, g_o.ResultTypes.Soil.MeanEffStress, "Stresspoint")
    DeviatoricStress_values_o = g_o.getresults(step_object, g_o.ResultTypes.Soil.DeviatoricStress, "Stresspoint")
    return materialID_list, MeanEffStress_values_o, DeviatoricStress_values_o
    
for phaseIndex in range (1,numberOfPhases):
    i=1
    for step_object in g_o.Phases[-phaseIndex].Steps[:]:
        print(i,'/',numberOfSteps)
        i+=1
        try:
            materialID_list, MeanEffStress_values_o, DeviatoricStress_values_o = get_plx_data (step_object)
            #further code...
        except:
            pass

Thanks in advance.

Greetings

Lukas

Parents
  • So my new workaround is to check if the dumpstring of the step object has a certain length.

    Apperently if the Step is calculated, the information for inputsettings is stored in the dump string, which concludes in a longer string than in uncalculated steps, where it is not stored. So if one is iterating through the steps they can check:

    if len(step_object.dump())>4000: #the 4000 needs to be checked!

    (I think the dump string length also depends on the machine.)

    I used sth like this to figure out what the difference between the lengths is (with pandas):

    b= [len(steps.dump()) for steps in g_o.Steps[:]]
    df = pd.DataFrame({'dumpLen':b})

    from the dataframe you can then exclude rows with too short strings

    df = df.query('dumpLen > 2400')[:]
    print(df.head)

    and with the indices you can get yourself a list of calculated steps.

    Maybe I could help someone Slight smile

    Regards

  • Dear Lukas,

    You mention whether "a step was calculated" but obviously all steps are calculated otherwise they wouldn't be calculation steps. However, PLAXIS doesn't save all calculated steps to disc as that would take a lot of space. But if would want to check all calculation steps, just make sure that you set the numerical control parameter "MaxStepsStored" equal to the maximum number of calculation steps ("MaxSteps") so that all steps are stored, in which case you can iterate over all steps afterwards.

    With kind regards,

    Dennis Waterman

  • Thanks Dennis for you answer,

    I maybe can phrase my question now a bit clearer: Is there a way to output a list of steps, which have been calculated and saved to my disc?

    Thanks in advance.

    Kind Regards

    Lukas

Reply Children