X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Fillet1D.cpp;h=efe33d041b88f18af1c86184a751d7c231145934;hb=77ce6d35ac8d2f0fdaecb4f23e0870bf74e36103;hp=d2b9bac9473ef164819468ce1b027a7c51950094;hpb=490fed9e39eced971522355b70a8fa90312d526f;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp index d2b9bac94..efe33d041 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020 CEA/DEN, EDF R&D +// Copyright (C) 2020-2024 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -18,7 +18,6 @@ // #include -#include #include #include @@ -33,6 +32,15 @@ #include #include #include +#include + +void sendMessageWithFailedShapes(const ListOfShape& theVertices) +{ + std::shared_ptr aMessage( + new ModelAPI_ShapesFailedMessage(Events_Loop::eventByName(EVENT_OPERATION_SHAPES_FAILED))); + aMessage->setShapes(theVertices); + Events_Loop::loop()->send(aMessage); +} FeaturesPlugin_Fillet1D::FeaturesPlugin_Fillet1D() { @@ -60,6 +68,15 @@ void FeaturesPlugin_Fillet1D::execute() removeResults(aResultIndex); } +void FeaturesPlugin_Fillet1D::attributeChanged(const std::string& theID) +{ + if (theID == CREATION_METHOD()) { + // creation method is changed, drop failed vertices and send the message + removeResults(0); + sendMessageWithFailedShapes(ListOfShape()); + } +} + bool FeaturesPlugin_Fillet1D::baseShapes(ListOfShape& theWires, MapShapeSubs& theWireVertices) { std::set aProcessedWires; @@ -70,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; @@ -107,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()) { @@ -164,10 +182,7 @@ bool FeaturesPlugin_Fillet1D::performFillet(const GeomShapePtr& theWire, if (isSendMessage) { // send message to highlight the failed vertices - std::shared_ptr aMessage( - new ModelAPI_ShapesFailedMessage(Events_Loop::eventByName(EVENT_OPERATION_SHAPES_FAILED))); - aMessage->setShapes(myFailedVertices); - Events_Loop::loop()->send(aMessage); + sendMessageWithFailedShapes(myFailedVertices); } static const std::string THE_PREFIX = "Fillet1D"; @@ -176,8 +191,8 @@ bool FeaturesPlugin_Fillet1D::performFillet(const GeomShapePtr& theWire, ResultBodyPtr aResult = document()->createBody(data(), theResultIndex); ListOfShape anOriginal; anOriginal.push_back(theWire); - FeaturesPlugin_Tools::loadModifiedShapes(aResult, anOriginal, ListOfShape(), - aFilletBuilder, aFilletBuilder->shape(), THE_PREFIX); + ModelAPI_Tools::loadModifiedShapes(aResult, anOriginal, ListOfShape(), + aFilletBuilder, aFilletBuilder->shape(), THE_PREFIX); setResult(aResult, theResultIndex); // store new edges generated from vertices for (ListOfShape::const_iterator anIt = theVertices.begin(); anIt != theVertices.end(); ++anIt)