Salome HOME
Issue #2204 Display a sketch plane: construction plane - using the plane face in...
authornds <nds@opencascade.com>
Thu, 16 Nov 2017 08:53:43 +0000 (11:53 +0300)
committernds <nds@opencascade.com>
Thu, 16 Nov 2017 08:53:43 +0000 (11:53 +0300)
src/PartSet/PartSet_PreviewSketchPlane.cpp

index 6de85edc74977390ffd94ea3f4230979c65ea3b8..9ef700df78402ee29741f49ff94674badc62528f 100644 (file)
@@ -75,9 +75,13 @@ void PartSet_PreviewSketchPlane::createSketchPlane(const CompositeFeaturePtr& th
     // selected linear face parameters
     AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
       (theSketch->data()->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
-    if (aSelAttr)
+    if (aSelAttr) {
       myShape = aSelAttr->value();
-
+      // this case is needed by constructing sketch on a plane, where result shape is equal
+      // to context result, therefore value() returns NULL and we should use shape of context.
+      if (!myShape.get() && aSelAttr->context().get())
+        myShape = aSelAttr->context()->shape();
+    }
     if (!myShape.get()) {
       // Create Preview for default planes
       std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast<GeomDataAPI_Point>(