From 82582ace521fd9730fbe88831d24ca1c8ad0deca Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Thu, 8 Feb 2024 20:16:21 +0100 Subject: [PATCH] Clear projected shape when changing extrude height When the height is zero no solid is produced, the code was thus showing the result of the previously selected projection height. Closes #12113 --- src/Mod/Part/Gui/DlgProjectionOnSurface.cpp | 24 +++++++++++++-------- src/Mod/Part/Gui/DlgProjectionOnSurface.h | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp b/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp index c36b7b5ef3..c45a9841e4 100644 --- a/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp +++ b/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp @@ -882,20 +882,26 @@ void PartGui::DlgProjectionOnSurface::create_face_extrude(std::vectordoubleSpinBoxExtrudeHeight->value(); + for ( auto &itCurrentShape : iCurrentShape ) { if (itCurrentShape.aProjectedFace.IsNull()) continue;; - auto height = ui->doubleSpinBoxExtrudeHeight->value(); - if (itCurrentShape.exrudeValue == height) continue;; + if (itCurrentShape.extrudeValue == height) continue;; - gp_Vec directionToExtrude(itCurrentShape.aProjectionDir.XYZ()); - directionToExtrude.Reverse(); + itCurrentShape.extrudeValue = height; if (height == 0) - return; - directionToExtrude.Multiply(height); - BRepPrimAPI_MakePrism extrude(itCurrentShape.aProjectedFace, directionToExtrude); - itCurrentShape.aProjectedSolid = extrude.Shape(); - itCurrentShape.exrudeValue = height; + { + itCurrentShape.aProjectedSolid.Nullify(); + } + else + { + gp_Vec directionToExtrude(itCurrentShape.aProjectionDir.XYZ()); + directionToExtrude.Reverse(); + directionToExtrude.Multiply(height); + BRepPrimAPI_MakePrism extrude(itCurrentShape.aProjectedFace, directionToExtrude); + itCurrentShape.aProjectedSolid = extrude.Shape(); + } } } catch (const Standard_Failure& error) diff --git a/src/Mod/Part/Gui/DlgProjectionOnSurface.h b/src/Mod/Part/Gui/DlgProjectionOnSurface.h index 822e3466ce..ec1cd285b0 100644 --- a/src/Mod/Part/Gui/DlgProjectionOnSurface.h +++ b/src/Mod/Part/Gui/DlgProjectionOnSurface.h @@ -92,7 +92,7 @@ private: std::string partName; bool is_selectable = false; long transparency = 0; - float exrudeValue = 0.0f; + float extrudeValue = 0.0f; }; //from Gui::SelectionObserver