Fix the validator to be able to select sketch vertices and edges for extrusion and revolution.
// Initialize selection list.
if(theInitFlags & InitBaseObjectsList) {
data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId());
+ myCurrentSelectionType = selectionList(BASE_OBJECTS_ID())->selectionType();
}
}
}
}
}
+
+//=================================================================================================
+void FeaturesPlugin_CompositeSketch::attributeChanged(const std::string& theID)
+{
+ if (theID == BASE_OBJECTS_ID()) {
+ AttributeSelectionListPtr anObjects = selectionList(BASE_OBJECTS_ID());
+ if (anObjects->size() == 0 || anObjects->selectionType() != myCurrentSelectionType) {
+ myCurrentSelectionType = anObjects->selectionType();
+ removeResults(0); // clear the results
+ }
+ }
+}
/// structures of the owner (the remove from the document will be done outside just after).
FEATURESPLUGIN_EXPORT virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
+ /// On change of attribute of the result update presentation of this result:
+ /// for the current moment there are only presentation attributes assigned to results
+ FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
+
protected:
enum InitFlags {
InitSketchLauncher = 1 << 0,
const ListOfShape& theShapes,
const std::string theName);
+private:
+ std::string myCurrentSelectionType; //< type of selection (vertex, edge or face)
};
#endif
if(aConstruction->facesNum() > 0) {
return true;
}
- } else {
- // Shape on construction selected. Check that it is a face or wire.
- if(aShape->shapeType() == GeomAPI_Shape::WIRE ||
- aShape->shapeType() == GeomAPI_Shape::FACE) {
- return true;
- }
}
- return false;
}
if(aContextShape.get() && !aShape->isEqual(aContextShape)) {
default_type = "2"
use_choice="true"
concealment="true">
- <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face"/>
+ <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
</multi_selector>
<shape_selector id="direction_object"
icon="icons/Features/axis.png"