// Workaround to process arcs.
// When move unconstrained arc, add temporary constraint to fix radius.
if (theFeature->getKind() == SketchPlugin_Arc::ID()) {
+ bool hasDup = myStorage->hasDuplicatedConstraint();
SolverConstraintPtr aFixedRadius = aBuilder->createFixedArcRadiusConstraint(theFeature);
if (aFixedRadius) {
aFixedRadius->process(myStorage, getId(), getWorkplaneId());
- if (aFixedRadius->error().empty())
+ hasDup = myStorage->hasDuplicatedConstraint() && !hasDup;
+ if (aFixedRadius->error().empty() && !hasDup)
setTemporary(aFixedRadius);
+ else
+ aFixedRadius->remove();
}
}
}
myConstraints.erase(myConstraints.begin() + aPos);
myConstrMaxID = myConstraints.empty() ? SLVS_E_UNKNOWN : myConstraints.back().h;
myNeedToResolve = true;
+
+ if (myDuplicatedConstraint) {
+ // Find a constraint with same type uses same arguments
+ std::vector<Slvs_Constraint>::iterator aCIt = myConstraints.begin();
+ for (; aCIt != myConstraints.end(); aCIt++) {
+ if (aConstraint.type != aCIt->type)
+ continue;
+ if (aConstraint.ptA == aCIt->ptA && aConstraint.ptB == aCIt->ptB &&
+ aConstraint.entityA == aCIt->entityA && aConstraint.entityB == aCIt->entityB &&
+ aConstraint.entityC == aCIt->entityC && aConstraint.entityD == aCIt->entityD) {
+ myDuplicatedConstraint = false;
+ break;
+ }
+ }
+ }
}
return true;
}