How to print time, load step and substep information in Mechanical via DPF?

Rohith Patchigolla
Rohith Patchigolla Member, Moderator, Employee Posts: 212
100 Comments 25 Answers Second Anniversary 25 Likes
✭✭✭✭

I want to extract time, load step and substep information in Mechanical via DPF, so that I can connect load step and substep number to Time value in DPF.

Tagged:

Answers

  • Rohith Patchigolla
    Rohith Patchigolla Member, Moderator, Employee Posts: 212
    100 Comments 25 Answers Second Anniversary 25 Likes
    ✭✭✭✭

    The below code should print Result Set Num, Time Value, Load Step, Substep corresponding to result file of a selected Analysis in Mechanical.

    import mech_dpf
    import Ans.DataProcessing as dpf
    baseAnalysis = DataModel.AnalysisList[0]
    baseDataSource = dpf.DataSources(baseAnalysis.Solution.ResultFilePath)
    timeFreqDataTemp = dpf.operators.metadata.time_freq_provider(data_sources=baseDataSource).outputs.time_freq_support.GetData()
    timeFreqDataLines = str(timeFreqDataTemp).split('\n')
    timeFreqDataLines = [line.strip() for line in timeFreqDataLines if line.strip()][3:]
    timeFreqDataFloat = [list(map(float, line.split())) for line in timeFreqDataLines]