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>
11 #include <ModelAPI_ResultConstruction.h>
13 bool GeomValidators_BodyShapes::isValid(const AttributePtr& theAttribute,
14 const std::list<std::string>& theArguments,
15 std::string& theError) const
17 std::string anAttributeType = theAttribute->attributeType();
18 if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) {
19 AttributeSelectionListPtr aSelectionListAttr =
20 std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
21 // all context objects should not be sketch entities
22 for(int anIndex = 0, aSize = aSelectionListAttr->size(); anIndex < aSize; ++anIndex) {
23 AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(anIndex);
24 ResultPtr aContext = aSelectAttr->context();
26 theError = "Error: Context is empty.";
30 ResultConstructionPtr aResultConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
31 if(aResultConstruction.get()) {
32 theError = "Error: Result construction selected.";