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

1990chs
1990chs Member Posts: 44
10 Comments Name Dropper
**

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:

class InvokeUIThread():
    def __init__(self, ExtAPI, analysis):
        args = [None] * 7
        args[0] = analysis
        ExtAPI.Application.InvokeUIThread(self.internalGetAnalysisData, args)
        self.args = args[1:]

    def internalGetAnalysisData(self,args):
        args[1] = args[0].Name
        args[2] = args[0].WorkingDir
        args[3] = args[0].GetResultsData()
        args[4] = args[0].GeoData
        args[5] = args[0].MeshData
        args[6] = args[0].StepsEndTime

    @property
    def AnalysisName(self):
        return self.args[0]

    @property
    def WorkingDir(self):
        return self.args[1]

    @property
    def GetResultsData(self):

        return self.args[2]

    @property
    def GeoData(self):
        return self.args[3]

    @property
    def MeshData(self):

        return self.args[4]

    @property
    def StepsEndTime(self):

        return self.args[5]

def SolveCallBack(load, solverData, stream):
    CurrentStepNum = solverData.CurrentStep
    analysis = load.Analysis
    # times = analysis.StepsEndTime
    InvokeUIThread = InvokeUIThread(ExtAPI, analysis)
    times = InvokeUIThread.StepsEndTime
    CurrentStepTime = times[CurrentStepNum - 1]

Best Answer

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 327
    25 Answers First Anniversary 100 Comments 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

  • 1990chs
    1990chs Member Posts: 44
    10 Comments 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.

    stream.Write("LDREAD,TEMP,,,{0},,{1},rth".format(CurrentStepTime, rthFile.replace(".rth", "")))
    
  • 1990chs
    1990chs Member Posts: 44
    10 Comments 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.

    analysis.StepsEndTime
    [1, 2]
    
    st=analysis.AnalysisSettings
    
    st.TimeStep
    '1 [sec]'
    
    st.StepEndTime
    '1 [sec]'
    
    
    st.GetStepEndTime(1)
    '1 [sec]'
    
    
    st.GetTimeStep(1)
    '1 [sec]'