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.
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 LongDim LC() As LongDim LoadType As LongDim nLoadSize As LongnLoadSize = 0LoadType = 4201 ''Repeat load dataDim RepeatLoadCount As LongRepeatLoadCount = 0Dim RepeatLCNo As Long
nPrimaryLoadCase = objOpenStaad.Load.GetPrimaryLoadCaseCountReDim 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 IfNext iMsgBox "Repeat Load count is: " & RepeatLoadCount
Answer Verified By: Desh Raj Singh
That explains. So there is no OpenSTAAD function to get the Repeat load count in a model, right?
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 LongDim LoadNo As Long
LoadNo = 2objOpenStaad.Load.SetLoadActive LoadNoRepeatLoadcount = objOpenStaad.Load.GetRepeatLoadCount
Output: