Open STAAD Command GetRepeatLoadCount not working

I am struggling with this Openstaad command GetRepeatLoadCount. For some reason, it is not working for me. It returns value 1 instead of the actual count. 

Parents
  • GetRepeatLoadCount functtion actually returns the number of repeat load present in a load case.

    Example: Load case 2 has 3 Repeat Load cases. So if GetRepeatLoadCount function is used for load case 2, the return value of GetRepeatLoadCount will be 3.

    VBA code:

    Set objOpenStaad = GetObject(, "StaadPro.OpenSTAAD")
    Dim RepeatLoadcount As Long
    Dim LoadNo As Long

    LoadNo = 2
    objOpenStaad.Load.SetLoadActive LoadNo
    RepeatLoadcount = objOpenStaad.Load.GetRepeatLoadCount

    Output:

    Answer Verified By: Desh Raj Singh 

Reply
  • GetRepeatLoadCount functtion actually returns the number of repeat load present in a load case.

    Example: Load case 2 has 3 Repeat Load cases. So if GetRepeatLoadCount function is used for load case 2, the return value of GetRepeatLoadCount will be 3.

    VBA code:

    Set objOpenStaad = GetObject(, "StaadPro.OpenSTAAD")
    Dim RepeatLoadcount As Long
    Dim LoadNo As Long

    LoadNo = 2
    objOpenStaad.Load.SetLoadActive LoadNo
    RepeatLoadcount = objOpenStaad.Load.GetRepeatLoadCount

    Output:

    Answer Verified By: Desh Raj Singh 

Children
  • That explains. So there is no OpenSTAAD function to get the Repeat load count in a model, right?

  • There is no direct OpenSTAAD function to get the Total repeat Load count in a model as the Repeat Load is treated as Load item like any other load items(Nodal load, member load) defined under a primary load case. But you can use combination of OpenSTAAD functions to get the count.

    Sample VBA code:

    Set objOpenStaad = GetObject(, "StaadPro.OpenSTAAD")
    Dim nPrimaryLoadCase As Long
    Dim LC() As Long
    Dim LoadType As Long
    Dim nLoadSize As Long
    nLoadSize = 0
    LoadType = 4201 ''Repeat load data
    Dim RepeatLoadCount As Long
    RepeatLoadCount = 0
    Dim RepeatLCNo As Long

    nPrimaryLoadCase = objOpenStaad.Load.GetPrimaryLoadCaseCount
    ReDim LC(nPrimaryLoadCase - 1)
    objOpenStaad.Load.GetPrimaryLoadCaseNumbers LC

    For i = 0 To nPrimaryLoadCase - 1
    objOpenStaad.Load.SetLoadActive LC(i)

    nLoadSize = objOpenStaad.Load.GetLoadTypeCount(LoadType)
    If nLoadSize > 0 Then
    RepeatLoadCount = RepeatLoadCount + 1
    RepeatLCNo = LC(i)
    End If
    Next i
    MsgBox "Repeat Load count is: " & RepeatLoadCount

    Answer Verified By: Desh Raj Singh