- // Check that object belongs to active document or PartSet
- DocumentPtr aDoc = aRes->document();
- SessionPtr aMgr = ModelAPI_Session::get();
- if (!(aDoc == aMgr->activeDocument()) || (aDoc == aMgr->moduleDocument()))
- return;
-
- // Check that the result has a shape
- GeomShapePtr aShape = ModelAPI_Tools::shape(aRes);
- if (!aShape)
- return;
-
- /// Check that object has acceptable type
- if (!acceptObjectType(aObject))
- return;
-
- // Get sub-shapes from local selection
- if (myUseSubShapes) {
- NCollection_List<TopoDS_Shape> aShapeList;
- std::list<ObjectPtr> aOwners;
- myWorkshop->selection()->selectedShapes(aShapeList, aOwners);
- if (aShapeList.Extent() > 0) {
- aShape = boost::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
- aShape->setImpl(new TopoDS_Shape(aShapeList.First()));
- }
- }
-
- // Check that the selection corresponds to selection type
- if (myUseSubShapes) {
- if (!acceptSubShape(aShape))
- return;
- } else {
- if (!acceptObjectShape(aObject))
- return;
- }
- setObject(aObject, aShape);
- //activateSelection(false);
- emit focusOutWidget(this);