X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_ConstraintMulti.cpp;h=a86ab8b5fbd51731f26d30fdade40e31a67a402d;hb=4f565b2204d3fba046aa8c851abada2a5a17bf6c;hp=df18477ed2a034f9d7f4e5814a9a154ffa52974d;hpb=b50f8f57fc0aa336a30b773dedeb766774d3a1b7;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_ConstraintMulti.cpp b/src/SketchSolver/SketchSolver_ConstraintMulti.cpp index df18477ed..a86ab8b5f 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMulti.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMulti.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + #include #include #include @@ -35,7 +37,8 @@ void SketchSolver_ConstraintMulti::getEntities(std::list& theE FeaturePtr aFeature; std::list anObjectList = aRefList->list(); std::list::iterator anObjIt = anObjectList.begin(); - if ((myNumberOfCopies + 1) * myNumberOfObjects != aRefList->size()) // execute for the feature is not called yet + // execute for the feature is not called yet + if ((myNumberOfCopies + 1) * myNumberOfObjects != aRefList->size()) myNumberOfCopies = aRefList->size() / myNumberOfObjects - 1; while (anObjIt != anObjectList.end()) { @@ -43,7 +46,8 @@ void SketchSolver_ConstraintMulti::getEntities(std::list& theE if (!aFeature) continue; - if (!myStorage->update(aFeature)) // the entity is not created, so it is a copy in "multi" constraint, force its creation + // the entity is not created, so it is a copy in "multi" constraint, force its creation + if (!myStorage->update(aFeature)) myStorage->update(aFeature, myGroupID, true); theEntities.push_back(myStorage->entity(aFeature)); myFeatures.insert(aFeature); @@ -73,7 +77,10 @@ void SketchSolver_ConstraintMulti::update(bool isForce) AttributeRefListPtr anInitialRefList = std::dynamic_pointer_cast( myBaseConstraint->attribute(SketchPlugin_Constraint::ENTITY_A())); AttributeIntegerPtr aNbObjects = myBaseConstraint->integer(nameNbObjects()); - bool isUpdated= anInitialRefList->size() != myNumberOfObjects || aNbObjects->value()-1 != myNumberOfCopies; + if (!anInitialRefList || !aNbObjects) + return; // the "Multi" constraint is in queue to remove + bool isUpdated = + anInitialRefList->size() != myNumberOfObjects || aNbObjects->value()-1 != myNumberOfCopies; if (!isUpdated) { // additional check that the features and their copies are changed AttributeRefListPtr aRefList = std::dynamic_pointer_cast( @@ -154,8 +161,9 @@ void SketchSolver_ConstraintMulti::adjustConstraint() continue; anEntity = myStorage->entity(aFeature); + bool aWasBlocked = false; if (!anEntity || !myStorage->isEventsBlocked()) - aFeature->data()->blockSendAttributeUpdated(true); + aWasBlocked = aFeature->data()->blockSendAttributeUpdated(true); std::list aPoints; if (aFeature->getKind() == SketchPlugin_Arc::ID()) { @@ -196,7 +204,7 @@ void SketchSolver_ConstraintMulti::adjustConstraint() } if (!anEntity || !myStorage->isEventsBlocked()) - aFeature->data()->blockSendAttributeUpdated(false); + aFeature->data()->blockSendAttributeUpdated(aWasBlocked); } }