Salome HOME
Meet the coding style (line length <= 100)
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Sketch.cpp
index 9f6b63a77ba0a12d80460194684b86eb3cd2ecec..d1deff5364ac1e1f9369a33889243ee28db68c1b 100755 (executable)
@@ -139,6 +139,7 @@ std::shared_ptr<ModelAPI_Feature> 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;
 }
 
@@ -212,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<GeomAPI_Shape> 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<GeomAPI_Shape> aSelection = aSelAttr->value();
+      if (!aSelection.get()) aSelection = aSelAttr->context()->shape();
       // update the sketch plane
       std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aSelection));
       std::shared_ptr<GeomAPI_Pln> aPlane = aFace->getPlane();