OS. To initialize OpenSTAAD and calculate the node coordinates
-
Type the following command to initialize
OpenSTAAD:
VB
Dim objOpenSTAAD As Object Set objOpenSTAAD = GetObject(,"StaadPro.OpenSTAAD")This command opens the connection to STAAD.Pro and the model currently open in the program.Note: You can initialize OpenSTAAD to any variable. Here,objOpenSTAADis used. -
Type the following commands to reference the
geometryclass in a variable:VB
Dim geometry As OSGeometryUI Set geometry = objOpenSTAAD.Geometry -
Type the following two
Forloops to calculate the nodal coordinates for each node in the frame.Note: There are two nested loops used because this is a 2D frame. The Z coordinate was previously set to zero and will not change.VB
'Nodes For j = 2 To (row + 2) For i = 1 To (clmn + 1) crdx = (i - 1) * wdth geometry.AddNode crdx, crdy, crdz Next crdy = (j - 1) * ht NextNote: TheNextcommand to close theForloop is added automatically once you press Enter after typing theForcommand line. -
Type the following commands to reference the
supportclass in a variable:VB
Dim support As OSSupportUI Set support = objOpenSTAAD.Support -
Type the following
If ElseIfstatement to get the desired support type.The support is created and the returned support reference number is stored to the variables1.A “fall back” possibility is also added in case neither of the intended support types is somehow specified, then an error message is presented to the user.
VB
'Supports If sprt = "0" Then s1 = support.CreateSupportFixed() ElseIf sprt = "1" Then s1 = support.CreateSupportPinned() Else MsgBox("Select Proper Support Type",vbOkOnly,"Error") Exit Sub End IfNote: The OpenSTAAD commandsupport.CreateSupportFixedcan also be used to simply create a new support without using the return value. But by adding the parenthesis at the end, the script can take the returned support reference number which allows you to store that in the variable. -
Type the following line to add a debugging statement for the
returned support reference number:
VB
Debug.Print "Support return value = ";s1 -
Type the following type to assign the support types to the bottom
nodes in the frame:
VB
For i1 = 1 To (clmn + 1) support.AssignSupportToNode i1,s1 Next
Tip: Now is a good time to save the work
done to this point.