Is there native API to get step time in self define load plug-in ?

I have write a self define ACT plug and need to get the step time when write to solver file. I found a way, but it, but I am not sure is there any native API to get the step time ?
Here is the code:

  1. class InvokeUIThread():
  2. def __init__(self, ExtAPI, analysis):
  3. args = [None] * 7
  4. args[0] = analysis
  5. ExtAPI.Application.InvokeUIThread(self.internalGetAnalysisData, args)
  6. self.args = args[1:]
  7.  
  8. def internalGetAnalysisData(self,args):
  9. args[1] = args[0].Name
  10. args[2] = args[0].WorkingDir
  11. args[3] = args[0].GetResultsData()
  12. args[4] = args[0].GeoData
  13. args[5] = args[0].MeshData
  14. args[6] = args[0].StepsEndTime
  15.  
  16. @property
  17. def AnalysisName(self):
  18. return self.args[0]
  19.  
  20. @property
  21. def WorkingDir(self):
  22. return self.args[1]
  23.  
  24. @property
  25. def GetResultsData(self):
  26.  
  27. return self.args[2]
  28.  
  29. @property
  30. def GeoData(self):
  31. return self.args[3]
  32.  
  33. @property
  34. def MeshData(self):
  35.  
  36. return self.args[4]
  37.  
  38. @property
  39. def StepsEndTime(self):
  40.  
  41. return self.args[5]
  42.  
  43. def SolveCallBack(load, solverData, stream):
  44. CurrentStepNum = solverData.CurrentStep
  45. analysis = load.Analysis
  46. # times = analysis.StepsEndTime
  47. InvokeUIThread = InvokeUIThread(ExtAPI, analysis)
  48. times = InvokeUIThread.StepsEndTime
  49. CurrentStepTime = times[CurrentStepNum - 1]

Best Answer

  • Member, Employee Posts: 385
    25 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    Answer ✓

    I am not sure if this will help in what you are doing, but you can get step end times by step number by using the Analysis Settings object instead of the Analysis object itself.

Answers

  • Member Posts: 46
    10 Comments First Anniversary Name Dropper
    **

    @Mike.Thompson said:
    I am not sure if this will help in what you are doing, but you can get step end times by step number by using the Analysis Settings object instead of the Analysis object itself.

    I have create a self define load, and write some APDL command to solver ds.dat file when create this file. And I need get the step time when getcommands callback action. But solverData seems don't provide this API.

    1. stream.Write("LDREAD,TEMP,,,{0},,{1},rth".format(CurrentStepTime, rthFile.replace(".rth", "")))
  • Member Posts: 46
    10 Comments First Anniversary Name Dropper
    **

    @Mike.Thompson said:
    I am not sure if this will help in what you are doing, but you can get step end times by step number by using the Analysis Settings object instead of the Analysis object itself.

    Using Analysis Settings objec to get the time, the result seems is Quantity object.

    1. analysis.StepsEndTime
    2. [1, 2]
    3.  
    4. st=analysis.AnalysisSettings
    5.  
    6. st.TimeStep
    7. '1 [sec]'
    8.  
    9. st.StepEndTime
    10. '1 [sec]'
    11.  
    12.  
    13. st.GetStepEndTime(1)
    14. '1 [sec]'
    15.  
    16.  
    17. st.GetTimeStep(1)
    18. '1 [sec]'

Welcome!

It looks like you're new here. Sign in or register to get started.