// extract feature from the group
if (theFeature->baseAttribute())
myStorage->update(theFeature->baseAttribute(), GID_OUTOFGROUP);
- else
+ else if (theFeature->baseFeature())
myStorage->update(theFeature->baseFeature(), GID_OUTOFGROUP);
}
for (; anOldIt != anOldSubs.end() && aNewIt != aNewSubs.end(); ++anOldIt, ++aNewIt) {
std::list<EntityWrapperPtr> aMovedSubs = movedEntities(
*anOldIt, theOldStorage, *aNewIt, theNewStorage);
- if (aMovedSubs.size() != 1 || aMovedSubs.front() != *anOldIt)
+ if ((*anOldIt)->type() == ENTITY_POINT && // check only the points to be moved (because arcs in PlaneGCS have scalar subs too)
+ (aMovedSubs.size() != 1 || aMovedSubs.front() != *anOldIt))
isFullyMoved = false;
aMoved.insert(aMoved.end(), aMovedSubs.begin(), aMovedSubs.end());
}
theAttributes.clear();
theAttributes.insert(theAttributes.begin(), aMoved.begin(), aMoved.end());
}
+
+bool SketchSolver_ConstraintMovement::remove()
+{
+ cleanErrorMsg();
+ // Move fixed entities back to the current group
+ std::vector<EntityWrapperPtr>::iterator aMoveIt = myMovedEntities.begin();
+ for (; aMoveIt != myMovedEntities.end(); ++aMoveIt) {
+ if ((*aMoveIt)->baseAttribute())
+ myStorage->update((*aMoveIt)->baseAttribute(), myGroupID);
+ else if ((*aMoveIt)->baseFeature())
+ myStorage->update((*aMoveIt)->baseFeature(), myGroupID);
+ }
+
+ // Remove base feature
+ if (myBaseFeature)
+ myStorage->removeEntity(myBaseFeature);
+ return true;
+}
: SketchSolver_ConstraintFixed(theFeature)
{}
+ /// \brief Tries to remove constraint
+ /// \return \c false, if current constraint contains another SketchPlugin constraints (like for multiple coincidence)
+ virtual bool remove();
+
protected:
/// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
virtual void process();
replaceInFeatures(theSlave, theMaster);
replaceInConstraints(theSlave, theMaster);
- // Remove slave entity
- removeEntity((Slvs_hEntity)theSlave->id());
+ // Remove slave entity (if the IDs are equal no need to remove slave entity, just update it)
+ if (theMaster->id() != theSlave->id())
+ removeEntity((Slvs_hEntity)theSlave->id());
std::shared_ptr<SolveSpaceSolver_EntityWrapper> aPointMaster =
std::dynamic_pointer_cast<SolveSpaceSolver_EntityWrapper>(theMaster);