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

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

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: 206
    100 Comments 25 Answers Second Anniversary 25 Likes
    ✭✭✭✭

    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]