How to create a "Member Group" in STAAD using OpenSTAAD command? Not able to run the command (code) "objOpenSTAAD.Geometry.CreateGroup lGruopType, strGruopName" given in OpenSTAAD Help menu.
I want to know the answer to.
And second question is how to assign members to group. There is no such function in OpenStaad help.
Now i see the one way to get a text strings for input file using VB macro... like this:
START GROUP DEFINITIONMEMBER_BEAMS 1 5 TO 10 14END GROUP DEFINITION
And after that it should be copied/pasted into input file by user. Not so productively as i wanted
You may try the OSGeometryUI::CreateGroup function, which is used to create a group. Use type 2 (first parameter passed) to assign it for members. Alternately, the function OSGeometryUI::CreateGroupEx can be used to create a group and pass a list of members at the same time.
OSGeometryUI::CreateGroup
OSGeometryUI::CreateGroupEx
Example (VBA):
objOpenSTAAD.Geometry.CreateGroup(2,"MyBeamGroup")
DIM varEntityList As Variant
'select four members to be added to the group in the following command
objOpenSTAAD.Geometry.CreateGroupEx(2,"MyBeamGroup2",4,&varEntityList)
The function OSGeometryUI::UpdateGroup can then be used to replace, add, or remove objects from the a group.
OSGeometryUI::UpdateGroup
'Update group to add members from a variant array list
objOpenSTAAD.Geometry.UpdateGroup("MyBeamGroup",2,4,&varEntityList)
STAAD.Pro CONNECT Edition Update 2 comes with the latest OpenSTAAD help, which can be access by selecting File > Help > OpenSTAAD Help.
Jason Coleman, PE
Bentley Systems Senior Manager Technical Content
Thank you.
I ve noticed that members which were selected at the moment of group creating (VB) goes to be assigned for a new group automatically. This aspect was not declared in Help.
Could you clarify what the last two parameters are? The code I have tried is shown below, but the function call returns false and only the Group Definition block is added to the STAAD file.
The last 2 parameters I am passing are an integer and an array. I added several debug.print lines to help with the debugging.
' Create a new node group named "NodeGroup" for selected nodes. Dim RetVal As Variant Dim GroupType As Integer Dim GroupName As String GroupType = 2 ' Members GroupName = "_WIND_BEAM" Dim arr(12) As Variant Dim arrCount As Integer For arrCount = 0 To 12 arr(arrCount) = 200 + arrCount * 1 Next arrCount = arrCount - 1 RetVal = objOpenSTAADGeometry.CreateGroupEx(GroupType, GroupName, arrCount, arr)
Public Function CreateGroups() Debug.Print "creating groups started" ' Create a new node group named "NodeGroup" for selected nodes. Dim RetVal As Variant Dim GroupType As Integer Dim GroupName As String GroupType = 2 ' Members GroupName = "_WIND_BEAM" Dim arr(12) As Variant Dim arrCount As Integer For arrCount = 0 To 12 arr(arrCount) = 200 + arrCount * 1 Next arrCount = arrCount - 1 RetVal = objOpenSTAADGeometry.CreateGroupEx(GroupType, GroupName, arrCount, arr) Debug.Print "GroupType = " & GroupType Debug.Print "GroupName = " & GroupName Debug.Print "arrCount = " & arrCount 'loop just to show it is an array Dim rowString As String Dim iSubA As Long rowString = "" Debug.Print "The array is: " For iSubA = 0 To UBound(arr) rowString = arr(iSubA) Debug.Print rowString Next iSubA Debug.Print "RetVal = " & RetVal Debug.Print "creating groups finished" End Function
creating groups started GroupType = 2 GroupName = _WIND_BEAM arrCount = 12 The array is: 200 201 202 203 204 205 206 207 208 209 210 211 212 RetVal = False creating groups finished