#include <ModelAPI_Events.h>
#include <ModelAPI_Validator.h>
#include <ModelAPI_Session.h>
+#include <ModelAPI_Tools.h>
#include <GeomAPI_Ax2.h>
#include <GeomAPI_Circ2d.h>
// Remove all obtained constraints which use current arc, because
// there is no information which of them were used to build tangency arc.
DocumentPtr aDoc = sketch()->document();
+ std::set<FeaturePtr> aFeaturesToBeRemoved;
for (aCIt = aCoincidence.begin(); aCIt != aCoincidence.end(); ++aCIt)
- aDoc->removeFeature(*aCIt);
+ aFeaturesToBeRemoved.insert(*aCIt);
for (aTIt = aTangency.begin(); aTIt != aTangency.end(); ++aTIt)
- aDoc->removeFeature(*aTIt);
+ aFeaturesToBeRemoved.insert(*aTIt);
+ ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToBeRemoved);
// Send events to update the sub-features by the solver.
if (isDeleteFlushed)
Events_Loop::loop()->setFlushed(aDeleteEvent, true);
#include <ModelAPI_Events.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
+#include <ModelAPI_Tools.h>
#include <SketchPlugin_Line.h>
#include <SketchPlugin_Sketch.h>
std::list<ObjectPtr>::iterator anInitIter = anInitialList.begin();
std::list<ObjectPtr>::iterator aMirrorIter = aMirroredList.begin();
std::vector<bool>::iterator aUsedIter = isUsed.begin();
+ std::set<FeaturePtr> aFeaturesToBeRemoved;
for (; aUsedIter != isUsed.end(); aUsedIter++) {
if (!(*aUsedIter)) {
aRefListOfShapes->remove(*anInitIter);
DocumentPtr aDoc = aRC ? aRC->document() : DocumentPtr();
FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr();
if (aFeature)
- aDoc->removeFeature(aFeature);
+ aFeaturesToBeRemoved.insert(aFeature);
}
}
if (anInitIter != anInitialList.end())
if (aMirrorIter != aMirroredList.end())
aMirrorIter++;
}
+ ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToBeRemoved);
static Events_ID aRedisplayEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY);
FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr();
if (aFeature)
aFeaturesToBeRemoved.insert(aFeature);
- //aDoc->removeFeature(aFeature);
}
} else {
for (int i = 0; i <= aNbCopies && aTargetIter != aTargetList.end(); i++)
FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr();
if (aFeature)
aFeaturesToBeRemoved.insert(aFeature);
- //aDoc->removeFeature(aFeature);
}
ind++;
}
FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr();
if (aFeature)
aFeaturesToBeRemoved.insert(aFeature);
- //aDoc->removeFeature(aFeature);
}
}
ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToBeRemoved);
#include <ModelAPI_Events.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
+#include <ModelAPI_Tools.h>
#include <SketchPlugin_SketchEntity.h>
#include <SketcherPrs_Factory.h>
std::list<ObjectPtr>::iterator anInitIter = anInitialList.begin();
std::list<ObjectPtr>::iterator aTargetIter = aTargetList.begin();
std::vector<bool>::iterator aUsedIter = isUsed.begin();
+ std::set<FeaturePtr> aFeaturesToBeRemoved;
for (; aUsedIter != isUsed.end(); aUsedIter++) {
if (!(*aUsedIter)) {
aRefListOfShapes->remove(*anInitIter);
DocumentPtr aDoc = aRC ? aRC->document() : DocumentPtr();
FeaturePtr aFeature = aDoc ? aDoc->feature(aRC) : FeaturePtr();
if (aFeature)
- aDoc->removeFeature(aFeature);
+ aFeaturesToBeRemoved.insert(aFeature);
}
} else {
for (int i = 0; i <= aNbCopies && aTargetIter != aTargetList.end(); i++)
if (anInitIter != anInitialList.end())
anInitIter++;
}
+ ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToBeRemoved);
// change number of copies
if (aCurrentNbCopies != 0 && aNbCopies != aCurrentNbCopies) {
bool isAdd = aNbCopies > aCurrentNbCopies;
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
+#include <ModelAPI_Tools.h>
#include <GeomAPI_Circ.h>
#include <GeomAPI_Edge.h>
(anEdge->isCircle() && aProjection->getKind() != SketchPlugin_Circle::ID()) ||
(anEdge->isArc() && aProjection->getKind() != SketchPlugin_Arc::ID())) {
DocumentPtr aDoc = sketch()->document();
- aDoc->removeFeature(aProjection);
+
+ std::set<FeaturePtr> aFeaturesToBeRemoved;
+ aFeaturesToBeRemoved.insert(aProjection);
+ ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToBeRemoved);
aProjection = FeaturePtr();
aRefAttr->setObject(aProjection);
}