19.15.5.4. Retrieving Total Deformation from Table/Chart for Time Point

This workflow is an example of retrieving results at a desired time point from the table/chart to review results in the Geometry window. The full script (not just Part 3) is shown below for a better view.

def post_started(sender, analysis):# Do not edit this line
    define_dpf_workflow(analysis)

# Uncomment this function to enable retrieving results from the table/chart
def table_retrieve_result(value):# Do not edit this line
    import mech_dpf
    import Ans.DataProcessing as dpf
    wf = dpf.Workflow(this.WorkflowId)
    wf.Connect('contour_selector', value)
    this.Evaluate()

def define_dpf_workflow(analysis):
    import mech_dpf
    import Ans.DataProcessing as dpf
    dataSource = dpf.DataSources(analysis.ResultFileName)
    u = dpf.operators.result.displacement()
    nrm = dpf.operators.math.norm_fc()
    timeScop = dpf.Scoping()
    timeScop.Ids = [1, 3, 4, 5, 6, 7, 9] 
    u.inputs.time_scoping.Connect(timeScop)
    u.inputs.data_sources.Connect(dataSource)
    nrm.Connect(u)
    dpf_workflow = dpf.Workflow()
    dpf_workflow.Add(u)
    dpf_workflow.Add(nrm)
    # dpf_workflow.SetInputName(u, 0, 'time')
    # dpf_workflow.Connect('time', timeScop)
    dpf_workflow.SetOutputContour(nrm)
    dpf_workflow.Record('wf_id', False)
    this.WorkflowId = dpf_workflow.GetRecordedId()

First, uncomment the callback function table_retrieve_result (value) in Part 2 from the default script.

Moreover, multiple time points scoping is suggested to attach to the workflow. Evaluate the python result. The tabular data and chart will reflect the time points chosen in the script. Select the time point in the Tabular Data window, then click the right mouse button and select Retrieve This Result.