Groups are created with the Analysis class method called createGroup. The Group class methods are then used to define the group type, entity type, and to add entities to the group.
In this example, a group object called s_chips is created that contains a group called “small chips”. This group is geometric (as opposed to motion), and contains volumes. Parts are added to it using a wildcard name so that all parts with “S-CHIP” in the name are added to the group:
s_chips = a.createGroup("small chips");
s_chips.type = "Geometric";
s_chips.entityType = "Volume";
s_chips.add("S-CHIP*"); //Must use '*' to indicate wildcard (regular expression)
Applying a condition to a group is done by referencing the group object. In the following example, a total heat generation condition is applied to our group called “small chips”. Recall that the object was called “s_chips”:
bc = new BoundaryCondition("Total Heat Generation");
bc.setValue(2, "W");
a.selectionBasis = "By Group";
a.select("small chips");
a.applyBoundaryCondition(bc);