From 539608b3f0642b0fc2d8c914411e621e01d5c8e5 Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 9 Jun 2022 18:11:03 +0300 Subject: [PATCH] [bos #30176] [CEA][FORUM] 1D-Fillet segmentation fault --- src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp | 5 +++-- src/FeaturesPlugin/FeaturesPlugin_Validators.cpp | 15 +++++++++++++++ src/FeaturesPlugin/fillet1d_widget.xml | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp index e60d0f4b0..24ba18548 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp @@ -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()) { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp index 95e13def1..3181fc925 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp @@ -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 aWireSubshapes; diff --git a/src/FeaturesPlugin/fillet1d_widget.xml b/src/FeaturesPlugin/fillet1d_widget.xml index e7f3cafa1..0ff938706 100644 --- a/src/FeaturesPlugin/fillet1d_widget.xml +++ b/src/FeaturesPlugin/fillet1d_widget.xml @@ -12,6 +12,7 @@ use_choice="false" concealment="true"> +