Group SOP

From TouchDesigner 088 Wiki


The Group SOP generates groups of points or primitives according to various criteria and allows you to act upon these groups. Elements can occur in more than one group. Groups are used in many parts of the SOP Editor to specify which portion(s) of input geometry you wish a SOP to act upon.

You can also create ordered groups. To do so, check the Ordered button.

PythonIcon.png groupSOP_Class

Parameters - Create Page

Group Name /crname - The name of the group to be created. The default name is set to match the name of the SOP.

Entity /entity - Primitives or Points.

Geometry Type /geotype - Select the geometry type group. The selection will only pertain to the geometry type specified. e.g. If you only wanted to group polygons.

  • All Types - All geometry will be selected.
  • Bzier Curve -
  • Bzier Surface -
  • Circle -
  • Mesh -
  • Meta-ball -
  • NURBS Curve -
  • NURBS Surface -
  • Particles -
  • Polygon -
  • Sphere -
  • Tube -
  • Triangle Strip -
  • Triangle Fan -

Number - Allows selection of grouping of entities by number. When checked, the options relative to this selection option are displayed.

Number Enable - When the Enable button is checked under the Number button, the selection options become active and can be used to select entities. The fields available are listed below.

Create Ordered /ordered - When selected, elements in the group are traversed in the order they are selected; otherwise they are traversed in creation order.

Operation /groupop - When the Number Enable button is checked, this option groups entities based on a defined Pattern or by a Range.

  • Group by Pattern - Select a pattern in the Pattern field below.
  • Group by Range - Select a Range using the Start/End and Select_of_ fields below.
  • Group by Expression - Select a range using the Filter Expression field below.

Pattern /pattern - Activated when Operation is set to Group by Pattern. In this field, enter the range of primitives to select. The required syntax is "S.P", where S is the index of the parent surface, and P the profile index on that surface. You can mix primitives with profiles in the list. A mixed group is automatically ordered.

For example;
0.4 2 4 2.5 3.7 selects three profiles and two primitives,
0-100:2 selects every other number from 0 to 100,
0-10:2,3 selects every two of three,
0.0-6 selects six profiles on primitive 0,
0.* selects all profiles on primitive 0,
!4 selects every primitive or point except the fourth,
9-0 selects first ten (in reverse if ordered flag is on),
!0.* selects all profiles except those on primitive 0,
* selects all primitives or points, and no profiles.

See Pattern Matching for details.

Transfer Selection to Pattern /transfer - This allows you to define the range of points / primitives visually by selecting them in the Viewport with the Select state. Clicking this button transfers the selected points/primitives into the Pattern field as a compacted range (e.g. 1-23 40 67-100). This eliminates the need for typing the point or primitive numbers manually.

Note: Point and primitive selections can be dumped directly into Group fields without use of the Group SOP. Do this by selecting the points or primitives in the Viewport with the Select state. Then the pop-up N menu beside the Group field of the SOP you want to cook should display the selection in the input SOP (e.g. "grid1's Primitive Selection"). Ranges are automatically compacted.

Start/End /rangeend - Activated when Operation is set to Group by Range. Select the start and end of the primitive/point number selection.

Select _ of _ /select1 /select2 - Activated when Operation is set to Group by Range. Select every nth occurrence of every mth entity in the above Start/End range.

For example; entering 1 and 2 selects 1 out of every 2 entities.

Filter Expression /filter - The Filter Expression provided is evaluated for every point/primitive. Wherever it is true, the entity is added. All the local variables of point and primitive are present, though only accessable when the right type of group is being created.

Bounding - This option is used for selecting entities based on bounding volumes: Bounding Box, or Bounding Sphere. When checked, the options relative to this selection option are displayed.

Bounding Enable - When the Enable button is checked under the Bounding button, the selection options become active and can be used to select entities. The fields available are listed below. The bounding volume can be seen in the viewport as guide geometry.

Bounding Type /boundType - Selects the type of bounding volume to use:

  • Bounding Box entities contained within the box are selected.
  • Bounding Sphere entities contained within the sphere are selected.

Size /sizex /sizey /sizez - Dimensions of either the Bounding Box or Bounding Sphere in X, Y and Z.

Center /tx /ty /tz - The X, Y, and Z coordinates of the center of the bounding volume.

Normal - This option is used for selecting entities based on the angle of the entity normals. When checked, the options relative to this selection option are displayed.

Normal Enable - When the Enable button is checked under the Normal button, the selection options become active and can be used to select entities. The fields available are listed below.

The primary axis and the spread angle from the defined axis define a range of angles. If any entity normals lie within this range, then the associated entity is selected.

For example; if you want to select the polygons that are very steep in a polygon mountain terrain on the XZ axis. You would set the Direction to be 0, 1, 0 and the spread angle to around 75. This selects all the polygons with normals that lie flat to fairly sloped. You will have grouped all of the polygons that lie flat up to polys that are at a 75 angle from the axis. You are left with all of the polygons that are 76 or greater.

Direction /dirx /diry /dirz - The default values of 0, 1, 0 create a normal vector straight up in Y, which is perpendicular to the XZ plane, which becomes the primary axis. The 1, 0, 0 points the normal in positive X, giving a normal axis perpendicular to the YZ. The plane may be positioned at an angle by using values typed in (1, 1, 0 gives a 45 angle plane) or interactively by using the direction vector jack. Values between 0 and 1 should be used.

Spread Angle /angle - The value entered in this field generates an angle of deviation from the primary axis. This can be visualized as a cone where the radius of the base of the cone is defined by the Spread Angle and the axis of the cone is determined by the Direction axis. Viewing the primitive normals in the viewport, you can see that any primitives with normals that have an angle that lies in the range of angles defined by the cone will be selected and grouped.

Backface From /camera - This menu allows you to select an object. Typically, a camera object would be chosen. The primitives which are backface when viewed from the object specified will be grouped or selected.

Edges - Allows you to group primitives by edges according to the following criteria:

Edge Angle /doangle /edgeangle - Specifies an angle between edges in which to group. Works only for primitive groups.

Edge Depth /dodepth /edgestep - Enter the depth of the edge (only for point groups).

Point Number /point - Enter the specific point numbers (only for point groups).

Note: Edge Depth and Point Number allow for a blossoming effect from the specified point. All points that are an Edge Depth away from the specified point are added to the group. If there are selected points already there, the Point Number field is disabled and the blossoming occurs from the selected points.

Unshared Edges (Bounding Polygon) /unshared - When selecting points, this option selects the points of a ploygonal mesh which appear on the boundary (i.e. those which are not shared) for inclusion in the group, and orders them. In addition to polygonal meshes, this option also finds the boundaries of geo Hulls and open faces.

Create Boundary Groups /boundarygroups - When selecting points with the Unshared Edges parameter, this option becomes available. Enabling it creates new groups of the form: <name>__< n> , (two underscores) where the < name> is the Group Name specified in the Create page. Numbers < n> begin at zero, and increment as more groups are created.

These groups contain the points on each boundary of the surface. For example, if you have a grid with a hole in the middle of it, two new point groups are created - one containing the points for the outer boundary and one with the points from the hole. These new point groups are also ordered.

Parameters - Combine Page

This page allows you to combine different groups based on specific boolean operators and combination methods.

The following operations are possible:

  • Negation - not A
  • Union - A Or B
  • Intersect - A AND B
  • Exclusive Or - !A OR !B
  • Subtract - A minus B

In the first field, you may enter a new group, or assign the result to an existing group.

The buttons in the center column take the negation of the group to the right of it.

Parameters - Edit Page

This folder allows you to edit existing groups.

Convert Type /cnvtype - Converts a group from a point group to a primitive group, and vice versa.

Group Name /convertg - Name of the group to convert.

Convert Name /cnvtname - New group name.

Preserve Original /preserve - When checked, preserves original geometry.

Rename /oldname /newname - Allows you to rename an existing group to something else.

Delete /destroyname - Allows you to delete an existing point or primitive group.

Inputs / Geometry Types

Input 1 - Source Data - The source geometry.

Input 2 - Bounding Object - Bounding geometry. (Where applicable. Only works for point groups when selecting by bounding geometry.)

Accepts all geometry.

Local Variables

$N - Number of primitives / Number of points.

Uses / Works in Relation With

This SOP is very powerful and is ideal for combining geometry that is similar. For example, all the primitive geometry of a group of door structures for a three-dimensional architectural model could be grouped together and consequently scaled and re-sized together using a Transform SOP. Works in conjunction with most filter SOPs.

Group name specifiers become very powerful when you use Pattern Matching in your group specifiers, as described in Pattern Matching.