Anda di halaman 1dari 21

Bentley Institute Training

DO NOT DISTRIBUTE - Printing for Student use is Permitted

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 STAAD.Pro Case 1: Generating Geometry

OpenSTAAD Fundamentals - July 2012

TRN020150-1/0001-PW01

Create a New STAAD.Pro Model


Learn to create a new STAAD.Pro model and specify the units configuration and the current input units.

1. Launch STAAD.Pro. The Start Page will be displayed by default.


2. Click on the Configuration... link in the Project Tasks Area.

DO NOT DISTRIBUTE - Printing for Student use is Permitted

3. Select the Base Unit tab in the Configure Program dialog. Then enter the following parameter:

Select Base Unit: English

Click the Accept button.

4. Click on the New Project... link in the Project Tasks Area.


5. Enter the following information in the New dialog:

Structure Type: Space

File Name: Box Girder Structure

Length Units: Foot

Force Unit: KiloPound

6. Click on the (...) button and navigate to the location of the dataset. Then, click OK.
7. Click on the Next > button in the New dialog.
8. Click on the Finish button in the Where do you want to go? dialog.
9. Click on the Input Units icon tn the Structure toolbar.
10. Enter the following parameters in the Set Current Input Units dialog:

Length Units: Foot

Force Units: KiloPound

Click the OK button.

11. Keep this model open for the next exercise.


Copyright 2012 Bentley Systems, Incorporated

Initiate OpenSTAAD
Learn to create a new macro, initiate OpenSTAAD, and display the OpenSTAAD function in the Object Browser.

1. Continue with the model from the previous exercise.


2. Click on the Run VB Macro icon in the File toolbar.

DO NOT DISTRIBUTE - Printing for Student use is Permitted

3. Click on the Create New button in the Macro dialog.


4. Navigate to the dataset that was supplied with this training and then enter the following parameters in the Select New Macro File Name
dialog:

File Name: Training_Box Girder

Save as Type: Macro Files (*.vbs)

Description of the Macro: Generate a Parabolic Box Structure

Click on the New button.

5. Enter the following function to initiate OpenSTAAD:


Sub Main()
DESCRIPTION:Generate a Parabolic Box Girder Structure
Set objSTAADGUI = GetObject (,STAADPro.OpenSTAAD)
End Sub

6. Right-click in the Macro Design Window and select Edit > References from the pop-up menu.
7. Check the STAADLibBentley (1.0) reference in the References dialog. Then, click OK.
8. Keep this model open for the next exercise.

Retrieve the Base Units Configuration and the Input Units


Learn to retrieve the base units configuration and the input units from the current STAAD.Pro model.

1. Continue with the model from the previous exercise.

DO NOT DISTRIBUTE - Printing for Student use is Permitted

2. Enter the following functions to determine the base units configuration that were specified in the STAAD.Pro Start Page.
Dim BaseUnit As Integer
BaseUnit = objSTAADGUI.GetBaseUnit
If BaseUnit = 1 Then
BaseLengthUnit = in
Else
BaseLengthUnit = m
End If

Note: If this function returns a value of 1, the units configuration in the main application is currently set to English, which would
correspond to inches and kilopounds. If this function returns a value of 2, the units configuration is currently set to Metric, which
would correspond to meters and kilonewtons.

Copyright 2012 Bentley Systems, Incorporated

DO NOT DISTRIBUTE - Printing for Student use is Permitted

3. Enter the following functions to determine the input length units that were specified in the STAAD.Pro main application:
Dim LengthUnit As Integer
LengthUnit = objSTAADGUI.GetInputUnitForLength
If LengthUnit = 0 Then
InputLengthUnit = "in"
ElseIf LengthUnit = 1 Then
InputLengthUnit = "ft"
ElseIf LengthUnit = 2 Then
InputLengthUnit = "ft"
ElseIf LengthUnit = 3 Then
InputLengthUnit = "cm"
ElseIf LengthUnit = 4 Then
InputLengthUnit = "m"
ElseIf LengthUnit = 5 Then
InputLengthUnit = "mm"
ElseIf LengthUnit = 6 Then
InputLengthUnit = "dm"
ElseIf LengthUnit = 7 Then
InputLengthUnit = "km"
End If

4. Keep this model open for the next exercise.

Copyright 2012 Bentley Systems, Incorporated

Create the Geometry Input Dialog


Learn to create a dialog to be used in the STAAD.Pro main application to enter the geometric parameters.

1. Continue with the model from the previous exercise.


2. Click on the Edit User Dialog icon.

DO NOT DISTRIBUTE - Printing for Student use is Permitted

3. Double-click anywhere within the new dialog in the UserDialog Editor.


4. Enter the following information into the Edit UserDialog Properties dialog:

Caption: Box Girder Variables

Then, click on the double right arrow button to enter the name of the dialog box.

5. Click on the Add Text icon in the UserDialog Editor. Click within the new dialog to define the text box location and then double-click within
the new text box.

6. Enter the following information into the Edit Text Properties dialog:

Caption: Number of Divisions:

Quoted: (checked)

Click on the double right arrow button to enter the name of the field. Then, click Cancel.

Copyright 2012 Bentley Systems, Incorporated

DO NOT DISTRIBUTE - Printing for Student use is Permitted

7. Repeat this process to add the following fields to the dialog:

Maximum Pier Height:

Minimum Pier Height:

Span Length:

Span Width:

Plate Thickness:

8. Click on the Add Text icon in the UserDialog Editor. Click within the new dialog to define the text location and then double-click within the
new text field.

9. Enter the following information into the Edit Text Properties dialog:

Caption: BaseLengthUnit

Quoted: (unchecked)

Field: (leave blank)

Click on the double right arrow button to enter the name of the field. Then, click Cancel.

Copyright 2012 Bentley Systems, Incorporated

DO NOT DISTRIBUTE - Printing for Student use is Permitted

10. Repeat this process to add the BaseLengthUnit and the InputLengthUnit variables adjacent to the appropriate fields:

11. Click on the Add TextBox icon in the UserDialog Editor. Click within the new dialog to define the text box location and then double-click
within the new text box.

12. Enter the following information into the Edit TextBox Properties dialog:

Field: nDivisions

Click on the double right arrow button to enter the name of the text box. Then, click Cancel.

13. Repeat this process to add the following text boxes to the dialog:

MaxHeight

MinHeight

SpanLength

SpanWidth

PlateThick

Copyright 2012 Bentley Systems, Incorporated

DO NOT DISTRIBUTE - Printing for Student use is Permitted

Note: The input variables in the Box Girder Variables dialog will be used to define the geometry of the parabolic box structure:
SpanWidth

engt

L
Span

MinHeight
MaxHeight
nDivisions = number of plates to be generated along each
side of the structure over the span length

Note: All of the variables used in this dialog, with the exception of the Plate Thickness, are interpreted by OpenSTAAD using the base
units configuration. The Plate Thickness, however, is interpreted using the current input unit for length.

Copyright 2012 Bentley Systems, Incorporated

14. Click on the Add OK Button icon in the New UserDialog Editor. Then, click within the new dialog to define the OK button.

DO NOT DISTRIBUTE - Printing for Student use is Permitted

15. Click on the Add Cancel Button icon in the New UserDialog Editor. Then, click within the new dialog to define the Cancel button.

16. Click on the Save and Edit icon in the New UserDialog Editor.
17. Delete the last line of this code (Dialog dlg).
18. Keep this model open for the next exercise.

Copyright 2012 Bentley Systems, Incorporated

10

Define the Input Variables


Learn to define the input variables that were used in the Box Girder Variables dialog.

1. Continue with the model from the previous exercise.

DO NOT DISTRIBUTE - Printing for Student use is Permitted

2. Enter the following functions to define the input variables that were used in the Box Girder Variables dialog.
Dim nDivisions As Integer
Dim MaxHeight As Double
Dim MinHeight As Double
Dim SpanLength As Double
Dim SpanWidth As Double
Dim PlateThick As Double

3. Enter the following functions to instruct STAAD.Pro to get the input values if the OK button was clicked:
Dim dlgResult As Integer
dlgResult = Dialog(dlg)
If dlgResult = -1 Then
nDivisions = Abs(CInt(dlg.nDivisions))
MaxHeight = Abs(CDbl(dlg.MaxHeight))
MinHeight = Abs(CDbl(dlg.MinHeight))
SpanLength = Abs(CDbl(dlg.SpanLength))
SpanWidth = Abs(CDbl(dlg.SpanWidth))
PlateThick = Abs(CDbl(dlg.PlateThick))

4. Enter the following functions to instruct STAAD.Pro to cancel the operation of the Cancel button was clicked:
ElseIf dlgResult = 0 Then
Debug.Print Canel button Pressed
End If

5. Keep this model open for the next exercise.

Copyright 2012 Bentley Systems, Incorporated

11

Define the Model Geometry


Learn to create a macro to define the model geometry.

1. Continue with the model from the previous exercise.


2. Enter the following functions to determine the number of nodes required to generate the structure:

DO NOT DISTRIBUTE - Printing for Student use is Permitted

Dim NumOfNodes As Integer


Dim NodeX() As Double
Dim NodeY() As Double
Dim NodeZ() As Double
Dim STAADNodeNos() As Long
NumOfNodes = nDivisions + 1
ReDim NodeX(NumOfNodes) As Double
ReDim NodeY(NumOfNodes) As Double
ReDim NodeZ(NumOfNodes) As Double
ReDim STAADNodeNos(NumOfNodes*4) As Long

Note: The first step in generating the geometry is to define the total number of nodes to be generated by this macro. The number of
divisions (nDivisions variable) was specified in the Box Girder Variables dialog. By multiplying the number of divisions (plus 1)
by 4, we will arrive at the total number of nodes required for the parabolic box girder structure.

nDivisions = number of plates to be generated along each


side of the structure over the span length

Copyright 2012 Bentley Systems, Incorporated

12

3. Enter the following functions to calculate the Y values that make up the bottom side of the parabola.
Dim A As Double
A = -MinHeight / ((SpanLength/2)*(SpanLength/2))
Dim H As Double
H = SpanLength/2

DO NOT DISTRIBUTE - Printing for Student use is Permitted

Dim N As Integer
For N = 1 To NumOfNodes
NodeX(N) = (N-1)*SpanLength/nDivisions
NodeY(N) = ((NodeX(N)-H)*(NodeX(N)-H))*A + MinHeight

Note: For this exercise, we will use the following equation to define the parabola for the bottom surface of the structure:
Y = A (X - H)2 + K, where K = MinHeight.

Copyright 2012 Bentley Systems, Incorporated

13

4. Enter the following function to generate the nodes for the parabola at Z = 0:
objSTAADGUI.Geometry.AddNode(NodeX(N), NodeY(N),0)

5. Enter the following function to generate the nodes for the parabola at Z = Span Width:
objSTAADGUI.Geometry.AddNode(NodeX(N), NodeY(N), SpanWidth)

6. Enter the following function to generate the nodes for the straight top at Z = 0:
DO NOT DISTRIBUTE - Printing for Student use is Permitted

objSTAADGUI.Geometry.AddNode(NodeX(N), MaxHeight, 0)

7. Enter the following function to generate the nodes for the straight top at Z = Span Width:
objSTAADGUI.Geometry.AddNode(NodeX(N), MaxHeight, SpanWidth)
Next N

Note: Steps 4 - 7 will generate the nodes for each side of the parabolic box structure.

Step #6

Step #4
Step #7
Step #5

Copyright 2012 Bentley Systems, Incorporated

14

8. Enter the following functions to generate the Side Plates for each box section:
For N = 1 To NumOfNodes
objSTAADGUI.Geometry.AddPlate((2+4*(N-1)), (6+4*(N-1)), (8+4*(N-1)), (4+4*(N-1)))
objSTAADGUI.Geometry.AddPlate((1+4*(N-1)), (3+4*(N-1)), (7+4*(N-1)), (5+4*(N-1)))

9. Enter the following function to generate the Top Plate for each box section:

DO NOT DISTRIBUTE - Printing for Student use is Permitted

objSTAADGUI.Geometry.AddPlate((4+4*(N-1)), (8+4*(N-1)), (7+4*(N-1)), (3+4*(N-1)))

10. Enter the following function to generate the Bottom Plate for each box section:
objSTAADGUI.Geometry.AddPlate((1+4*(N-1)), (2+4*(N-1)), (6+4*(N-1)), (5+4*(N-1)))
Next N

Note: Steps 8 - 10 will generate the plates using the nodes that were generated through steps 4 - 7.

11. Keep this model open for the next exercise.


Copyright 2012 Bentley Systems, Incorporated

15

Define the Plate Thickness and Material


Learn to define the plate thickness and assign the concrete material to the plate.

1. Continue with the model from the previous exercise.


2. Enter the following functions to define the number of plates:

DO NOT DISTRIBUTE - Printing for Student use is Permitted

Dim NumOfPlates As Integer


NumOfPlates = nDivisions * 4

3. Enter the following functions to define the plate thickness in the Properties dialog:
Dim PlatePropertyNo As Long
PlatePropertyNo = objSTAADGUI.Property.CreatePlateThicknessProperty (PlateThick)

4. Enter the following functions to assign the plate thickness and concrete material to all of the plates in the model:
Dim P As Integer
For P = 1 To NumOfPlates
objSTAADGUI.Property.AssignPlateThickness(P, PlatePropertyNo)
objSTAADGUI.Property.AssignMaterialToPlate("CONCRETE",P)
Next P

5. Keep this model open for the next exercise.

Copyright 2012 Bentley Systems, Incorporated

16

Assign Fixed Supports to the End Nodes


Learn to use a macro to assign fixed supports to the end nodes.

1. Continue with the model from the previous exercise.


2. Enter the following functions to create a fixed support:

DO NOT DISTRIBUTE - Printing for Student use is Permitted

Dim SupportNo As Long


SupportNo = objSTAADGUI.Support.CreateSupportFixed

3. Enter the following functions to assign the fixed support to the first four nodes:
Dim NodeNo As Long
For NodeNo = 1 To 4
objSTAADGUI.Support.AssignSupportToNode (NodeNo, SupportNo)
Next NodeNo

4. Enter the following functions to assign the fixed support to the last four nodes:
For NodeNo = (4 * NumOfNodes - 3) To (4 * NumOfNodes)
objSTAADGUI.Support.AssignSupportToNode (NodeNo, SupportNo)
Next NodeNo

5. Keep this model open for the next exercise.

Copyright 2012 Bentley Systems, Incorporated

17

Create the Dead and Live Load Cases


Learn to use a macro to create the Dead Load and the Live Load primary load cases.

1. Continue with the model from the previous exercise.


2. Enter the following functions to generate the dead load case:

DO NOT DISTRIBUTE - Printing for Student use is Permitted

Dim DeadLoadNo As Long


DeadLoadNo = objSTAADGUI.Load.CreateNewPrimaryLoad (Dead Load)
objSTAADGUI.Load.SetLoadActive (DeadLoadNo)
Dim DeadLoadType As Integer
DeadLoadType = 0
objSTAADGUI.Load.SetLoadType(DeadLoadNo, DeadLoadType)

3. Enter the following functions to generate the live load case:


Dim LiveLoadNo As Long
LiveLoadNo = objSTAADGUI.Load.CreateNewPrimaryLoad (Live Load)
objSTAADGUI.Load.SetLoadActive (LiveLoadNo)
Dim LiveLoadType As Integer
LiveLoadType = 1
objSTAADGUI.Load.SetLoadType(LiveLoadNo, LiveLoadType)

4. Enter the following functions to update the structure and terminate the macro:
objSTAADGUI.UpdateStructure
Set objSTAADGUI = Nothing
End Sub

5. Click on the Save icon in the Macro Design Window. Then, close the Macro Design Window.

Copyright 2012 Bentley Systems, Incorporated

18

Add the Box Girder Macro to the Toolbar


Learn to add a macro to the user tools in the toolbar.

1. Continue with the model from the previous exercise.


2. Click Tools > Configure User Tools... in the menu bar.

DO NOT DISTRIBUTE - Printing for Student use is Permitted

3. Click on the New (Insert) icon in the Customize User Defined Tools dialog.
4. Enter the name Training_Box Girder into the Menu Items window.
5. Click on the ... button adjacent to the Command string in the Customize User Defined Tools dialog.
6. Navigate to the Training_Box Girder.vbs file you just created in the Select File dialog. Then, click Open.
7. Click OK in the Customize User Defined Tools dialog.
8. Keep this model open for the next exercise.

Copyright 2012 Bentley Systems, Incorporated

19

Run the Macro and Define the Geometry


Learn to run the macro and enter all of the appropriate input variables.

1. Continue with the model from the previous exercise.

DO NOT DISTRIBUTE - Printing for Student use is Permitted

2. Click on the User Tools icon in the File toolbar. Then, select Training_Box Girder from the pull down menu.

3. Enter the following parameters into the Box Girder Variables dialog:

Number of Divisions: 20

Maximum Pier Height: 20 inches

Minimum Pier Height: 10 inches

Span Length: 300 inches

Span Width: 30 inches

Plate Thickness: 1 foot

Click OK.

4. Keep this model open for the next exercise.

Copyright 2012 Bentley Systems, Incorporated

20

Review the Generated Geometry


Learn to review the goemetry and paramters generated using the macro.

1. Continue with the model in the previous exercise.


2. Click on the Geometry tab and the Plate sub-tab in the Page Control Area.

DO NOT DISTRIBUTE - Printing for Student use is Permitted

Notice that STAAD.Pro has successfully generated the nodes and plates for the parabolic box structure per the input parameters.

3. Click on the General tab and the Property sub-tab in the Page Control Area.
Notice that STAAD.Pro has successfully assigned the plate thickness and the concrete material to the plates in the structure.

4. Click on the General tab and the Support sub-tab in the Page Control Area.
Notice that STAAD.Pro has successfully assigned fixed supports to the end nodes of the structure.

5. Click on the General tab and the Load & Duration sub-tab in the Page Control Area.
Notice that STAAD.Pro has successfully assigned the dead load and the live load primary load cases.

Copyright 2012 Bentley Systems, Incorporated

21

Anda mungkin juga menyukai