1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomValidators_BodyShapes.cpp
4 // Created: 21 December 2015
5 // Author: Dmitry Bobylev
7 #include "GeomValidators_BodyShapes.h"
9 #include <ModelAPI_AttributeSelectionList.h>
10 #include <ModelAPI_Object.h>
12 bool GeomValidators_BodyShapes::isValid(const AttributePtr& theAttribute,
13 const std::list<std::string>& theArguments,
14 std::string& theError) const
16 std::string anAttributeType = theAttribute->attributeType();
17 if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) {
18 AttributeSelectionListPtr aSelectionListAttr =
19 std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
20 // all context objects should not be sketch entities
21 for(int i = 0, aSize = aSelectionListAttr->size(); i < aSize; i++) {
22 AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i);
23 ObjectPtr anObject = aSelectAttr->context();
27 FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
28 std::string aFeatureKind = aFeature->getKind();
29 if(aFeatureKind == "Sketch") {