From: nds Date: Wed, 24 Jun 2015 05:01:48 +0000 (+0300) Subject: Issue #672 - Crash when distance constraint X-Git-Tag: V_1.3.0~205 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=72d591a0eded88a734573f679643400a5ed78fa9;p=modules%2Fshaper.git Issue #672 - Crash when distance constraint reason: an empty shape if the selected shape is equal to the shape of result --- diff --git a/src/PartSet/PartSet_WidgetMultiSelector.cpp b/src/PartSet/PartSet_WidgetMultiSelector.cpp index d6c000897..60b2573e7 100644 --- a/src/PartSet/PartSet_WidgetMultiSelector.cpp +++ b/src/PartSet/PartSet_WidgetMultiSelector.cpp @@ -99,11 +99,19 @@ void PartSet_WidgetMultiSelector::getGeomSelection(const ModuleBase_ViewerPrs& t std::shared_ptr aSPFeature = std::dynamic_pointer_cast(aSelectedFeature); // there is no a sketch feature is selected, but the shape exists, try to create an exernal object - if (aSPFeature.get() == NULL && theShape.get() != NULL && !theShape->isNull() && - myExternalObjectMgr->useExternal()) { - if (myIsInVaildate) - theObject = myExternalObjectMgr->externalObjectValidated(theObject, theShape, sketch()); - else - theObject = myExternalObjectMgr->externalObject(theObject, theShape, sketch()); + // TODO: unite with the same functionality in PartSet_WidgetShapeSelector + if (aSPFeature.get() == NULL && myExternalObjectMgr->useExternal()) { + GeomShapePtr aShape = theShape; + if (!aShape.get()) { + ResultPtr aResult = myWorkshop->selection()->getResult(thePrs); + if (aResult.get()) + aShape = aResult->shape(); + } + if (aShape.get() != NULL && !aShape->isNull()) { + if (myIsInVaildate) + theObject = myExternalObjectMgr->externalObjectValidated(theObject, theShape, sketch()); + else + theObject = myExternalObjectMgr->externalObject(theObject, theShape, sketch()); + } } } diff --git a/src/PartSet/PartSet_WidgetShapeSelector.cpp b/src/PartSet/PartSet_WidgetShapeSelector.cpp index 7fca13598..431f1e8a8 100644 --- a/src/PartSet/PartSet_WidgetShapeSelector.cpp +++ b/src/PartSet/PartSet_WidgetShapeSelector.cpp @@ -77,9 +77,17 @@ void PartSet_WidgetShapeSelector::getGeomSelection(const ModuleBase_ViewerPrs& t std::shared_ptr aSPFeature = std::dynamic_pointer_cast(aSelectedFeature); // there is no a sketch feature is selected, but the shape exists, try to create an exernal object - if (aSPFeature.get() == NULL && theShape.get() != NULL && !theShape->isNull() && - myExternalObjectMgr->useExternal()) - theObject = myExternalObjectMgr->externalObject(theObject, theShape, sketch()); + // TODO: unite with the same functionality in PartSet_WidgetShapeSelector + if (aSPFeature.get() == NULL && myExternalObjectMgr->useExternal()) { + GeomShapePtr aShape = theShape; + if (!aShape.get()) { + ResultPtr aResult = myWorkshop->selection()->getResult(thePrs); + if (aResult.get()) + aShape = aResult->shape(); + } + if (aShape.get() != NULL && !aShape->isNull()) + theObject = myExternalObjectMgr->externalObject(theObject, aShape, sketch()); + } } //********************************************************************