From ec9b85c536b6f28dde7433128827a11f07d3e956 Mon Sep 17 00:00:00 2001 From: dbv Date: Fri, 4 Sep 2015 09:52:27 +0300 Subject: [PATCH] Added sketch attribute selection for composite features --- src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp | 6 ++++++ src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp index 147efefd8..14a4c19d7 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include #include @@ -28,6 +30,9 @@ void FeaturesPlugin_CompositeBoolean::initAttributes() aSelection->setSelectionType("SOLID"); initMakeSolidsAttributes(); + + data()->addAttribute(SKETCH_SELECTION_ID(), ModelAPI_AttributeSelection::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SKETCH_SELECTION_ID()); } //================================================================================================= @@ -111,6 +116,7 @@ void FeaturesPlugin_CompositeBoolean::execute() if(!aConstruction.get()) { return; } + selection(SKETCH_SELECTION_ID())->setValue(aSketchRes, std::shared_ptr()); int aSketchFacesNum = aConstruction->facesNum(); if(aSketchFacesNum == 0) { return; diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h index d5ce37c38..4150d3af6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h @@ -26,6 +26,13 @@ class FeaturesPlugin_CompositeBoolean : public ModelAPI_CompositeFeature return MY_SKETCH_OBJECT_ID; } + /// Attribute name of sketch feature. + inline static const std::string& SKETCH_SELECTION_ID() + { + static const std::string MY_SKETCH_SELECTION_ID("sketch_selection"); + return MY_SKETCH_SELECTION_ID; + } + /// Attribute name of objects for boolean operation. inline static const std::string& BOOLEAN_OBJECTS_ID() { -- 2.39.2