OPEN STAAD - Results Function not working

Dear sir,

I am trying to develop a VBA macro in Excel in order to retrieve supports reactions from Staad Pro (v20.07.11.82).

The following code is used, with OpenSTAAD functions in bold:

 

'Staad Object and Results opening

'=================================

'Get the application object

Set objOpenSTAAD = GetObject(, "StaadPro.OpenSTAAD")

'

'Counting support nodes

'======================

iSupportCount = objOpenSTAAD.Support.GetSupportCount

ReDim lSupportNodesArray(0 To (iSupportCount - 1)) As Long

objOpenSTAAD.Support.GetSupportNodes lSupportNodesArray

'

'Filling Foundation loads table

'==============================

For i = 0 To UBound(lSupportNodesArray)

    Cells(Ligne1 + i * 3, Colonne1).Value = lSupportNodesArray(i)

    For j = 3 To 3 + lPrimaryLoadCaseCount - 1

            objOpenSTAAD.Output.GetSupportReactions lSupportNodesArray(i), Cells(4, j).Value, dReactionArray

            Cells(3 * i + 5, j).Value = dReactionArray(1) * 4.4482216

            Cells(3 * i + 6, j).Value = -dReactionArray(0) * 4.4482216

            Cells(3 * i + 7, j).Value = -dReactionArray(2) * 4.4482216

    Next

Next

The Supports Applications functions GetSupportCount and GetSupportNodes are working properly: I am retrieving correctly the nodes numbers, so Excel is properly communicating with Staad. But the result function GetSupportReactions does not work: the array created is filled with zero values, while results are available. Is there a mistake in the code?

Thanks in advance for your help.

Pascal OGIER

Parents
  • The support reaction is extracted as 0 due to the following reasons—

    1. The variable type for dReactionArray should be specified as Double.
    2. The support node number and load case number cannot be specified directly as the function input. You need to create two separate variable with variable type Long and specify those variables in the function.

     

    Modify this line –

    objOpenSTAAD.Output.GetSupportReactions 1, 1, dReactionArray

    replace with –

    dim sp_nd, lc as Long

    sp_nd=1

    lc=1

    objOpenSTAAD.Output.GetSupportReactions sp_nd, lc, dReactionArray



Reply
  • The support reaction is extracted as 0 due to the following reasons—

    1. The variable type for dReactionArray should be specified as Double.
    2. The support node number and load case number cannot be specified directly as the function input. You need to create two separate variable with variable type Long and specify those variables in the function.

     

    Modify this line –

    objOpenSTAAD.Output.GetSupportReactions 1, 1, dReactionArray

    replace with –

    dim sp_nd, lc as Long

    sp_nd=1

    lc=1

    objOpenSTAAD.Output.GetSupportReactions sp_nd, lc, dReactionArray



Children
No Data