- if (geomGen->_is_nil() || !aStudy)
- return false;
-
- GEOM::GEOM_IGroupOperations_var op =
- geomGen->GetIGroupOperations(aStudy->StudyId());
- if (op->_is_nil())
- return false;
-
- // check and add all selected GEOM objects: they must be
- // a sub-shapes of the main GEOM and must be of one type
- TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
- for ( int i =0; i < myGeomObjects->length(); i++)
- {
- TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)myGeomObjects[i]->GetShapeType();
- if (i == 0)
- aGroupType = aSubShapeType;
- else if (aSubShapeType != aGroupType)
- {
- aGroupType = TopAbs_SHAPE;
- break;
- }
- }
-
- GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
- GEOM::GEOM_Object_var aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
- op->UnionList(aGroupVar, myGeomObjects);
-
- if (op->IsDone()) {
- // publish the GEOM group in study
- QString aNewGeomGroupName ("Auto_group_for_");
- aNewGeomGroupName += myName->text();
- SALOMEDS::SObject_var aNewGroupSO =
- geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar, aNewGeomGroupName, aMeshShape);
- }
-
- myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(), aGroupVar);
- }
-