Salome HOME
bos #20090: Can't select external wire of a sketch
authorvsv <vsv@opencascade.com>
Wed, 23 Sep 2020 15:37:37 +0000 (18:37 +0300)
committervsv <vsv@opencascade.com>
Wed, 23 Sep 2020 15:37:37 +0000 (18:37 +0300)
src/FeaturesPlugin/extrusion_widget.xml
src/FeaturesPlugin/extrusionfuse_widget.xml
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h
src/PartSet/PartSet_WidgetSketchCreator.cpp

index 94a9d4bc3a5d05302cc90b0974cf7a64fc4cb8df..df1631146dd0b892b0c9a54f72a98eae1ea9d50a 100644 (file)
@@ -5,7 +5,7 @@
 1. Planar face of non-sketch object or a plane. Sketch creation will be started.&lt;br /&gt;
 2. An existing sketch face or contour. Extrusion will be filled by it.&lt;br /&gt;
 3. An existing result shape of kind: wires/edge/vertices. Extrusion will be filled by it."
-                  shape_types="Vertices Edges Faces"
+                  shape_types="Vertices Edges Faces|Wires"
                   type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png"
                   default_type = "2"
                   use_choice="true">
@@ -14,7 +14,7 @@
   <multi_selector id="base"
                   label="Base objects:"
                   tooltip="Select a base objects"
-                  shape_types="Vertices Edges Faces"
+                  shape_types="Vertices Edges Faces|Wires"
                   type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png"
                   default_type = "2"
                   use_choice="true"
index 78b9eb1313ff4d00cbe0099bf2c15035b1d7f9d8..a2caf45368e44ef0875944f8770d5412922b2dcb 100644 (file)
@@ -6,7 +6,7 @@
 1. Planar face of non-sketch object or a plane. Sketch creation will be started.&lt;br /&gt;
 2. An existing sketch face or contour. Extrusion will be filled by it.&lt;br /&gt;
 3. An existing result shape of kind: wires/edge/vertices. Extrusion will be filled by it."
-      shape_types="Vertices Edges Faces"
+      shape_types="Vertices Edges Faces|Wires"
       type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png"
       default_type = "2"
       use_choice="true">
@@ -16,7 +16,7 @@
       label="Select a sketch face"
       icon="icons/Features/sketch.png"
       tooltip="Select a sketch face"
-      shape_types="Vertices Edges Faces"
+      shape_types="Vertices Edges Faces|Wire"
       type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png"
       default_type = "2"
       use_choice="true"
index 21df54023958ca84d37343e5786b1b51688c5c2e..bb5c6e39d12f0685a8eb7ceb21111894a2adc773 100644 (file)
@@ -352,7 +352,7 @@ bool ModuleBase_WidgetMultiSelector::restoreValueCustom()
     if (aSelectionType.empty())
       aSelectionListAttr->setSelectionType(myDefMode);
     else {
-      setCurrentShapeType(ModuleBase_Tools::shapeType(aSelectionType.c_str()));
+      setCurrentShapeType(aSelectionType.c_str());
       myDefMode = aSelectionType;
       myIsFirst = false;
     }
@@ -752,23 +752,28 @@ QIntList ModuleBase_WidgetMultiSelector::shapeTypes() const
   QIntList aShapeTypes;
 
   if (myShapeTypes.length() > 1 && myIsUseChoice) {
-    aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCtrl->textValue()));
+    QStringList aTypes = myTypeCtrl->textValue().split("|", QString::SkipEmptyParts);
+    for(QString aType: aTypes) {
+      aShapeTypes.append(ModuleBase_Tools::shapeType(aType));
+    }
   }
   else {
     foreach (QString aType, myShapeTypes) {
-      aShapeTypes.append(ModuleBase_Tools::shapeType(aType));
+      QStringList aSubTypes = aType.split("|", QString::SkipEmptyParts);
+      for(QString aSubType: aSubTypes) {
+        aShapeTypes.append(ModuleBase_Tools::shapeType(aSubType));
+      }
     }
   }
   return aShapeTypes;
 }
 
 //********************************************************************
-void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const int theShapeType)
+void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const QString& theShapeType)
 {
   int idx = 0;
   foreach (QString aShapeTypeName, myShapeTypes) {
-    int aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
-    if(aRefType == theShapeType && idx != myTypeCtrl->value()) {
+    if(aShapeTypeName == theShapeType && idx != myTypeCtrl->value()) {
       updateSelectionModesAndFilters(false);
       bool isBlocked = myTypeCtrl->blockSignals(true);
       myTypeCtrl->setValue(idx);
index 8e788d6552e40aab0e9f3f3a3f9ec7170c860b5d..946b46d77f9c0392143b72978f69a17400192038 100644 (file)
@@ -182,7 +182,7 @@ protected:
   virtual QIntList shapeTypes() const;
 
   /// Set current shape type for selection
-  void setCurrentShapeType(const int theShapeType);
+  void setCurrentShapeType(const QString& theShapeType);
 
   /// Return the attribute values wrapped in a list of viewer presentations
   /// \return a list of viewer presentations, which contains an attribute result and
index 3fe190981afe16bd41d069bc8916c01f82f57e5b..6d570d985d62217ca4609c5b8e9745bb799b3fcc 100644 (file)
@@ -307,11 +307,17 @@ QIntList PartSet_WidgetSketchCreator::shapeTypes() const
 {
   QIntList aShapeTypes;
   if (myShapeTypes.length() > 1 && myIsUseChoice) {
-    aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCtrl->textValue()));
+    QStringList aTypes = myTypeCtrl->textValue().split("|", QString::SkipEmptyParts);
+    foreach(QString aType, aTypes) {
+      aShapeTypes.append(ModuleBase_Tools::shapeType(aType));
+    }
   }
   else {
     foreach(QString aType, myShapeTypes) {
-      aShapeTypes.append(ModuleBase_Tools::shapeType(aType));
+      QStringList aSubTypes = aType.split("|", QString::SkipEmptyParts);
+      foreach(QString asubType, aSubTypes) {
+        aShapeTypes.append(ModuleBase_Tools::shapeType(asubType));
+      }
     }
   }
   return aShapeTypes;