theConstraint->attribute(SketchPlugin_ConstraintMirror::ENTITY_A()));
if (aRefAttr && aRefAttr->isObject()) {
FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object());
- SolverConstraintPtr aConstraint =
- SketchSolver_Builder::getInstance()->createRigidConstraint(aFeature);
- if (aConstraint) {
- aConstraint->setGroup(this);
- aConstraint->setStorage(myStorage);
- setTemporary(aConstraint);
+ if (aFeature) {
+ SolverConstraintPtr aConstraint =
+ SketchSolver_Builder::getInstance()->createRigidConstraint(aFeature);
+ if (aConstraint) {
+ aConstraint->setGroup(this);
+ aConstraint->setStorage(myStorage);
+ setTemporary(aConstraint);
+ }
}
}
}
else {
// To avoid overconstraint situation, we will remove temporary constraints one-by-one
// and try to find the case without overconstraint
- int aNbTemp = (int)myTempConstraints.size();
+ int aNbTemp = myStorage->numberTemporary();
while (true) {
aResult = myConstrSolver.solve();
if (aResult == SLVS_RESULT_OKAY || aNbTemp <= 0)
void SketchSolver_Group::removeTemporaryConstraints()
{
myTempConstraints.clear();
- myStorage->removeTemporaryConstraints();
+ while (myStorage->numberTemporary())
+ myStorage->deleteTemporaryConstraint();
// Clean lists of removed entities in the storage
std::set<Slvs_hParam> aRemPar;
std::set<Slvs_hEntity> aRemEnt;