+ else if (anEventID == Events_Loop::eventByName(EVENT_REMOVE_CONSTRAINTS)) {
+ std::shared_ptr<ModelAPI_CheckConstraintsMessage> aConstraintsMsg =
+ std::dynamic_pointer_cast<ModelAPI_CheckConstraintsMessage>(theMessage);
+ if (aConstraintsMsg.get()) {
+ myObjectsToRemove = aConstraintsMsg->constraints();
+
+ std::set<ObjectPtr>::const_iterator anIt = myObjectsToRemove.begin();
+
+ PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
+
+ for (; anIt != myObjectsToRemove.end(); )
+ {
+ ObjectPtr anObject = *anIt;
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
+ std::string aType = aFeature->getKind();
+ if ((aType == SketchPlugin_ConstraintHorizontal::ID() ||
+ aType == SketchPlugin_ConstraintVertical::ID()) &&
+ !aModule->sketchReentranceMgr()->isLastAutoConstraint(*anIt))
+ anIt = myObjectsToRemove.erase(anIt);
+ else
+ anIt++;
+ }