OpenSTAAD | OSLoadUI::CreateLoadEnvelop is not working properly

I'm using STAAD.Pro Script Editor and OpenSTAAD library to generate a structural model. 

Unfortunately,the OpenSTAAD function (OSLoadUI::CreateLoadEnvelop) that should allow creating load envelopes is not working properly.

Question: Is Bentley Software / Technical Group is aware or been notified about this bug / error? Any help will be much appreciated.

This is the information provided by the OpenSTAAD Library. Also note that by browsing the object library the OpenSTAAD command is written as "CraeteLoadEnvelop", not "CreateLoadEnvelop". There is a typo as well.

VARIANT OSLoadUI::CreateLoadEnvelop ( const VARIANT FAR &  varEnvNo,
const VARIANT FAR &  varEnvType,
const VARIANT FAR &  varLoadCaseList 
)

Creates a Load Envelop with specified primary load case(s) and envelop type.

Parameters
[in] varEnvNo Load Envelop reference ID.
[in] varEnvType Type of the load envelop:
Value Load Envelop Type
0 NONE
1 STRESS
2 SERVICEABILITY
3 COLUMN
4 CONNECTION
[in] varLoadCaseList (Primary) load case(s) reference ID(s) VARIANT array. For additional information, please refer to Section 5.40 of the Technical Reference manual.
Return values
0 OK.
-1 General error.
C++ Syntax
// Add a list of primary load case(s) into #2 load envelop (type of STRESS).
VARIANT RetVal = OSLoadUI::CreateLoadEnvelop(2, 1, varLoadCaseList);
VBA Syntax
1 ' Add a list of primary load case(s) into #2 load envelop (type of STRESS).
2 Dim RetVal As VARIANT = OSLoadUI.CreateLoadEnvelop(2, 1, varLoadCaseList)

        'WinWrap language (VBA)

        Dim objSTAADGUI As Object

        'Launch OpenSTAAD GUI Object
        Set objSTAADGUI = GetObject(,"StaadPro.OpenSTAAD")

        'Array for Load Cases
        Dim varLoadCaseList1(5) As Variant

        varLoadCaseList1(0) = 25
        varLoadCaseList1(1) = 26
        varLoadCaseList1(2) = 27
        varLoadCaseList1(3) = 28
        varLoadCaseList1(4) = 29
        varLoadCaseList1(5) = 30

        'Add a list of primary load case(s) into #1 load envelop (type of STRESS).
        objSTAADGUI.CraeteLoadEnvelop(1, 1, varLoadCaseList1())

  • Did you try to define Openstaad function in the first line and use the same parameter to be the operation, for example

    Dim objOpenSTAAD As Object
    'Get the application object
    Set objOpenSTAAD = GetObject( , "StaadPro.OpenSTAAD")

    'WinWrap language (VBA)

    'Array for Load Cases
    Dim varLoadCaseList1(5) As Variant

    varLoadCaseList1(0) = 25
    varLoadCaseList1(1) = 26
    varLoadCaseList1(2) = 27
    varLoadCaseList1(3) = 28
    varLoadCaseList1(4) = 29
    varLoadCaseList1(5) = 30

    'Add a list of primary load case(s) into #1 load envelop (type of STRESS).
    objOpenSTAAD.Load.CraeteLoadEnvelop(1, 1, varLoadCaseList1())

  • Thank you for your reply.

    Yes, the algorithm has the first line (i.e. Set objOpenSTAAD = GetObject( , "StaadPro.OpenSTAAD")). I am only showing a portion of the code. 

  • After testing the code, OpenSTAAD function only creates the envelopes by typing the function as objOpenSTAAD.Load.CreateLoadEnvelop(varEnvNo, varEnvType, varLoadCaseList).

    However, OpenSTAAD.Load.CreateLoadEnvelop is not assigning properly varLoadCaseList parameter. The only solution for this to work is by using the OpenSTAAD funtion Load.AddLoadCasesToEnvelop. See code solution below.

    Dim objOpenSTAAD As Object
    'Get the application object
    Set objOpenSTAAD = GetObject( , "StaadPro.OpenSTAAD")

    'WinWrap language (VBA)

    'Array for Load Cases
    Dim varLoadCaseList1(5) As Variant

    varLoadCaseList1(0) = 25
    varLoadCaseList1(1) = 26
    varLoadCaseList1(2) = 27
    varLoadCaseList1(3) = 28
    varLoadCaseList1(4) = 29
    varLoadCaseList1(5) = 30

    'Add a list of primary load case(s) into #1 load envelop (type of STRESS).
    objOpenSTAAD.Load.CreateLoadEnvelop(1, 1, varLoadCaseList1(0))

            For i = 0 To 5
                objSTAADGUI.Load.AddLoadCasesToEnvelop(1, varLoadCaseList1(i))
            Next

    Answer Verified By: Denisson Cruz