Groups

A groups of element and nodes within a group set is represented using the Group object.  This object encapsulates all the properties of the group such as the name and colour of the group.  The groups defined within a group set are contained within a Groups collection that can be referenced directly from a GroupSet object using the property of the same name.

 

A summary of all the properties and methods of the Group object are listed in the table below.

 

Property

Type

Description

Color

OLE_COLOR

Get/Set the colour of the group.

Elements

ElementList/Variant

Get/Set the list of the grouped elements.

GroupSet

GroupSet

Gets the parent group set in which the group is contained.

Label

String

Get/Set name of the group.

Nodes

NodeList/Variant

Get/Set the list of the grouped nodes.

 

 

Method

Returns

Description

AddNodes

 

Adds nodes to the group.

AddElements

 

Adds elements to the group.

RemoveNodes

 

Removes nodes from the group

RemoveElements

 

Removes element from the group

 

In addition, the Application, Frame, Number and Index properties as well as the Delete method are common to many objects and are described in Chapter 2.

Creating a Group

A new group is added to a group set using the AddGroup method of the Groups collection.  This method accepts three parameters that specify the name of the group, the grouped nodes and the grouped elements.  The nodes and elements in the group are specified using a variant parameter and so any value representing a group of nodes or group of elements can be used to specify these lists. Typically this will be either an array of indices or a list object or can be omitted if the group is to be created with no content.  The AddGroup method returns the Group object referencing the new group added to the frame.

 

The following code demonstrates how to add a group to the frame.  In this example, elements 1 to 5 are grouped together to

Dim myGroup As Multiframe.Group

’ Create the group in the floors group set
With myFrame.GroupSets(“Floors”)
  Set myGroup = .AddGroup("Floor 1", ,“1-5”)
End With

Properties

The Nodes property of the Group object returns a NodeList object containing each of the nodes in the group.  This property can also be used to set the nodes in the group and can be set equal to any value that represents one or more nodes such as a NodeList object. 

Dim myNodeList As New Multiframe.NodeList
 
' Find all nodes in second floor which is at y=6.5
Set myNodeList = myFrame.Nodes.Find("y", 6.4, 6.6)

With myFrame.GroupSets(“Floors”)
  ’ Reset nodes in the group
  .Group(”Floor 1”).Nodes = myNodeList

  ’ Reset elements in the group
  .Group(”Floor 1”).Elements = “1-6”
End With

 

Similarly, the Elements property of the Group object returns a ElementList object containing each of the elements in the group.  This property can also be used to set the elements in the group and can be set equal to any value that represents one or more elements such as a ElementList object. 

With myFrame.GroupSets(“Floors”)
  ’ Reset elements in the group
  .Group(”Floor 1”).Elements = “1-6”
End With

 

The colour of a group is referenced via the Color property of the Group object. The property is of type OLE_COLOR.

 

With myFrame.GroupSets(“Floors”)
  .Group(”Floor 1”).Colour = 255       ‘red
  .Group(”Floor 2”).Colour = 16711680  ‘blue
  .Group(”Floor 3”).Colour = 65280     ‘green
End With

 

The name of the group is referenced via the Label property of the Group object.

OLE_COLOR

The OLE_COLOR data type represents a colour as a BGR (Blue, Green, Red) value. The OLE_COLOR value of a colour specified by its red, green and blue components (each of which has a value from 0 - 255) is determined using the following expression:

OLE_COLOR value = red + (green * 256) + (blue * 65536)

 

The OLE_COLOUR values of some common colours are as follows:

Black           0

Dark Grey    4210752

Grey            8421504

Light Grey    12632256

White          16777215

Red              255

Green          65280

Blue             16711680

Magenta      16711935

Cyan            16776960

Methods

Nodes may be added or removed from the group using the AddNodes and RemoveNodes methods of the Group object.  These methods take a single variant parameter that specifies the nodes to be added or removed from the group.  A simple example demonstrating the various parameters that can be passed to these methods is shown below.

Dim mylist As New Multiframe.NodeList

mylist.Add "20-30"

With mfApp.Frame.GroupSets(“Floors”).Group(1)

  ’Add nodes to linked group
  Call .AddNodes(1)                 'Add node by index
  Call .AddNodes("2-9,12")          'Add nodes listed by index
  Call .AddNodes(mfApp.Frame.Nodes(10))  'Add node using node object
  Call .AddNodes(mylist)                 'Add nodes using list

  ‘Remove nodes from linked group
  Call .RemoveNodes(1)                     'By index
  Call .RemoveNodes("2-9,12")             
  Call .RemoveNodes(mylist)                'Using a list of nodes

End With

The manipulation of elements in a group in handled in a similar manner. Elements may be added or removed from the group using the AddElements and RemoveElements methods of the Group object.  These methods take a single variant parameter that specifies the elements to be added or removed from the group.  A simple example demonstrating the various parameters that can be passed to these methods is shown below.

Dim mylist As New Multiframe.ElementList

mylist.Add "20-30"

With mfApp.Frame.GroupSets(“Floors”).Group(“Floor 1”)

  ’Add Elements to linked group
  Call .AddElements(1)           'Add Element by index
  Call .AddElements("2-9,12")    'Add Elements listed by index
  Call .AddElements(mylist)      'Add Elements using list

  ‘Remove Elements from linked group
  Call .RemoveElements(1)            'By index
  Call .RemoveElements("2-9,12")     
  Call .RemoveElements(mylist)       'Using a list of elements

End With