]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1343 Improvement of Extrusion and Revolution operations: removeFeature is...
authornds <nds@opencascade.com>
Thu, 24 Mar 2016 08:49:22 +0000 (11:49 +0300)
committerdbv <dbv@opencascade.com>
Fri, 25 Mar 2016 15:50:20 +0000 (18:50 +0300)
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp
src/FeaturesPlugin/plugin-Features.xml
src/FeaturesPlugin/revolution_widget.xml
src/GeomValidators/GeomValidators_FeatureKind.cpp
src/PartSet/PartSet_WidgetSketchCreator.cpp

index 3d8ce83ef4473825baaffd406a6ac879419bf2cd..57a711e0ccc2d1598eed7cc25585c05883bf901f 100644 (file)
@@ -88,6 +88,8 @@ void FeaturesPlugin_CompositeSketch::removeFeature(std::shared_ptr<ModelAPI_Feat
   AttributeSelectionListPtr aFacesSelectionList = selectionList(LIST_ID());
   if (aFacesSelectionList.get() && aFacesSelectionList->size() > 0)
     aFacesSelectionList->clear();
+
+  data()->reference(SKETCH_OBJECT_ID())->setValue(ObjectPtr());
 }
 
 //=================================================================================================
index fe897b2a54feeeddf7b7f77bc275f7bd09fa8625..9f5cbd74ecf8cb765ff59b8d0c8000d575693267 100644 (file)
@@ -6,9 +6,9 @@
       <feature id="Extrusion" title="Extrusion" tooltip="Create a solid by extrusion of a face" icon=":icons/extrusion.png">
           <source path="extrusion_widget.xml"/>
       </feature>
-      <feature id="ExtrusionSketch" title="ExtrusionSketch" tooltip="Create a solids by extrusion of a sketch" icon=":icons/extrusionsketch.png">
+      <!--<feature id="ExtrusionSketch" title="ExtrusionSketch" tooltip="Create a solids by extrusion of a sketch" icon=":icons/extrusionsketch.png">
           <source path="extrusionsketch_widget.xml"/>
-      </feature>
+      </feature>-->
       <feature id="ExtrusionCut" title="ExtrusionCut" tooltip="" icon=":icons/extrusion_cut.png">
         <source path="extrusioncut_widget.xml"/>
       </feature>
@@ -20,9 +20,9 @@
       <feature id="Revolution" title="Revolution" tooltip="Create a solid by revolution of a face" icon=":icons/revol.png">
           <source path="revolution_widget.xml"/>
       </feature>
-      <feature id="RevolutionSketch" title="RevolutionSketch" tooltip="Create a solids by revolution of a sketch" icon=":icons/revolsketch.png">
+      <!--<feature id="RevolutionSketch" title="RevolutionSketch" tooltip="Create a solids by revolution of a sketch" icon=":icons/revolsketch.png">
           <source path="revolutionsketch_widget.xml"/>
-      </feature>
+      </feature>-->
       <feature id="RevolutionCut" title="RevolutionCut" tooltip="" icon=":icons/revol_cut.png">
         <source path="revolutioncut_widget.xml"/>
       </feature>
index 73ed217c7126c7ab06fd3d97e1d985c1756967e5..a7a5b82d2c2d2ae77809ad42605f5231fe4a52b2 100644 (file)
   </composite_multi_selector>
   <toolbox id="CreationMethod">
     <box id="ByAngles" title="By angles" icon=":icons/angle_up_down_32x32.png">
-      <multi_selector id="base"
-        label="Select a sketch face"
-        icon=":icons/sketch.png"
-        tooltip="Select a sketch face"
-        type_choice="Faces">
-        <validator id="GeomValidators_FeatureKind" parameters="Sketch"/>
-      </multi_selector>
       <shape_selector id="axis_object"
                       icon=":icons/axis.png"
                       label="Axis"
       </groupbox>
     </box>
     <box id="ByPlanesAndOffsets" title="By bounding planes and angles" icon=":icons/plane_inverted_32x32.png">
-      <multi_selector id="base"
-        label="Select a sketch face"
-        icon=":icons/sketch.png"
-        tooltip="Select a sketch face"
-        type_choice="Faces">
-        <validator id="GeomValidators_FeatureKind" parameters="Sketch"/>
-      </multi_selector>
       <shape_selector id="axis_object"
                       icon=":icons/axis.png"
                       label="Axis"
index edf205f05874a1709037a78aaaa53f8be654db91..3ae8200825ad8bfc31ff61b7f77099efd3d6eeb9 100755 (executable)
@@ -11,7 +11,7 @@
 #include <ModelAPI_AttributeRefAttr.h>
 #include <ModelAPI_Object.h>
 
-//#define DEBUG_EXTRUSION_INVALID_SKETCH
+#define DEBUG_EXTRUSION_INVALID_SKETCH
 #ifdef DEBUG_EXTRUSION_INVALID_SKETCH
   #include <ModelAPI_CompositeFeature.h>
 #endif
index 8243a253a5bf6914138b351b50cff65f4686cd68..2c44b55fdf64a77e1384f4496a39014ef0cd158c 100644 (file)
@@ -202,8 +202,6 @@ bool PartSet_WidgetSketchCreator::canCommitCurrentSketch(ModuleBase_IWorkshop* t
       if (!aIsOp)
         aMgr->startOperation();
       aPCompositeFeature->execute(); // to fill attribute selection list
-      if (!aIsOp)
-        aMgr->finishOperation();
 
       std::list<AttributePtr> aSelListAttributes = aParentFeature->data()->attributes(
                                                         ModelAPI_AttributeSelectionList::typeId());
@@ -226,6 +224,12 @@ bool PartSet_WidgetSketchCreator::canCommitCurrentSketch(ModuleBase_IWorkshop* t
             aCanCommit = false;
         }
       }
+      if (!aIsOp) {
+        if (aCanCommit)
+          aMgr->finishOperation();
+        else
+          aMgr->abortOperation();
+      }
     }
   }
   return aCanCommit;
@@ -383,49 +387,48 @@ void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation* theOp)
 
       // do nothing, selection control should be shown
       activateSelectionControl();
-      return;
-    }
-    // do nothing, selection control should be hidden
-    setVisibleSelectionControl(false);
-    // Update value in attribute selection list
-    XGUI_PropertyPanel* aPanel = aWorkshop->propertyPanel();
-    const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
-    foreach(ModuleBase_ModelWidget* aWidget, aWidgets) {
-      if (aWidget->attributeID() == myAttributeListID)
-        aWidget->restoreValue();
-    }
-
-    // Hide sketcher result
-    CompositeFeaturePtr aSketchFeature = 
-      std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCompFeature->subFeature(0));
-    std::list<ResultPtr> aResults = aSketchFeature->results();
-    std::list<ResultPtr>::const_iterator aIt;
-    for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
-      (*aIt)->setDisplayed(false);
     }
-    aSketchFeature->setDisplayed(false);
-
-    // restore value in the selection control
-
+    else {
+      setVisibleSelectionControl(false);
+      // Update value in attribute selection list
+      XGUI_PropertyPanel* aPanel = aWorkshop->propertyPanel();
+      const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
+      foreach(ModuleBase_ModelWidget* aWidget, aWidgets) {
+        if (aWidget->attributeID() == myAttributeListID)
+          aWidget->restoreValue();
+      }
 
-    // Add Selected body were created the sketcher to list of selected objects
-    std::string anObjectsAttribute = FeaturesPlugin_CompositeBoolean::BOOLEAN_OBJECTS_ID();
-    AttributeSelectionListPtr aSelList = aCompFeature->data()->selectionList(anObjectsAttribute);
-    if (aSelList.get()) {
-      DataPtr aData = aSketchFeature->data();
-      AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
-                                    (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
-      ResultPtr aRes = aSelAttr.get() ? aSelAttr->context() : ResultPtr();
-      if (aRes.get()) {
-        SessionPtr aMgr = ModelAPI_Session::get();
-        ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
-        AttributePtr anAttribute = myFeature->attribute(anObjectsAttribute);
-        std::string aValidatorID, anError;
-        aSelList->append(aRes, GeomShapePtr());
-        if (aFactory->validate(anAttribute, aValidatorID, anError))
-          updateObject(aCompFeature);
-        else
-          aSelList->clear();
+      // Hide sketcher result
+      CompositeFeaturePtr aSketchFeature = 
+        std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCompFeature->subFeature(0));
+      std::list<ResultPtr> aResults = aSketchFeature->results();
+      std::list<ResultPtr>::const_iterator aIt;
+      for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
+        (*aIt)->setDisplayed(false);
+      }
+      aSketchFeature->setDisplayed(false);
+      static Events_Loop* aLoop = Events_Loop::loop();
+      aLoop->flush(aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+
+      // Add Selected body were created the sketcher to list of selected objects
+      std::string anObjectsAttribute = FeaturesPlugin_CompositeBoolean::BOOLEAN_OBJECTS_ID();
+      AttributeSelectionListPtr aSelList = aCompFeature->data()->selectionList(anObjectsAttribute);
+      if (aSelList.get()) {
+        DataPtr aData = aSketchFeature->data();
+        AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
+                                      (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
+        ResultPtr aRes = aSelAttr.get() ? aSelAttr->context() : ResultPtr();
+        if (aRes.get()) {
+          SessionPtr aMgr = ModelAPI_Session::get();
+          ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
+          AttributePtr anAttribute = myFeature->attribute(anObjectsAttribute);
+          std::string aValidatorID, anError;
+          aSelList->append(aRes, GeomShapePtr());
+          if (aFactory->validate(anAttribute, aValidatorID, anError))
+            updateObject(aCompFeature);
+          else
+            aSelList->clear();
+        }
       }
     }
   }