- AttributeReferencePtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
- if (anAttr.get() != NULL)
- aValid = isValidObject(anAttr->value(), theShapeType);
+ AttributeReferencePtr anAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
+ aValid = isValidObject(anAttr->value(), theShapeType, theError);
+ }
+ else if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) {
+ AttributeSelectionListPtr aListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
+ // the Empty value means that the attribute selection list is valid if it is empty
+ if (aListAttr->size() == 0 && theShapeType == Empty) {
+ return true;
+ }
+ aValid = false; // the list should have elements if the shape type is not Empty
+ for (int i = 0; i < aListAttr->size(); i++) {
+ aValid = isValidAttribute(aListAttr->value(i), theShapeType, theError);
+ if (!aValid) // if at least one attribute is invalid, the result is false
+ break;
+ }
+ }
+ else {
+ aValid = false;
+ theError = "The attribute with the " + anAttributeType + " type is not processed";