[Robot API] ResultQuery documentation

[Robot API] ResultQuery documentation

mmaso64U7Y
Enthusiast Enthusiast
257 Views
0 Replies
Message 1 of 1

[Robot API] ResultQuery documentation

mmaso64U7Y
Enthusiast
Enthusiast

Hi, I'm trying to extract values using the ResultQuery mechanism, but I found very little documentation. See attached this snippet of code as an example:

 

 

 

    Dim node_sel As IRobotSelection
    Set node_sel = RobApp.Project.Structure.Selections.CreatePredefined(I_PS_NODE_SUPPORTED)

    Dim case_sel As IRobotSelection
    Set case_sel = RobApp.Project.Structure.Selections.CreatePredefined(I_PS_CASE_SIMPLE_CASES)

    Dim QP As IRobotResultQueryParams
    Set QP = New RobotResultQueryParams

    ' Set the result ids to get
    QP.ResultIds.SetSize 6
    QP.ResultIds.Set 1, I_EVT_REACTION_FX
    QP.ResultIds.Set 2, I_EVT_REACTION_FY
    QP.ResultIds.Set 3, I_EVT_REACTION_FZ
    QP.ResultIds.Set 4, I_EVT_REACTION_MX
    QP.ResultIds.Set 5, I_EVT_REACTION_MY
    QP.ResultIds.Set 6, I_EVT_REACTION_MZ
    QP.Selection.Set I_OT_NODE, node_sel
    QP.Selection.Set I_OT_CASE, case_sel
    QP.SetParam I_RPT_RESULT_POINT_COORDINATES, 31  '--> What is the meaning of parameter value?

    Dim RS As IRobotResultRowSet
    Set RS = New RobotResultRowSet

    Dim RT As IRobotResultQueryReturnType
    RT = I_RQRT_MORE_AVAILABLE

    ' Initialize the counters
    i = StartRow
    Dim n_results As Long
    n_results = node_sel.Count * case_sel.Count - i
    frmProgress.Initialize "Importing Robot reactions"

    ' Get the results
    Dim ok As Boolean
    While RT <> I_RQRT_DONE
        RT = RobApp.Project.Structure.Results.Query(QP, RS)
        Dim RR As IRobotResultRow
        ok = RS.MoveFirst()
        While ok
            Set RR = RS.CurrentRow
            Cells(i, NodeCol).value = RR.GetParam(I_RPT_NODE)
            Cells(i, CaseCol).value = RR.GetParam(I_RPT_LOAD_CASE)
            Cells(i, CasNCol).value = CaseNames(Cells(i, CaseCol).Text) '--> CaseNames is a dictionary previously defined
            If RR.IsAvailable(I_EVT_REACTION_FX) Then Cells(i, FXCol).value = RR.GetValue(I_EVT_REACTION_FX)
            If RR.IsAvailable(I_EVT_REACTION_FY) Then Cells(i, FYCol).value = RR.GetValue(I_EVT_REACTION_FY)
            If RR.IsAvailable(I_EVT_REACTION_FZ) Then Cells(i, FZCol).value = RR.GetValue(I_EVT_REACTION_FZ)
            If RR.IsAvailable(I_EVT_REACTION_MX) Then Cells(i, MXCol).value = RR.GetValue(I_EVT_REACTION_MX)
            If RR.IsAvailable(I_EVT_REACTION_MY) Then Cells(i, MYCol).value = RR.GetValue(I_EVT_REACTION_MY)
            If RR.IsAvailable(I_EVT_REACTION_MZ) Then Cells(i, MZCol).value = RR.GetValue(I_EVT_REACTION_MZ)
            Cells(i, XCol).value = RR.GetParam(I_RPT_RESULT_POINT_COORDINATES)  '--> This raises an error. BTW, which is the return type?
            ok = RS.MoveNext()
            frmProgress.Update i, n_results
            i = i + 1
        Wend
    Wend

 

 

 

I have some questions that I didn't solve after carefully reading the documentation:

  • What is the meaning of the arguments of IRobotResultQueryParams.SetParam?
  • IRobotResultRow.GetParam is throwing an error at line 51. Where can I find an explanation and causes of the error?

Thanks in advance

0 Likes
258 Views
0 Replies
Replies (0)