Groups   

<<< Rollback Chapters Bulletin Board >>>

Contents

[back to top]


98.1 Introduction

Groups are collections of entities. They enable applications to assemble and track sets of entities within a part, in order to supplement the Parasolid data structure.

You create a group within a given part from a specified list of entities from that part using PK_GROUP_create_from_entities_2. You can then add further entities using either PK_GROUP_add_entities or PK_GROUP_merge_entities, and you can remove them using PK_GROUP_remove_entities.

Entities may be added to groups, and new groups may be created, as a result of modelling operations on the part. In addition, Parasolid provides a variety of options to let you control this behaviour, and to control the number of groups in a part.

 

Related Topics:

[back to top]


98.2 Characteristics of groups

Each group belongs to a particular part and has a particular class. A group can only contain entities that belong to the same part as the group belongs to. The group class, from the following list, determines the class of entities the groups can contain:

 

Note: Cyclic groups (i.e. groups containing themselves or groups higher up in the group hierarchy) are not allowed.

Specifying a single class prevents inappropriate entities being added to the group.

Any number of groups can belong to the same part, and these can be of the same or different classes. Similarly, a particular entity can be in any number of groups that are able to contain that entity.

Groups are entities, and so all the general functions for managing entities can be used on groups.

[back to top]


98.3 Entity labels

To help you identify and structure the contents of a group, entities within a group can have an integer label assigned. This allows you to assign a meaning to different members of a group: for example to label the side faces of a body as “1”.

You can assign labels to entities in a group when you create a group, using the labels and labelled_entities options provided in PK_GROUP_create_from_entities_2. Alternatively, Parasolid provides functions PK_GROUP_set_entity_label and PK_GROUP_ask_entity_label, for assigning and enquiring entity labels after a group has been created, and finding entities within a group based on the label.

Entity labels do not have to be unique, so you could, for example, assign the same label to the topmost face in any group. Also, entity labels are independent for each group; if an entity is in multiple groups, setting its label in one group does not affect its label in any other groups. Several entities in the same group can be assigned the same label. For example, all the “side faces” in a body could be labelled as “1” for easy identification. Entity labels are persistent across transmit and receive. Unset entity labels are initialised to zero.

You can also use entity labels to determine when groups should be automatically deleted due to there not being sufficient members in the group. See Section 98.4, “Deleting groups automatically”, for information.

[back to top]


98.4 Deleting groups automatically

As a Parasolid session progresses, the members of a group are modified as modelling operations change entities by means of merge, split, or delete operations. Section 98.6 describes the behaviour of groups and group members in these situations.

If you use entity labels (Section 98.3) to structure and encapsulate particular types of information within groups, then these modelling operations are likely to change the members of your groups so that they eventually no longer represent the information you originally intended. For example, you might create a group in which all the side faces of a body are labelled. If, as a result of a boolean operation, those side faces are deleted from the body, then they are also removed from the group: the original purpose of the group is effectively made redundant.

To manage this, when you create a group, you can define rules to ensure Parasolid intelligently deletes that group when its purpose becomes redundant. You do this by setting criteria for the entity labels you use within the group using the following options in PK_GROUP_create_from_entities_2:

 

Option

Description

n_min_contents

The length of the min_contents_labels and min_contents_minima arrays. Default: 0.

min_contents_labels

An array of entity labels used to determine when a group should be automatically deleted. For each entity label in this array, if the number of entities in the group with that label falls below the number specified by the corresponding entry in min_contents_minima , then the group is automatically deleted. Default: NULL.

min_contents_minima

An array of integers that specifies the minimum number of entities with a particular entity label (defined in min_contents_labels ) that must be present in a group. If the number of such entities falls below this, then the group is deleted. Default: NULL.

You do not have to use entity labels in your application in order to make use of this functionality. All entities without labels are assumed to have an entity label of 0, and this can be specified in min_contents_labels to control group deletion based on entities without labels. This can be a good way of ensuring, for instance, that the number of empty groups on a part does not proliferate during a Parasolid session.

 

Warning: If you do use entity labels, you should define rules based on the 0 label with care and ensure you maintain a consistent labelling policy. For example, automatically deleting a group when it contains no non-labelled entities deletes that group even if it still contains labelled entities.

The following table shows a number of examples to illustrate how you can use this mechanism:

 

Values

Effect

n_min_contents: 1
min_contents_labels: [0]
min_contents_minima: [1]

Deletes the group if it contains no non-labelled entities. If you do not use entity labels, these settings automatically delete the group when it becomes empty.

n_min_contents: 1
min_contents_labels: [3]
min_contents_minima: [2]

Deletes the group if it contains 0 or 1 entities with label 3.

n_min_contents: 2
min_contents_labels: [1 2]
min_contents_minima: [2 1]

Deletes the group if either of the following is true:

  • There are 0 or 1 entities with label 1.
  • There are 0 entities with label 2.

 

Note: You can use PK_GROUP_remove_entities to remove entities from a group without triggering any rules defined using these options. This gives you the freedom to change the contents of a group, including removing all of its members, without having Parasolid automatically delete the group in the process.

[back to top]


98.5 Deleting dependent groups

If you are deleting groups that contain other groups as members, you can specify whether you want to delete these member groups, using the delete_dependants option in PK_GROUP_create_from_entities_2. This can take the following values:

 

Value

Description

PK_GROUP_dependants_keep_c

When a group is deleted, do not delete any groups that are members of the deleted group. This is the default.

PK_GROUP_dependants_delete_c

When a group is deleted, consider deleting any groups that it contains. Such groups are only deleted if they are not members of any other existing groups.

 

Note: This also applies when groups and group members are automatically deleted as described in Section 98.4.

[back to top]


98.6 Groups and modelling operations on a part

This section describes group behaviour when performing modelling operations on a part. For information on group behaviour in compound bodies, see Section 15.12.4, “Behaviour of groups in compound bodies”.

98.6.1 Merging entities

You can use the membership option in PK_GROUP_create_from_entities_2 to control the behaviour of entities in that group when those entities undergo a merge operation with another entity that may or may not be in the same group. This option takes the following values:

 

Value

Description

PK_GROUP_membership_inclusive_c

The resulting merged entity is always a member of the group. This is the default.

PK_GROUP_membership_exclusive_c

The resulting merged entity is a member of the group only if both original entities were members of that group.

Note: Using this value may lead to the removal of entities from a group. This in turn may trigger rules to automatically delete a group, as described in Section 98.4.

Merging may be performed explicitly or as part of a local operation.

98.6.2 Splitting entities

If an entity is split into a number of entities, the new entities are added to any group in which the original entity occurs. After splitting, the new entities have the same entity label as the original label in each group.

98.6.3 Deleting entities

If an entity is deleted, it is removed from any group in which it occurs. If the last entity is removed from the group, the empty group continues to exist, unless you set controls for the group such that it is deleted automatically when it becomes empty (see Section 98.4).

98.6.4 Creating entities

If a new entity is created other than by splitting an existing entity, the new entity does not occur in any groups as a result of the creation operation.

98.6.5 Merging bodies

If several bodies are merged (for example as a result of a boolean operation), then the resulting merged body inherits all the groups of the original bodies. Over time, this can lead to a proliferation of groups on a body,

When you create a group using PK_GROUP_create_from_entities_2, you can use the merge_empty and merge_populated options to let Parasolid control this proliferation of groups by merging groups it considers identical in the result body, as follows.

 

Option

Description

merge_empty

Whether to merge identical empty groups in the resulting merged body. Empty groups are considered identical if they have no entities, and have the same attributes and group controls.

merge_populated

Whether to merge identical non-empty groups in the resulting merged body. Non-empty groups are considered identical if they have the same entities (and the same entity labels, if entity labels are used: see Section 98.3), and have the same attributes and group controls.

Both merge_empty and merge_populated take the following values:

 

Value

Description

PK_GROUP_merge_no_c

Do not merge groups considered identical. This is the default for both merge_empty and merge_populated .

PK_GROUP_merge_identical_c

Merge unique pairs of groups that are considered identical.

98.6.6 Splitting bodies

For non-empty groups, if a body splits one of the following occurs:

For empty groups, you can use the split_empty option when creating a group using PK_GROUP_create_from_entities_2 to control what happens if the owning body is split. This option takes the following values:

 

Value

Description

PK_GROUP_split_never_c

The empty group remains in the original part. This is the default.

PK_GROUP_split_always_c

The empty group remains in the original part, and a copy of it is created in the split part.

[back to top]


98.7 Closed groups

Once a group has been marked closed, you cannot manually add entities to or remove entities from the group. The contents of a closed group can only be modified by Parasolid operations which result in split, delete, or merge events.

For a group to be marked as a closed group, it must have an attribute attached whose definition is set to be group closing using PK_ATTDEF_set_group_closing. This attribute definition must be created from the PK_ATTDEF_class_01_c_class.

 

Note: Once an attribute definition is set to be group closing, it will remain as such throughout the current session. If you require the attribute definition to have this group closing property in other sessions, it must be set as such in each of those sessions.

 

Note: Once a group is set to be a closed group, it will remain as one throughout the current session if it has at least one group closing attribute attached.

You can use PK_ATTDEF_is_group_closing to find out whether or not the given attribute definition is a group closing definition.

98.7.1 Enquiring if the group is a closed group

You can use PK_GROUP_ask_closure to find out whether the given group is a closed group. In addition, you can choose to return the attributes that caused the group to be closed by setting the want_attribs option to PK_LOGICAL_true.

98.7.2 Returning closed groups

You can find closed groups of which a given entity is a member using the group_closure option of PK_ENTITY_ask_owning_groups_2.

You can find closed groups that are contained within a given part using the group_closure option of PK_PART_ask_groups_2.

[back to top]


98.8 Summary of PK functions specific to groups

The following table summarises the functions Parasolid provides for creating and working with groups.

 

Function

Description

PK_ENTITY_ask_owning_groups_2

Find the set of groups that the given entity is a member of.

PK_GROUP_ask_closure

Ask whether or not the given group is a closed group.

PK_GROUP_create_from_entities_2

Turn an array of entities into a group.

PK_GROUP_add_entities

Add more entities to a group.

PK_GROUP_merge_entities

Add more entities, purging duplicates.

PK_GROUP_remove_entities

Remove entities from a group.

PK_GROUP_ask_entities

Return entities in the group.

PK_GROUP_contains_entity

Search a group for a specific element.

PK_GROUP_ask_entity_class

What class are the grouped entities?

PK_GROUP_ask_part

What part owns the group?

PK_GROUP_set_entity_label

Set the entity label for an entity in a given group.

PK_GROUP_ask_entity_label

Return the entity label for an entity in a given group.

PK_GROUP_find_entities

Return all the entities within a given group, optionally with a given label.

PK_GROUP_ask_controls

Returns the controls of the given group.

PK_PART_ask_groups_2

Find the set of groups contained within the part

[back to top]


98.9 Examples of groups and boolean operations

In each of the following examples, the block has two groups:

Similarly, the rod has two groups:

Unless stated otherwise, the two bodies are positioned so that their centroids coincide.

 

Example

Comments

 

The block and the rod are of identical height and so the resulting body has four groups:

  • 1 (derived from A) contains all the planar faces
  • 2 (derived from B) contains all the straight edges
  • 3 (derived from C) contains the cylindrical face
  • 4 (derived from D) contains both the circular edges

 

The rod is higher than the block and so the resulting body has four groups:

  • 1 (derived from A) contains all the planar faces
  • 2 (derived from B) contains all the straight edges
  • 3 (derived from C) contains the cylindrical face
  • 4 (derived from D) is empty, because the circular edges are not derived from the edges of the rod

 

The block and the rod are of identical height and the centroid of the rod is positioned at the center of the block's end face. The resulting body has four groups:

  • 1 (derived from A) contains all the planar faces. Note that group 1 contains one more face than group A because the end face of the block has given rise to two faces.
  • 2 (derived from B) contains all the straight edges except those that bound the cylindrical face. These edges are new and are not derived from the edges of the block.
  • 3 (derived from C) contains the cylindrical face
  • 4 (derived from D) contains both the circular edges

 

The rod is higher than the block and the centroid of the rod is positioned at the center of the block's end face. The resulting body has four groups:

  • 1 (derived from A) contains all the planar faces. Note that group 1 contains one more face than group A because the end face of the block has given rise to two faces.
  • 2 (derived from B) contains all the straight edges except those that bound the cylindrical face. These edges are new and are not derived from the edges of the block.
  • 3 (derived from C) contains the cylindrical face
  • 4 (derived from D) is empty, because the circular edges are not derived from the edges of the rod

 

The rod is higher than the block and so the resulting body has four groups:

  • 1 (derived from A) contains all the planar faces except the circular faces
  • 2 (derived from B) contains all the straight edges
  • 3 (derived from C) contains both of the cylindrical faces and both of the circular faces
  • 4 (derived from D) contains the circular edges around the circular faces but not the circular edges where the cylindrical faces meet the block, because these are not derived from the edges of the rod.

 

The block and the rod are of identical height and so two bodies are created in the result. Each of the resulting bodies has four groups, as follows:

  • 1 (derived from A) contains all the planar faces from A which are in the result body
  • 2 (derived from B) contains all the straight edges except those that bound the cylindrical face
  • 3 (derived from C) contains the cylindrical face
  • 4 (derived from D) contains two circular edges

 

The rod is higher than the block and so the resulting bodies each have four groups:

  • 1 (derived from A) contains all the planar faces from A which are in the result body
  • 2 (derived from B) contains all the straight edges except those that bound the cylindrical face
  • 3 (derived from C) contains the cylindrical face
  • 4 (derived from D) is empty, because the circular edges are not derived from the edges of the rod

 

The rod is higher than the block and so the resulting body has four groups:

  • 1 (derived from A) contains all the planar faces except the two circular faces
  • 2 (derived from B) contains all the straight edges except those that bound the cylindrical face
  • 3 (derived from C) contains the cylindrical face and both of the circular faces
  • 4 (derived from D) contains both the completely circular edges, but not the four part-circle edges bounding the cylindrical face because these are not derived from the edges of the rod.

 

[back to top]

<<< Rollback Chapters Bulletin Board >>>