Can someone help me understand the difference?
Why does i = 2887 while ii = 3008
FilteredElementCollector groupInstances = new FilteredElementCollector(doc).OfClass(typeof(Group));
FilteredElementCollector groupInstances1 = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_IOSDetailGroups);
FilteredElementCollector groupInstances2 = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_IOSModelGroups);
int i = groupInstances.Count(); // = 2997
int ii = groupInstances1.Count(); // = 3008
int iii = groupInstances2.Count(); // = 155
Possibly answering my own question here, but OST_IOSDetailGroups apears
to include GroupTypes
in addition to Groups. Of course this lead to another question... Why does Revit expose a method for obtaining Groups, but only detail groups? Why isn't the same functionality available for Model Groups? And ultimately, how do I get started separating the model Groups from the model GroupTypes?
Follow up... This seems to do the trick, but isn't very elegant. I'm sure there is a better way.
try
{
GroupTypeId = group.GetTypeId().ToString();
}
catch
{
GroupTypeId = "GroupType";
}