]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Added sketch attribute selection for composite features
authordbv <dbv@opencascade.com>
Fri, 4 Sep 2015 06:52:27 +0000 (09:52 +0300)
committerdbv <dbv@opencascade.com>
Fri, 4 Sep 2015 06:52:40 +0000 (09:52 +0300)
src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h

index 147efefd8d7359b48c72444f5f70a765c3770e55..14a4c19d7eaa48702ea9693634c11372be20688f 100644 (file)
@@ -11,6 +11,8 @@
 #include <ModelAPI_BodyBuilder.h>
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Validator.h>
 
 #include <GeomAlgoAPI_CompoundBuilder.h>
 #include <GeomAlgoAPI_Prism.h>
@@ -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<GeomAPI_Shape>());
   int aSketchFacesNum = aConstruction->facesNum();
   if(aSketchFacesNum == 0) {
     return;
index d5ce37c380d72f4bc1b2e4caf481e22718a1d6d5..4150d3af6c7001bf9845c1ebef71cbbc9b77e2db 100644 (file)
@@ -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()
   {