- // Do not add point-point coincidence, because it is already made by setting
- // the same parameters for both points
- if (!theSolverConstraints.empty() &&
- theSolverConstraints.front()->type() != CONSTRAINT_PT_PT_COINCIDENT) {
+ if (theSolverConstraints.empty()) {
+ // constraint links to the empty list, add its attributes linked to the empty entities
+ std::list<AttributePtr> aRefAttrs =
+ theConstraint->data()->attributes(ModelAPI_AttributeRefAttr::typeId());
+ std::list<AttributePtr>::const_iterator anAttrIt = aRefAttrs.begin();
+ for (; anAttrIt != aRefAttrs.end(); ++anAttrIt) {
+ AttributeRefAttrPtr aRef = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttrIt);
+ if (aRef->isObject()) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
+ if (aFeature) addEntity(aFeature, EntityWrapperPtr());
+ } else
+ addEntity(aRef->attr(), EntityWrapperPtr());
+ }
+ std::list<AttributePtr> aRefLists =
+ theConstraint->data()->attributes(ModelAPI_AttributeRefList::typeId());
+ for (anAttrIt = aRefLists.begin(); anAttrIt != aRefLists.end(); ++anAttrIt) {
+ AttributeRefListPtr aRef = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(*anAttrIt);
+ std::list<ObjectPtr> anObj = aRef->list();
+ std::list<ObjectPtr>::iterator anIt = anObj.begin();
+ for (; anIt != anObj.end(); ++anIt) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
+ if (aFeature) addEntity(aFeature, EntityWrapperPtr());
+ }
+ }
+ }
+ else if (theSolverConstraints.front()->type() != CONSTRAINT_PT_PT_COINCIDENT) {
+ // Do not add point-point coincidence, because it is already made by setting
+ // the same parameters for both points