From 91ad22e3ab063e8969e59680ceb65559a0b9ac7e Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 23 May 2014 19:27:14 +0200 Subject: [PATCH] + allow to select whole wire in sweep panel --- src/Mod/Part/Gui/TaskSweep.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Mod/Part/Gui/TaskSweep.cpp b/src/Mod/Part/Gui/TaskSweep.cpp index 4b9cae0746f9..e21ea81573e0 100644 --- a/src/Mod/Part/Gui/TaskSweep.cpp +++ b/src/Mod/Part/Gui/TaskSweep.cpp @@ -75,10 +75,25 @@ class SweepWidget::Private } bool allow(App::Document*pDoc, App::DocumentObject*pObj, const char*sSubName) { - if (!sSubName || sSubName[0] == '\0') - return false; - std::string element(sSubName); - return element.substr(0,4) == "Edge"; + if (pObj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { + if (!sSubName) { + // If selecting again the same edge the passed sub-element is empty. If the whole + // shape is an edge or wire we can use it completely. + const TopoDS_Shape& shape = static_cast(pObj)->Shape.getValue(); + if (!shape.IsNull()) { + if (shape.ShapeType() == TopAbs_EDGE) + return true; + if (shape.ShapeType() == TopAbs_WIRE) + return true; + } + } + else { + std::string element(sSubName); + return element.substr(0,4) == "Edge"; + } + } + + return false; } }; };