Applies To | |||
Product(s): | STAAD.Pro | ||
Version(s): | All | ||
Environment: | N/A | ||
Area: | OpenSTAAD | ||
Subarea: | Geometry, Group | ||
Original Author: | Bentley Technical Support Group, Shreyanka Bhattacharjee | ||
Problem Description:
How to get all entities in a certain group using OpenSTAAD function (VBA and python)
Solution:
You need to use function GetGroupEntities along with function GetGroupEntityCount
Parameter for function GetGroupEntityCount:
[Input] GroupName: Group string name
[Return Value] GroupEntityCount: The total number of entities in specified group
Parameter for function GetGroupEntities:
[Input] GroupName: Group string name
[Output] EntityList: Entity number ID(s)
Sample VBA Syntax:
Set objOpenStaad = GetObject(, "StaadPro.OpenSTAAD")
Dim GroupEntityCount As Long
Dim GroupName As String
Dim EntityList() As Long
GroupName = "_COLUMN1"
GroupEntityCount = objOpenStaad.Geometry.GetGroupEntityCount(GroupName)
ReDim EntityList(GroupEntityCount - 1)
objOpenStaad.Geometry.GetGroupEntities GroupName, EntityList
Sample python script:
communities.bentley.com/.../GetGroupEntities.py
Output: