How to get list of time, load step and substep information from a solved analysis in Mechanical?

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

How to get list of time, load step and substep information from a solved analysis in Mechanical?

Answers

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

    Using the below script, one can get the needed information and collect them into a list, which will have the below info at each result set (result set num, time, load step num, substep num)

    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()
    # Split the string into lines
    timeFreqDataLines = str(timeFreqDataTemp).split('\n')
    timeFreqDataLines = [line.strip() for line in timeFreqDataLines if line.strip()][3:]
    # Extract rows and columns
    allData = [list(map(float, line.split())) for line in timeFreqDataLines]