X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_Group.cpp;h=11f334f51922cf00be3712b150d2560a9f06f34a;hb=d3883990177d27a12b8a2278cdbb82250ff19b79;hp=41d5522f44a0196b70541bde542160eea8cbf730;hpb=561727ada1614fb2cf4b863b846cd9831344a616;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index 41d5522f4..11f334f51 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -236,12 +236,23 @@ bool SketchSolver_Group::changeConstraint( setTemporary(aConstraint); } } - //// Fix base features for mirror - //if (theConstraint->getKind() == SketchPlugin_ConstraintMirror::ID()) { - // AttributeRefListPtr aRefList = std::dynamic_pointer_cast( - // theConstraint->attribute(SketchPlugin_ConstraintMirror::ENTITY_B())); - // fixFeaturesList(aRefList); - //} + // Fix mirror line + if (theConstraint->getKind() == SketchPlugin_ConstraintMirror::ID()) { + AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast( + theConstraint->attribute(SketchPlugin_ConstraintMirror::ENTITY_A())); + if (aRefAttr && aRefAttr->isObject()) { + FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object()); + if (aFeature) { + SolverConstraintPtr aConstraint = + SketchSolver_Builder::getInstance()->createRigidConstraint(aFeature); + if (aConstraint) { + aConstraint->setGroup(this); + aConstraint->setStorage(myStorage); + setTemporary(aConstraint); + } + } + } + } if (!myFeatureStorage) myFeatureStorage = FeatureStoragePtr(new SketchSolver_FeatureStorage); @@ -274,7 +285,7 @@ void SketchSolver_Group::moveFeature(std::shared_ptr theFe { // Firstly, create temporary rigid constraint SolverConstraintPtr aConstraint = - SketchSolver_Builder::getInstance()->createRigidConstraint(theFeature); + SketchSolver_Builder::getInstance()->createMovementConstraint(theFeature); if (!aConstraint) return; aConstraint->setGroup(this); @@ -415,7 +426,7 @@ bool SketchSolver_Group::resolveConstraints() 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) @@ -566,7 +577,8 @@ bool SketchSolver_Group::isConsistent() void SketchSolver_Group::removeTemporaryConstraints() { myTempConstraints.clear(); - myStorage->removeTemporaryConstraints(); + while (myStorage->numberTemporary()) + myStorage->deleteTemporaryConstraint(); // Clean lists of removed entities in the storage std::set aRemPar; std::set aRemEnt;