From c5bad0c8b1773a977106d471797ffc4f067249c5 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 17 Jan 2017 08:05:39 +0300 Subject: [PATCH] Issue #1787 : modification condition to do not create new external object by local selection --- src/PartSet/PartSet_WidgetPoint2d.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index b9470abc7..e6c1cf1d3 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -458,13 +458,20 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo if (aSelectedFeature.get() != NULL) aSPFeature = std::dynamic_pointer_cast(aSelectedFeature); - if ((!aSPFeature && !aShape.IsNull()) || - (aSPFeature.get() && aSPFeature->isExternal())) { - ResultPtr aFixedObject; - anExternal = true; + ResultPtr aFixedObject; + bool aSketchExternalFeature = aSPFeature.get() && aSPFeature->isExternal(); + if ((!aSPFeature && !aShape.IsNull()) || aSketchExternalFeature) { aFixedObject = PartSet_Tools::findFixedObjectByExternal(aShape, aObject, mySketch); - if (!aFixedObject.get()) - aFixedObject = PartSet_Tools::createFixedObjectByExternal(aShape, aObject, mySketch); + if (aSketchExternalFeature && !aFixedObject.get()) {/// local selection on external feature + anExternal = false; + } + else { + anExternal = true; + if (!aFixedObject.get()) + aFixedObject = PartSet_Tools::createFixedObjectByExternal(aShape, aObject, mySketch); + } + } + if (anExternal) { double aX, aY; if (getPoint2d(aView, aShape, aX, aY) && isFeatureContainsPoint(myFeature, aX, aY)) { // do not create a constraint to the point, which already used by the feature -- 2.39.2