How to add a reference load with a load factor to a load case using openSTAAD commands

Hi,

I have the below code which interfaces with a matrix i have created in excell/VBA. 

I want to create the loadcase, this code works, and then add the reference load say "R1" to the load case with a load factor as per the image below. The reference loads have already been created successfully. How can I achieve this?

'Define Load Cases

Dim RefLoadNo As Double
Dim RefLoadName As String
Dim RefLoadType As Long


Dim LoadCaseName As String
Dim LoadCaseType As Long
Dim LoadCaseNo As Double
Dim LoadFactor As Double

For j = 2 To UBound(Load_Matrix(), 2) 'i=2 at start as i=0 is the loacombination row and i=1 is loadcombination name row

LoadCaseName = Load_Matrix(1, j)
LoadCaseType = 22 ' Type "NONE"
LoadCaseNo = Load_Matrix(0, j)
ObjOPENSTAAD.Load.CreateNewPrimaryLoadEx2 LoadCaseName, LoadCaseType, LoadCaseNo ' in form LoadCaseName, LoadCaseType, LoadCaseNo

For i = 2 To UBound(Load_Matrix(), 1)
RefLoadNo = CDbl(RemoveFirstChars(CVar(Load_Matrix(i, 0)), 1))                   ' this results in a reference load case number of 1 rather than R1.
LoadFactor = Load_Matrix(i, j)
ObjOPENSTAAD.Load.AddLoadRefEx2 LoadCaseNo, RefLoadNo, LoadFactor ' in form LoadCase, Node, Factor
Next i

Next j

Best Regards, 

Tom

Parents Reply
  • Yes, you need to use AddReferenceLoad function.

    I would like to mention one thing here that the datatype of the Primary or Reference Load case number should be Long instead of Double

    Sample VBA Syntax is

    Set objOpenSTAAD = GetObject(, "StaadPro.OpenSTAAD")
    Dim LoadCaseNo As Long
    Dim RefLoadNo(2) As Long
    Dim LoadFactor(2) As Double

    LoadCaseNo = 1
    objOpenSTAAD.Load.SetLoadActive LoadCaseNo

    RefLoadNo(0) = 2
    RefLoadNo(1) = 4
    RefLoadNo(2) = 5

    LoadFactor(0) = 1.2
    LoadFactor(1) = 1
    LoadFactor(2) = 0.9

    objOpenSTAAD.Load.AddReferenceLoad RefLoadNo, LoadFactor

    Answer Verified By: Tom Pallister 

Children
No Data