- cleanErrorMsg();
- bool needToRebuild = (theConstraint && theConstraint != myBaseConstraint);
- if (!needToRebuild) {
- // Check the attrbutes of constraint are changed
- ConstraintPtr aConstraint = theConstraint ? theConstraint : myBaseConstraint;
- std::list<AttributePtr> anAttrList = aConstraint->data()->attributes(std::string());
- std::list<AttributePtr>::iterator anAttrIter = anAttrList.begin();
- for (; anAttrIter != anAttrList.end(); anAttrIter++) {
- AttributeRefAttrPtr aRefAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttrIter);
- if (aRefAttr) {
- if (aRefAttr->isObject()) {
- FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object());
- if (aFeature && myFeatureMap.find(aFeature) == myFeatureMap.end()) {
- needToRebuild = true;
- break;
+ std::set<Slvs_hEntity> aCurAttrs; // list of currently used attributes
+ std::vector<Slvs_hConstraint>::const_iterator aConstrIter = mySlvsConstraints.begin();
+ for (; aConstrIter != mySlvsConstraints.end(); aConstrIter++) {
+ Slvs_Constraint aConstr = myStorage->getConstraint(*aConstrIter);
+ if (aConstr.ptA != SLVS_E_UNKNOWN) aCurAttrs.insert(aConstr.ptA);
+ if (aConstr.ptB != SLVS_E_UNKNOWN) aCurAttrs.insert(aConstr.ptB);
+ if (aConstr.entityA != SLVS_E_UNKNOWN) aCurAttrs.insert(aConstr.entityA);
+ if (aConstr.entityB != SLVS_E_UNKNOWN) aCurAttrs.insert(aConstr.entityB);
+ if (aConstr.entityC != SLVS_E_UNKNOWN) aCurAttrs.insert(aConstr.entityC);
+ if (aConstr.entityD != SLVS_E_UNKNOWN) aCurAttrs.insert(aConstr.entityD);
+ }
+ // Check the attrbutes of constraint are changed
+ ConstraintPtr aConstraint = theConstraint ? theConstraint : myBaseConstraint;
+ std::list<AttributePtr> anAttrList = aConstraint->data()->attributes(std::string());
+ std::list<AttributePtr>::iterator anAttrIter = anAttrList.begin();
+ for (; anAttrIter != anAttrList.end(); anAttrIter++) {
+ AttributeRefAttrPtr aRefAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttrIter);
+ if (aRefAttr) {
+ if (aRefAttr->isObject()) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object());
+ std::map<FeaturePtr, Slvs_hEntity>::iterator aFIt = myFeatureMap.find(aFeature);
+ if (aFeature) {
+ if (aFIt == myFeatureMap.end())
+ return true;
+ // Additional check the points of entity
+ if (aCurAttrs.find(aFIt->second) == aCurAttrs.end()) {
+ Slvs_Entity anEntity = myStorage->getEntity(aFIt->second);
+ bool isFound = false;
+ for (int i = 0; i < 4 && !isFound; i++)
+ if (anEntity.point[i] != SLVS_E_UNKNOWN &&
+ aCurAttrs.find(anEntity.point[i]) != aCurAttrs.end())
+ isFound = true;
+ if (!isFound)
+ return true;