- // Check the acceptability of the object and shape as validator attribute
- AttributePtr aPntAttr;
- DataPtr aData = myFeature->data();
- if (theShape.get() != NULL) {
- AttributePtr aAttr = aData->attribute(attributeID());
- AttributeRefAttrPtr aRefAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aAttr);
- if (aRefAttr) {
- TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
- aPntAttr = PartSet_Tools::findAttributeBy2dPoint(theObj, aShape, mySketch);
- }
- }
- // Check the acceptability of the object as attribute
- aValidator = aValidators.begin();
- std::list<std::list<std::string> >::iterator aArgs = anArguments.begin();
- for (; aValidator != aValidators.end(); aValidator++, aArgs++) {
- const ModelAPI_RefAttrValidator* aAttrValidator =
- dynamic_cast<const ModelAPI_RefAttrValidator*>(*aValidator);
- if (aAttrValidator) {
- if (aPntAttr.get() != NULL)
- {
- if (!aAttrValidator->isValid(myFeature, *aArgs, aPntAttr)) {
- return false;
- }
- }
- else
- {
- if (!aAttrValidator->isValid(myFeature, *aArgs, theObj)) {
- return false;
- }
- }
+//********************************************************************
+void PartSet_WidgetShapeSelector::removeExternal()
+{
+ if (myExternalObject.get()) {
+ DocumentPtr aDoc = myExternalObject->document();
+ FeaturePtr aFeature = ModelAPI_Feature::feature(myExternalObject);
+ if (aFeature.get() != NULL) {
+ QObjectPtrList anObjects;
+ anObjects.append(aFeature);
+ // the external feature should be removed with all references, sketch feature should be ignored
+ std::set<FeaturePtr> anIgnoredFeatures;
+ anIgnoredFeatures.insert(sketch());
+ XGUI_Workshop::deleteFeatures(anObjects, anIgnoredFeatures);