- if( theShapeType==Plane )
- {
- ResultConstructionPtr aResultConstruction =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theObject);
- FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
- const std::string& aKind = aFeature->getKind();
- return aResult.get() != NULL && aKind == "Plane";
- }
- if (!aResult.get()) {
- aValid = false;
- theError = "The result is empty";
- }
- else {
- aValid = isValidShape(aResult->shape(), theShapeType, theError);
+ if (aResult.get()) {
+ if (theShapeType == Plane)
+ {
+ ResultConstructionPtr aResultConstruction =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theObject);
+ FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+ const std::string& aKind = aFeature->getKind();
+ return aResult.get() != NULL && aKind == "Plane";
+ }
+ if (!aResult.get()) {
+ aValid = false;
+ theError = "The result is empty";
+ } else {
+ aValid = isValidShape(aResult->shape(), theShapeType, theIsGeometricalSelection, theError);
+ }
+ } else {
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
+ if (aFeature.get() && (theShapeType == CompSolid))
+ return aValid;
+ else {
+ aValid = false;
+ theError = "The feature has to produce a compsolid";
+ }