- if (anAttributeType == ModelAPI_AttributeRefList::typeId()) {
- AttributeRefListPtr aRefListAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
- // all context objects should be sketch entities
- for (int i = 0, aSize = aRefListAttr->size(); i < aSize && isSketchEntities; i++) {
- ObjectPtr anObject = aRefListAttr->object(i);
- // a context of the selection attribute is a feature result. It can be a case when the result
- // of the feature is null, e.g. the feature is modified and has not been executed yet.
- // The validator returns an invalid result here. The case is an extrusion built on a sketch
- // feature. A new sketch element creation leads to an empty result.
- if (!anObject.get())
- isSketchEntities = false;
- else {
- FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
- isSketchEntities = anEntityKinds.find(aFeature->getKind()) != anEntityKinds.end();
- }
- }
- }
- if (anAttributeType == ModelAPI_AttributeRefAttr::typeId()) {
- std::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
- std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
- isSketchEntities = false;
- if (aRef->isObject()) {
- ObjectPtr anObject = aRef->object();
- if (anObject.get() != NULL) {
- FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
- if (aFeature.get() != NULL)
- isSketchEntities = anEntityKinds.find(aFeature->getKind()) != anEntityKinds.end();
- }
- }
- }