+void ModelAPI_Feature::eraseResults()
+{
+ removeResults(0);
+}
+
+const std::string& ModelAPI_Feature::documentToAdd()
+{
+ // empty to use the current document
+ static const std::string anEmpty;
+ return anEmpty;
+}
+
+void ModelAPI_Feature::erase()
+{
+ // if this is the current feature, make the upper feature as current before removing
+ if (document().get() && document()->currentFeature(false).get() == this) {
+ document()->setCurrentFeatureUp();
+ }
+
+ static Events_Loop* aLoop = Events_Loop::loop();
+ static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+ static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
+
+ while (!myResults.empty()) { // remove one by one with messages
+ std::shared_ptr<ModelAPI_Result> aRes = *(myResults.begin());
+ aRes->setDisabled(aRes, true); // to avoid activation of the Part result
+ if (!myResults.empty()) // disabling result may erase the list (on undo of Part, issue 665)
+ myResults.erase(myResults.begin());
+ }
+ ModelAPI_Object::erase();
+}
+
+ModelAPI_Feature::~ModelAPI_Feature()
+{
+ erase();
+}
+