Using ACT, how can I create a result for each time step and export result to a text file?

Options
Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 810
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
edited June 2023 in Structures

Using ACT, how can I create a result for each time step and export result to a text file?

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 810
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Answer ✓
    Options

    One can adapt the following code:

    • Store link to solution

        solu=ExtAPI.DataModel.Project.Model.Analyses[0].Solution
      
    • Obtain list of time sets

       ResData=ExtAPI.DataModel.Project.Model.Analyses[0].GetResultsData()
       DataSets=ResData.ListTimeFreq
      
    • Loop through data sets

       for DataSet in range(len(DataSets)):
      
    • Define display time

            DisplayTime=DataSets[DataSet]
            UnitTime='[sec]'
      
    • Insert result and evaluate

            result=solu.AddMaximumPrincipalStress()
            result.DisplayTime=Quantity(str(DisplayTime) + UnitTime)
            solu.EvaluateAllResults()
      
    • Export result to text file

           FilePath=r"D:\Test\Export"
           FileExtension=r".txt"   
           result.ExportToTextFile(True,FilePath+str(DisplayTime)+FileExtension)