aCompSolidsObjects[aContextShape].push_back(anObject);
}
} else {
- if(anObject->shapeType() == GeomAPI_Shape::EDGE ||
- anObject->shapeType() == GeomAPI_Shape::FACE) {
+ if(aType != BOOL_FILL
+ && (anObject->shapeType() == GeomAPI_Shape::EDGE
+ || anObject->shapeType() == GeomAPI_Shape::FACE))
+ {
anEdgesAndFaces.push_back(anObject);
- } else {
+ }
+ else
+ {
anObjects.push_back(anObject);
}
}
// It could be a construction plane.
ResultPtr aContext = aToolAttr->context();
aPlanes.push_back(aToolAttr->context()->shape());
- } else if(aTool->shapeType() == GeomAPI_Shape::EDGE ||
- aTool->shapeType() == GeomAPI_Shape::FACE) {
+ }
+ else if(aType != BOOL_FILL
+ && (aTool->shapeType() == GeomAPI_Shape::EDGE
+ || aTool->shapeType() == GeomAPI_Shape::FACE))
+ {
anEdgesAndFaces.push_back(aTool);
} else {
aTools.push_back(aTool);
return false;
}
- int aShapeType = aShape->shapeType();
+ GeomAPI_Shape::ShapeType aShapeType = aShape->shapeType();
+ std::set<GeomAPI_Shape::ShapeType> anAllowedTypes;
if(anOperationType == FeaturesPlugin_Boolean::BOOL_FUSE) {
- // Fuse operation. Allow to select edges, faces and solids.
- if(aShapeType != GeomAPI_Shape::EDGE &&
- aShapeType != GeomAPI_Shape::FACE &&
- aShapeType != GeomAPI_Shape::SOLID &&
- aShapeType != GeomAPI_Shape::COMPSOLID &&
- aShapeType != GeomAPI_Shape::COMPOUND) {
- theError = "Error: Selected shape has the wrong type.";
- return false;
- }
+ anAllowedTypes.insert(GeomAPI_Shape::EDGE);
+ anAllowedTypes.insert(GeomAPI_Shape::FACE);
+ anAllowedTypes.insert(GeomAPI_Shape::SOLID);
+ anAllowedTypes.insert(GeomAPI_Shape::COMPSOLID);
+ anAllowedTypes.insert(GeomAPI_Shape::COMPOUND);
} else if (anOperationType == FeaturesPlugin_Boolean::BOOL_FILL) {
- if(aShapeType != GeomAPI_Shape::FACE &&
- aShapeType != GeomAPI_Shape::SOLID &&
- aShapeType != GeomAPI_Shape::COMPSOLID &&
- aShapeType != GeomAPI_Shape::COMPOUND) {
- theError = "Error: Selected shape has the wrong type.";
- return false;
- }
+ anAllowedTypes.insert(GeomAPI_Shape::VERTEX);
+ anAllowedTypes.insert(GeomAPI_Shape::EDGE);
+ anAllowedTypes.insert(GeomAPI_Shape::WIRE);
+ anAllowedTypes.insert(GeomAPI_Shape::FACE);
+ anAllowedTypes.insert(GeomAPI_Shape::SHELL);
+ anAllowedTypes.insert(GeomAPI_Shape::SOLID);
+ anAllowedTypes.insert(GeomAPI_Shape::COMPSOLID);
+ anAllowedTypes.insert(GeomAPI_Shape::COMPOUND);
} else {
- if(aShapeType != GeomAPI_Shape::SOLID &&
- aShapeType != GeomAPI_Shape::COMPSOLID &&
- aShapeType != GeomAPI_Shape::COMPOUND) {
- theError = "Error: Selected shape has the wrong type.";
- return false;
- }
+ anAllowedTypes.insert(GeomAPI_Shape::SOLID);
+ anAllowedTypes.insert(GeomAPI_Shape::COMPSOLID);
+ anAllowedTypes.insert(GeomAPI_Shape::COMPOUND);
}
+
+ if(anAllowedTypes.find(aShapeType) == anAllowedTypes.end()
+ || (aResultConstruction.get() && aShapeType != GeomAPI_Shape::FACE)) {
+ theError = "Error: Selected shape has the wrong type.";
+ return false;
+ }
+
}
return true;