OpenSTAADFundamentals_PracticeWorkbook3_Working with Excel.pdf

download OpenSTAADFundamentals_PracticeWorkbook3_Working with Excel.pdf

of 9

Transcript of OpenSTAADFundamentals_PracticeWorkbook3_Working with Excel.pdf

  • 7/25/2019 OpenSTAADFundamentals_PracticeWorkbook3_Working with Excel.pdf

    1/9

    Bentley Institute Training

    Practice Workbook

    This workbook is designed for use for Live instructor led training and for OnDemand training. The explanation,

    demonstration, and narrative content are provided by the instructor in the classroom and in the OnDemand

    eLearning version of this course available through Bentley LEARN (learn.bentley.com).

    This exercise workbook is formatted for onscreen viewing using a PDF reader.

    Using Macros in Excel

    OpenSTAAD Fundamentals - July 2012

    TRN020150-1/0001-PW03

  • 7/25/2019 OpenSTAADFundamentals_PracticeWorkbook3_Working with Excel.pdf

    2/9

    Copyright 2012 Bentley Systems, Incorporated 2

    Analyze the Model in STAAD.Pro

    Learn how to open the STAAD.Pro Model and perform an analysis.

    1. Open OpenSTAADDataset.stdin STAAD.Pro.

    Note: In this Practice Workbook, we will perform a concrete beam design in Microsoft Excel using the member properties and the

    maximum bending moments (about the local Z axis) for Beam #21 using the STAAD.Pro model and analysis.

    2. Click Analyze > Run Analysis... in the menu bar.

    3. Select the Go to Post Processing Moderadio button in the STAAD Analysis and Designdialog. Then, click on the Donebutton.

    4. Click on the Beamtab and then the Graphssub-tab in the Page Control Area.

    5. Use the Beams Cursor to select Beam #21 in the Main Window.

    6. Select each of the load combinations through the pull-down menu in the Viewtoolbar. Notice the MZ graph in the Data Area.

    Note: The goal of this Practice Workbook is to create a macro in Microsoft Excel to obtain the minimum and maximum moments for aparticular beam for each of the load combinations analyzed. The values of the maximum moment in the Excel file should match

    those indicated in the STAAD.Pro analysis results.

    7. Keep this model open for the next exercise.

    Beam #21

  • 7/25/2019 OpenSTAADFundamentals_PracticeWorkbook3_Working with Excel.pdf

    3/9

    Initiate OpenSTAAD in Excel

    Learn how to initiate OpenSTAAD in MicroSoft Excel and obtain the current STAAD.Pro model.

    1. Open Training_Rectangle Beam.xlsin MicroSoft Excel.

    2. Click on the Developertab in the Ribbon. Then, click on the Macrosicon.

    3. Highlight the RCBeamDesignmacro in the Macrodialog. Then, click on the Edit button.

    4. Notice that this macro has been called RCBeamDesign using the following code:

    SubRCBeamDesign()

    Note: Double click on the Sheet2 (STAAD.Pro Output)item in the VBAProject. Notice that the code to execute the RCBeamDesign macro whenthe Get Resultsbutton is clicked has already been created. Double click on th Module 1item in the VBAProject to return to theRCBeamDesign macro.

    5. Enter the following functions in the Macro Design Window to initial the OpenSTAAD object:

    DimobjSTAADGUIAs Object

    Set objSTAADGUI = GetObject (,STAADPro.OpenSTAAD)

    6. Enter the following functions to obtain link to the current STAAD.Pro model:

    DimstdFileAs String

    objSTAADGUI.GetSTAADFile stdFile, True

    If stdFile = Then

    MsgBox This macro can only be run with a valid STAADfile loaded.,

    vbOKOnlySet objSTAADGUI = Nothing

    Exit Sub

    End If

    Cells(2,2).Value = stdFile

    7. Keep this model open for the next exercise.

  • 7/25/2019 OpenSTAADFundamentals_PracticeWorkbook3_Working with Excel.pdf

    4/9

    Copyright 2012 Bentley Systems, Incorporated 4

    View the OpenSTAAD Functions

    Learn to add the OpenSTAAD Functions to the Object Browser within the Microsoft Excel macro.

    1. Continue with the model from the previous exercise.

    2. Click on Tools > Referencesin the main menu.

    3. Check the STAADLibBentleyoption in the References - VBAProjectdialog. Then, click OK.

    4. Click on the Object Browsericon in the Standardtoolbar.

    5. Select STAADLibBentleyin the pull down menu. Notice that details of each of the OpenSTAAD functions is available now through theObject Browser in Excel.

    6. Close the Object Browser.

    7. Keep this model open for the next exercise.

  • 7/25/2019 OpenSTAADFundamentals_PracticeWorkbook3_Working with Excel.pdf

    5/9Copyright 2012 Bentley Systems, Incorporated 5

    Establish the Base Units System

    Obtain the base unit system from the current STAAD.Pro model.

    1. Continue with the model from the previous exercise.

    2. Enter the following functions to establish the Base Units system:

    DimBaseUnitAs Integer

    DimBaseLengthUnitAs String

    Dim BaseForceUnitAs String

    BaseUnit = objSTAADGUI.GetBaseUnit

    IfBaseUnit = 1 Then

    BaseLengthUnit = in

    BaseForceUnit = kips

    Else

    BaseLengthUnit = m

    BaseForceUnit = kN

    MsgBox (This macro is designed for English units only. Change the STAAD.Pro > Configuration > Base Unit appropriately.)

    SetobjSTAADGUI = Nothing

    Exit Sub

    End If

    Cells(4, 6) = BaseLengthUnit

    Cells(5, 6) = BaseForceUnit

    3. Keep this model open for the next exercise.

  • 7/25/2019 OpenSTAADFundamentals_PracticeWorkbook3_Working with Excel.pdf

    6/9Copyright 2012 Bentley Systems, Incorporated 6

    Retrieve the Member Information

    Learn to retrieve member information using a member number entered into the Excel spreadsheet.

    1. Continue with the model from the previous exercise.

    2. Enter the following functions to obtain the member number entered into the Excel worksheet:

    DimMemberNoAs Long

    MemberNo = Cells(7,2).value

    3. Enter the following functions to verify if the member exists in the STAAD.Pro model:

    Dim LengthAs Double

    Length = objSTAADGUI.Geometry.GetBeamLength (MemberNo)

    If Length = 0 Then

    MsgBox Please check the member number is valid., vbOKOnly

    SetobjSTAADGUI = Nothing

    Exit SubEnd If

    4. Enter the following functions to retrieve the member properties from the STAAD.Pro model:

    DimYDAs Double

    DimZDAs Double

    objSTAADGUI.Property.GetBeamProperty MemberNo, ZD, YD

    Cells(7, 7).Value = YD

    Cells(8, 7).Value = ZD

    5. Keep this model open for the next exercise.

  • 7/25/2019 OpenSTAADFundamentals_PracticeWorkbook3_Working with Excel.pdf

    7/9Copyright 2012 Bentley Systems, Incorporated 7

    Retrieve the Loading Information and the Member Forces

    Learn to retrieve the loading information and the member force information from the STAAD.Pro model.

    1. Continue with the model from the previous exercise.

    2. Enter the following functions to retrieve the number of load combinations defined in the STAAD.Pro model:

    DimLCaseCountAs Integer

    LCaseCount = objSTAADGUI.Load.GetPrimaryLoadCaseCount

    Cells(4, 2).Value = LCaseCount

    DimLComboCountAs Integer

    LComboCount = objSTAADGUI.Load.GetLoadCombinationCaseCount

    Cells(5, 2).Value = LComboCount

    3. Enter the following functions to limit the number of load combinations to 10:

    If LComboCount > 10 Then

    MsgBox (This macro is designed for up to 10 load combinations only.)SetobjSTAADGUI = Nothing

    Exit Sub

    End If

    Note: The Excel spreadsheet was created to consider a maximum of 10 load combinations.

    4. Enter the following functions to obtain the load combination titles from the STAAD.Pro model:

    DimLComboNum()As Long

    ReDimLComboNum(LComboCount)

    DimLComboTitle() As String

    ReDim LComboTitle(LComboCount)

    DimiAs Integer

    Fori = 1 ToLComboCount

    LComboNum(i) = i + LCaseCount

    LComboTitle(i) = objSTAADGUI.Load.GetLoadCaseTitle(i + LCaseCount)

    Cells(10, i + 1).Value = LComboNum(i)

    Cells(11, i + 1).Value = LComboTitle(i)

  • 7/25/2019 OpenSTAADFundamentals_PracticeWorkbook3_Working with Excel.pdf

    8/9Copyright 2012 Bentley Systems, Incorporated 8

    5. Enter the following functions to retrieve the maximum member moment results:

    DimDMaxAs Double

    DimdMaxPosAs Double

    DimDMinAs Double

    DimdMinPosAs Double

    objSTAADGUI.Output.GetMinMaxBendingMoment MemberNo, MZ, LComboNum(i), DMax, dMaxPos, DMin, dMinPos

    Nexti

    6. Enter the following functions to terminate the macro:

    Sheets(Concrete).Select

    Set objSTAADGUI = Nothing

    End Sub

    7. Save and close the Macro Design Window for the next exercise.

  • 7/25/2019 OpenSTAADFundamentals_PracticeWorkbook3_Working with Excel.pdf

    9/9

    Copyright 2012 Bentley Systems, Incorporated 9

    Run the Macro

    Learn to run the macro in Microsoft Excel.

    1. Continue with the Microsoft Excel worksheet from the previous exercise.

    2. Select the STAAD.Pro Outputworksheet.

    3. Enter 21into field B-7 to instruct the macro to obtain the results to beam #21 in the STAAD.Pro model.

    4. Click on the Clear Resultsbutton to ensure we start with an empty spreadsheet.

    5. Click on the Get Resultsbutton to run the macro and obtain the results from the STAAD.Pro model.

    6. Enter the appropriate parameters for this beam (indicated in the Yellow Fields) to define the following:

    Reinforcement Data

    Material Data

    Strength Reduction Factor

    Note: The calculations in the Concreteworksheet have already been defined using the parameters entered for the beam.