- if (myIsSketchMode) {
- if (aMode == TopAbs_FACE) {
- BRep_Builder aBuilder;
- TopoDS_Compound aComp;
- aBuilder.MakeCompound(aComp);
- aBuilder.Add(aComp, myOriginalShape);
- std::list<std::shared_ptr<GeomAPI_Shape>>::const_iterator aIt;
- for (aIt = myFacesList.cbegin(); aIt != myFacesList.cend(); ++aIt) {
- TopoDS_Shape aFace = (*aIt)->impl<TopoDS_Shape>();
- aBuilder.Add(aComp, aFace);
+ ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators();
+
+ QList<GeomShapePtr> aShapes;
+ std::list<AttributePtr> anAttributes = myFeature->data()->attributes("");
+ std::list<AttributePtr>::const_iterator anIt = anAttributes.begin(), aLast = anAttributes.end();
+ for (; anIt != aLast; anIt++) {
+ AttributePtr anAttribute = *anIt;
+ if (!isSelectionAttribute(anAttribute))
+ continue;
+
+ if (!aValidators->isCase(myFeature, anAttribute->id()))
+ continue; // this attribute is not participated in the current case
+
+ std::string anAttrType = anAttribute->attributeType();
+
+ if (anAttrType == ModelAPI_AttributeSelectionList::typeId()) {
+ std::shared_ptr<ModelAPI_AttributeSelectionList> aCurSelList =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(anAttribute);
+ for(int i = 0; i < aCurSelList->size(); i++) {
+ std::shared_ptr<ModelAPI_AttributeSelection> aSelAttribute = aCurSelList->value(i);
+ ResultPtr aResult = aSelAttribute->context();
+ GeomShapePtr aShape = aSelAttribute->value();
+ addValue(aResult, aShape, myFeature, theObjectShapes);
+ }
+ }
+ if (anAttrType == ModelAPI_AttributeRefList::typeId()) {
+ std::shared_ptr<ModelAPI_AttributeRefList> aCurSelList =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(anAttribute);
+ for (int i = 0; i < aCurSelList->size(); i++) {
+ GeomShapePtr aShape;
+ addValue(aCurSelList->object(i), aShape, myFeature, theObjectShapes);
+ }
+ }
+ else {
+ ObjectPtr anObject;
+ GeomShapePtr aShape;
+ if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) {
+ AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(anAttribute);
+ if (anAttr->isObject()) {
+ anObject = anAttr->object();
+ }
+ else {
+ aShape = PartSet_Tools::findShapeBy2DPoint(anAttr, myWorkshop);
+ // the distance point is not found if the point is selected in the 2nd time
+ // TODO: after debug, this check can be removed
+ if (!aShape.get())
+ continue;
+ anObject = anAttr->attr()->owner();
+ }
+ }
+ if (anAttrType == ModelAPI_AttributeSelection::typeId()) {
+ AttributeSelectionPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(anAttribute);
+ anObject = anAttr->context();
+ aShape = anAttr->value();