Hi, you should apply Select protection to the groups you do not want to participate in the selection process. For example you can use the following method:
private static void SetSelectProtection(NShape shape)
{
NAbilities protection = shape.Protection;
protection.Select = true;
shape.Protection = protection;
}
Then if you want to directly be able to select the rectangles you can call this method for the groups and the subgroups.