From 2239483a58c82d06ed6f45f9e014036065aaecdd Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 15 Feb 2019 18:45:45 +0100 Subject: [PATCH] in selection dialog also offer planar shape binders --- src/Mod/PartDesign/Gui/Command.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 8abaeea766..a36abf1a1b 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -644,6 +644,27 @@ void CmdPartDesignNewSketch::activated(int iMsg) } } + // Collect also shape binders consisting of a single planar face + auto shapeBinders( getDocument()->getObjectsOfType(PartDesign::ShapeBinder::getClassTypeId()) ); + for (auto binder : shapeBinders) { + // Check whether this plane belongs to the active body + if (pcActiveBody && pcActiveBody->hasObject(binder)) { + TopoDS_Shape shape = static_cast(binder)->Shape.getValue(); + if (!shape.IsNull() && shape.ShapeType() == TopAbs_FACE) { + const TopoDS_Face& face = TopoDS::Face(shape); + TopLoc_Location loc; + Handle(Geom_Surface) surf = BRep_Tool::Surface(face, loc); + if (!surf.IsNull() && GeomLib_IsPlanarSurface(surf).IsPlanar()) { + if (!pcActiveBody->isAfterInsertPoint (binder)) { + validPlaneCount++; + planes.push_back(binder); + status.push_back(PartDesignGui::TaskFeaturePick::validFeature); + } + } + } + } + } + // Determines if user made a valid selection in dialog auto accepter = [](const std::vector& features) -> bool { return !features.empty();