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

Options
Rohith Patchigolla
Rohith Patchigolla Member, Moderator, Employee Posts: 115
First Answer First Anniversary Name Dropper Solution Developer Community of Practice Member

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: 115
    First Answer First Anniversary Name Dropper Solution Developer Community of Practice Member
    Options

    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]