]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[bos #30176] [CEA][FORUM] 1D-Fillet segmentation fault
authorjfa <jfa@opencascade.com>
Thu, 9 Jun 2022 15:11:03 +0000 (18:11 +0300)
committerjfa <jfa@opencascade.com>
Thu, 9 Jun 2022 15:11:03 +0000 (18:11 +0300)
src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp
src/FeaturesPlugin/FeaturesPlugin_Validators.cpp
src/FeaturesPlugin/fillet1d_widget.xml

index e60d0f4b03393c404b3300ce7a1dd12d50d91952..24ba1854870e69377003dd7ff73c1c03f72230e5 100644 (file)
@@ -87,7 +87,9 @@ bool FeaturesPlugin_Fillet1D::baseShapes(ListOfShape& theWires, MapShapeSubs& th
     int aNbSel = aSelList->size();
     for (int ind = 0; ind < aNbSel; ++ind) {
       AttributeSelectionPtr aCurSel = aSelList->value(ind);
-      GeomShapePtr aWire = aCurSel->context()->shape();
+      GeomShapePtr aWire = aCurSel->value();
+      if (!aWire.get() && aCurSel->context().get())
+        aWire = aCurSel->context()->shape();
       if (aProcessedWires.find(aWire) != aProcessedWires.end())
         continue;
 
@@ -124,7 +126,6 @@ bool FeaturesPlugin_Fillet1D::baseShapes(ListOfShape& theWires, MapShapeSubs& th
         return false;
       }
 
-
       // keep the sequence of wires and fillet vertices stable
       theWires.push_back(aWire);
       for (GeomAPI_WireExplorer anExp(aWire->wire()); anExp.more(); anExp.next()) {
index 95e13def1cd859858ebf65adffb71e71d454f7d2..3181fc925bead505efef23cf7f526ba214ab234d 100644 (file)
@@ -992,6 +992,21 @@ bool FeaturesPlugin_ValidatorFillet1DSelection::isValid(const AttributePtr& theA
     // LCOV_EXCL_STOP
   }
 
+  // Validate wires selection
+  if (!theArguments.empty() &&
+      theArguments.front() == "wire") {
+    for (int ind = 0; ind < anAttrSelectionList->size(); ++ind) {
+      AttributeSelectionPtr aCurSel = anAttrSelectionList->value(ind);
+      //GeomShapePtr aContext = aCurSel->context()->shape();
+      GeomShapePtr aWire = aCurSel->value();
+      if (aWire->shapeType() != GeomAPI_Shape::WIRE) {
+        theError = "Selected shape is not a wire";
+        return false;
+      }
+    }
+    return true;
+  }
+
   // check each selected vertex is a sharp corner between adjacent edges,
   // and these edges are in the same plane
   std::map<GeomShapePtr, MapShapeToShapes> aWireSubshapes;
index e7f3cafa1191a8c06e9bf5eddbeb04c5a30ad3ba..0ff93870677048b2bc7a3992b8401962887295ba 100644 (file)
@@ -12,6 +12,7 @@
                       use_choice="false"
                       concealment="true">
         <validator id="PartSet_DifferentObjects"/>
+        <validator id="FeaturesPlugin_ValidatorFillet1DSelection" parameters="wire"/>
       </multi_selector>
     </box>
     <box id="by_vertices"