From: mpv Date: Thu, 7 Apr 2016 15:21:28 +0000 (+0300) Subject: Fix the fang up on selection of trihedron point and axes in the sketch X-Git-Tag: V_2.3.0~266 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c74c21ea6e94c79449412ae17445d84599523c52;p=modules%2Fshaper.git Fix the fang up on selection of trihedron point and axes in the sketch --- diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index 48a5c6a1c..188a41f9a 100755 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -521,6 +521,15 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); ResultPtr aRes = std::dynamic_pointer_cast(theObject); + // selection shape has no result owner => the trihedron axis + // TODO: make reference to the real axes when they are implemented in the initialization plugin + if (!aRes.get()) { + ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument()->objectByName( + ModelAPI_ResultConstruction::group(), "Origin"); + if (aPointObj.get()) { // if initialization plugin performed well + aRes = std::dynamic_pointer_cast(aPointObj); + } + } if (!aRes.get()) { aRes = aMyFeature->firstResult(); } @@ -551,6 +560,15 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); ResultPtr aRes = std::dynamic_pointer_cast(theObject); + // if there is no object, it means that this is the origin point: search it in the module document + if (!aRes.get()) { + ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument()->objectByName( + ModelAPI_ResultConstruction::group(), "Origin"); + if (aPointObj.get()) { // if initialization plugin performed well + aRes = std::dynamic_pointer_cast(aPointObj); + } + } + // reference to itself with name "Origin" (but this may cause the infinitive cycling) if (!aRes.get()) { // If the point is selected not from Result object std::shared_ptr aShape =