From c2940ebb2ca8e823f1b06366f8b64ae440d3abb4 Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 11 May 2021 17:52:10 +0300 Subject: [PATCH] Fix for #24260 [CEA] Fatal error gp_Dir() input vector has zero norm when loading python dump Make sketch invalid if external plane selected becomes invalid. And keep it while plane is re-selected. --- src/Model/Model_AttributeSelection.cpp | 2 ++ src/Model/Model_Update.cpp | 4 +++- src/SHAPERGUI/SHAPERGUI.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 21cb7ee6e..432c6f1c2 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -604,6 +604,8 @@ bool Model_AttributeSelection::update() aResult = aSelector.restore(aContextShape); bool aWasInvalid = aSelLab.IsAttribute(kINVALID_SELECTION); setInvalidIfFalse(aSelLab, aResult); + if (!aResult) + aWasInvalid = false; TopoDS_Shape aNewShape; if (aSelLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index 934df7d85..25c0cd978 100644 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -894,7 +894,9 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { bool isObligatory = !aFactory->isNotObligatory( theFeature->getKind(), theFeature->data()->id(aSel)) && aFactory->isCase(theFeature, theFeature->data()->id(aSel)); - if (isObligatory) + if (isObligatory || + // #24260 : sketch plane was selected, but selection becomes wrong, make it invalid + (theFeature->getKind() == "Sketch" && aSel->id() == "External")) aState = ModelAPI_StateInvalidArgument; } } diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index dca57ebb0..8bb312a30 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -686,14 +686,14 @@ QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theTBNam aAction->setData(theId); int aWBMenu = createMenu(theWBName, -1, -1, 30/*10-Window, 1000 - Help*/); -#ifdef _DEBUG - int aItemId = -#endif if( theId == "PointCoordinates" ) createMenu(separator(), aWBMenu); - createMenu(aId, aWBMenu); +#ifdef _DEBUG + int aItemId = +#endif + createMenu(aId, aWBMenu); if (isAddSeparator) createMenu(separator(), aWBMenu); -- 2.39.2