X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Sketch.cpp;h=d1deff5364ac1e1f9369a33889243ee28db68c1b;hb=b5893b0a30fac08134c24de4565cb513a43affa6;hp=ca60111969f1ee5646b8cf1599b42e5353ba0a61;hpb=423c10234142d14d0d5de89383f2f96a4ec5930f;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Sketch.cpp b/src/SketchPlugin/SketchPlugin_Sketch.cpp index ca6011196..d1deff536 100755 --- a/src/SketchPlugin/SketchPlugin_Sketch.cpp +++ b/src/SketchPlugin/SketchPlugin_Sketch.cpp @@ -39,8 +39,6 @@ #include #include -using namespace std; - SketchPlugin_Sketch::SketchPlugin_Sketch() { } @@ -141,6 +139,7 @@ std::shared_ptr SketchPlugin_Sketch::addFeature(std::string th } // set as current also after it becomes sub to set correctly enabled for other sketch subs document()->setCurrentFeature(aNew, false); + return aNew; } @@ -214,9 +213,10 @@ bool SketchPlugin_Sketch::isSub(ObjectPtr theObject) const void SketchPlugin_Sketch::attributeChanged(const std::string& theID) { if (theID == SketchPlugin_SketchEntity::EXTERNAL_ID()) { - std::shared_ptr aSelection = - data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())->value(); - if (aSelection) { // update arguments due to the selection value + AttributeSelectionPtr aSelAttr = selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + if (aSelAttr->context().get()) { // update arguments due to the selection value + std::shared_ptr aSelection = aSelAttr->value(); + if (!aSelection.get()) aSelection = aSelAttr->context()->shape(); // update the sketch plane std::shared_ptr aFace(new GeomAPI_Face(aSelection)); std::shared_ptr aPlane = aFace->getPlane(); @@ -297,8 +297,8 @@ FeaturePtr SketchPlugin_Sketch::addUniqueNamedCopiedFeature(FeaturePtr theFeatur theFeature->data()->copyTo(aNewFeature->data()); // external state should not be copied as a new object is an object of the current sketch if (theFeature->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()).get()) - theFeature->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())->setValue(ResultPtr(), - GeomShapePtr()); + aNewFeature->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())->setValue(ResultPtr(), + GeomShapePtr()); aNewFeature->data()->setName(aUniqueFeatureName); // text expressions could block setValue of some attributes SketchPlugin_Tools::clearExpressions(aNewFeature);