return false;
}
+ /// remove objects of sub-type if ojects of correct type is in List, in some cases :
+ /// Wire builder: wires and edges selected
+ std::set<GeomAPI_Shape::ShapeType> shapeTypes;
+ for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
+ AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
+ GeomShapePtr aShape = aSelection->value();
+ if (aShape.get())
+ shapeTypes.insert(aShape->shapeType());
+ }
+
+ std::set<int> aRemove;
+ if (shapeTypes.find(GeomAPI_Shape::WIRE) != shapeTypes.end())
+ {
+ for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
+ AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
+ GeomShapePtr aShape = aSelection->value();
+ if (aShape.get()) {
+ auto aType = aShape->shapeType();
+ if (aType == GeomAPI_Shape::EDGE)
+ aRemove.insert(anIndex);
+ }
+ else
+ aRemove.insert(anIndex);
+ }
+ }
+
+ if (aRemove.size() > 0)
+ aSelectionList->remove(aRemove);
+
GeomAPI_Shape::ShapeType aShapeType = GeomAPI_Shape::shapeTypeByStr(theArguments.back());
// Collect base shapes.
return false;
}
+ /// remove objects of sub-type if ojects of correct type is in List, in some cases :
+ /// - Face builder: edges, faces and wires selected
+ /// --> remove edges and wires
+ std::set<GeomAPI_Shape::ShapeType> shapeTypes;
+ for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
+ AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
+ GeomShapePtr aShape = aSelection->value();
+ if (aShape.get())
+ shapeTypes.insert(aShape->shapeType());
+ }
+
+ std::set<int> aRemove;
+ if (shapeTypes.find(GeomAPI_Shape::FACE) != shapeTypes.end())
+ {
+ for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
+ AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
+ GeomShapePtr aShape = aSelection->value();
+ if (aShape.get()) {
+ auto aType = aShape->shapeType();
+ if (aType == GeomAPI_Shape::WIRE || aType == GeomAPI_Shape::EDGE)
+ aRemove.insert(anIndex);
+ }
+ else
+ aRemove.insert(anIndex);
+ }
+ }
+ if (aRemove.size() > 0)
+ aSelectionList->remove(aRemove);
+
bool hasEdgesOrWires = false;
bool hasFaces = false;
return false;
}
+ /// remove objects of sub-type if ojects of correct type is in List, in some cases :
+ /// Solid builder: faces and shapes shells or solids seleted
+ /// --> remove faces
+
+ std::set<GeomAPI_Shape::ShapeType> shapeTypes;
+ for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
+ AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
+ GeomShapePtr aShape = aSelection->value();
+ if (aShape.get())
+ shapeTypes.insert(aShape->shapeType());
+ }
+
+ std::set<int> aRemove;
+ if (shapeTypes.find(GeomAPI_Shape::SHAPE) != shapeTypes.end() ||
+ shapeTypes.find(GeomAPI_Shape::SOLID) != shapeTypes.end() ||
+ shapeTypes.find(GeomAPI_Shape::SHELL) != shapeTypes.end())
+ {
+ for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
+ AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
+ GeomShapePtr aShape = aSelection->value();
+ if (aShape.get()) {
+ auto aType = aShape->shapeType();
+ if (aType == GeomAPI_Shape::FACE)
+ aRemove.insert(anIndex);
+ }
+ else
+ aRemove.insert(anIndex);
+ }
+ }
+
+ if (aRemove.size() > 0)
+ aSelectionList->remove(aRemove);
+
// Collect base shapes.
ListOfShape anOriginalShapes;
for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {