From a678d8ec7fe2238c513962b046c6cee5c8c80efe Mon Sep 17 00:00:00 2001 From: captain0xff Date: Wed, 17 Sep 2025 20:08:04 +0530 Subject: [PATCH] Gui: hide the gizmos in case of any errors --- src/Mod/PartDesign/Gui/TaskChamferParameters.cpp | 5 +++-- src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp | 6 ++++++ src/Mod/PartDesign/Gui/TaskFilletParameters.cpp | 4 ++-- src/Mod/PartDesign/Gui/TaskHelixParameters.cpp | 5 +++++ src/Mod/PartDesign/Gui/TaskHoleParameters.cpp | 4 ++++ src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp | 9 +++++++++ 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp index 5b5842102b..9fb413c6d0 100644 --- a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp @@ -399,11 +399,12 @@ void TaskChamferParameters::setGizmoPositions() } auto chamfer = getObject(); - if (!chamfer) { + if (!chamfer || chamfer->isError()) { gizmoContainer->visible = false; return; } - auto baseShape = chamfer->getBaseTopoShape(); + + PartDesign::TopoShape baseShape = chamfer->getBaseTopoShape(true); auto shapes = chamfer->getContinuousEdges(baseShape); if (shapes.size() == 0) { diff --git a/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp b/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp index 6b50b0b4f7..04b66af2db 100644 --- a/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp @@ -1390,6 +1390,12 @@ void TaskExtrudeParameters::setGizmoPositions() } auto extrude = getObject(); + if (!extrude || extrude->isError()) { + gizmoContainer->visible = false; + return; + } + gizmoContainer->visible = true; + PartDesign::TopoShape shape = extrude->getProfileShape(); Base::Vector3d center = getMidPointFromProfile(shape); std::string sideType = std::string(extrude->SideType.getValueAsString()); diff --git a/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp index d5f316e388..86a4c682a3 100644 --- a/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp @@ -228,11 +228,11 @@ void TaskFilletParameters::setGizmoPositions() } auto fillet = getObject(); - if (!fillet) { + if (!fillet || fillet->isError()) { gizmoContainer->visible = false; return; } - Part::TopoShape baseShape = fillet->getBaseTopoShape(); + Part::TopoShape baseShape = fillet->getBaseTopoShape(true); std::vector shapes = fillet->getContinuousEdges(baseShape); if (shapes.size() == 0) { diff --git a/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp b/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp index a37ad10da8..341acca512 100644 --- a/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp @@ -740,6 +740,11 @@ void TaskHelixParameters::setGizmoPositions() } auto helix = getObject(); + if (!helix || helix->isError()) { + gizmoContainer->visible = false; + return; + } + gizmoContainer->visible = true; Part::TopoShape profileShape = helix->getProfileShape(); double reversed = propReversed->getValue()? -1.0 : 1.0; auto profileCentre = getMidPointFromProfile(profileShape); diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index a585833ef0..f53bd88ca6 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -1233,6 +1233,10 @@ void TaskHoleParameters::setGizmoPositions() } auto hole = getObject(); + if (!hole || hole->isError()) { + gizmoContainer->visible = false; + return; + } Part::TopoShape profileShape = hole->getProfileShape( Part::ShapeOption::NeedSubElement | Part::ShapeOption::ResolveLink | diff --git a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp index 1e6955ba08..4eea6bef27 100644 --- a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp @@ -762,6 +762,10 @@ void TaskRevolutionParameters::setGizmoPositions() if (isGroove) { auto groove = getObject(); + if (!groove || groove->isError()) { + gizmoContainer->visible = false; + return; + } Part::TopoShape profile = groove->getProfileShape(); profile.getCenterOfGravity(profileCog); @@ -769,12 +773,17 @@ void TaskRevolutionParameters::setGizmoPositions() axisDir = groove->Axis.getValue(); } else { auto revolution = getObject(); + if (!revolution || revolution->isError()) { + gizmoContainer->visible = false; + return; + } Part::TopoShape profile = revolution->getProfileShape(); profile.getCenterOfGravity(profileCog); basePos = revolution->Base.getValue(); axisDir = revolution->Axis.getValue(); } + gizmoContainer->visible = true; auto diff = profileCog - basePos; axisDir.Normalize();