Академический Документы
Профессиональный Документы
Культура Документы
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.
TRN020150-1/0001-PW02
Initiate OpenSTAAD
Create a New Macro and Initiate OpenSTAAD.
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.
2. Enter the following functions to define the primary load case variables:
Dim i As Integer
Dim LCaseCount As Integer
Dim LCaseNum() As Long
Dim LCaseName() As String
3. Enter the following functions to retrieve the Primary Load Case Information from the active STAAD.Pro model:
LCaseCount = objSTAADGUI.Load.GetPrimaryLoadCaseCount()
ReDim LCaseNum(LCaseCount)
ReDim LCaseName(LCaseCount)
objSTAADGUI.Load.GetPrimaryLoadCaseNumbers LCaseNum
For i = 0 To LCaseCount-1
LCaseName(i) = CStr(LCaseNum(i)) & : & objSTAADGUI.Load.GetLoadCaseTitle(LCaseNum(i))
Next i
Note: In this exercise, we will create the following user dialog to select a defined load case:
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:
Quoted: (checked)
Click on the double right arrow button to enter the name of the field. Then, click Close.
7. Click on the Add List Box icon in the UserDialog Editor. Click within the new dialog to define the list box location and then double-click
within the new list box.
8. Enter the following information into the Edit List Box Properties dialog:
Array: LCaseName
Click on the double right arrow button to enter the name of the field. Then, click Close.
9. Click on the Add OK Button icon in the New UserDialog Editor. Then, click within the new dialog to define the OK button.
10. Click on the Add Cancel Button icon in the New UserDialog Editor. Then, click within the new dialog to define the Cancel button.
11. Click on the Save and Edit icon in the New UserDialog Editor.
12. Delete the last line of this code (Dialog dlg).
13. Keep this model open for the next exercise.
3. Enter the following functions to instruct STAAD.Pro to cancel the operation of the Cancel button was clicked:
ElseIf dlgResult = 0 Then
Debug.Print Cancel button Pressed
End If
2. Enter the following functions to determine if any nodes have been selected in the main application:
Dim NumSelNodes As Long
Dim SelNodeArray() As Long
NumSelNodes = objSTAADGUI.Geometry.GetNoOfSelectedNodes()
If NumSelNodes > 0 Then
ReDim SelNodeArray(NumSelNodes)
objSTAADGUI.Geometry.GetSelectedNodes(SelNodeArray, 1)
Else
MsgBox Please Select Nodes, vbOKOnly
Exit Sub
End If
3. Enter the following functions to get the nodal displacements for the selected nodes:
Dim j As Integer
Dim NodeNo As Long
Dim DisplArray(6) As Double
Dim MaxDisplArray(6) As Double
Dim NodeArray(6) As String
For i = 0 To NumSelNodes-1
NodeNo = SelNodeArray(i)
objSTAADGUI.Output.GetNodeDisplacements(NodeNo, LoadCase, DisplArray())
For j = 0 To 5
If Abs(DisplArray(j)) > Abs(MaxDisplArray(j)) Then
MaxDisplArray(j) = Round(DisplArray(j), 3)
NodeArray(j) = N & CStr(NodeNo)
End If
Next j
Next i
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: In this exercise, we will create the following user dialog to display the maximum deflection of the selected nodes:
Then, click on the double right arrow button to enter the name of the dialog box.
5. Use the Add Text tool to add the following text fields to the dialog:
Load Case:
X:
Y:
Z:
Note: Ensure that the Quoted field is selected when defining the text fields.
6. Use the Add Text tool to add the following text fields to the dialog:
LoadCaseName
CStr(MaxDisplArray(0))
CStr(MaxDisplArray(1))
CStr(MaxDisplArray(2))
BaseLengthUnit
NodeArray(0)
NodeArray(1)
NodeArray(2)
Note: Ensure that the Quoted field is not selected and the Field parameter is left blank when defining the text fields for the variables.
7. Click on the Add OK Button icon in the New UserDialog Editor. Then, click within the new dialog to define the OK button.
8. Click on the Save and Edit icon in the New UserDialog Editor.
9. Redefine the User Dialog by changing the last two lines in the macro to the following:
Dim dlg2 As UserDialog
Dialog dlg2
10
3. Click on the New (Insert) icon in the Customize User Defined Tools dialog.
4. Enter the name Training_Nodal Deflection 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_Nodal Deflections.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.
11
3. Select the Stay in Modeling Mode radio button in the STAAD Analysis and Design dialog. Then, click Done.
4. Click Select > By All > All Nodes in the menu bar.
5. Click on the User Tools icon in the File toolbar. Then, select Training_Node Displacements from the pull down menu.
6. Highlight the Wind Load case in the Select Load Case dialog. Then, click OK.
Note: Notice that the Maximum Deflection dialog has now returned the maximum translational deflection in the X, Y, and Z axis global
directions and the corresponding node number.
12