Salome HOME
Update Projection feature during construction (issue #1473)
authorazv <azv@opencascade.com>
Thu, 28 Apr 2016 13:57:42 +0000 (16:57 +0300)
committerazv <azv@opencascade.com>
Thu, 28 Apr 2016 13:58:00 +0000 (16:58 +0300)
src/SketchPlugin/SketchPlugin_Projection.cpp

index ac75866268be15785b903f86058a9a09015a262e..7f78c0bbc4aba23ed153dc7026d1994c7bb07bb2 100644 (file)
@@ -60,6 +60,7 @@ void SketchPlugin_Projection::execute()
     ResultConstructionPtr aConstr = document()->createConstruction(data());
     aConstr->setShape(aProjection->lastResult()->shape());
     aConstr->setIsInHistory(false);
+    aConstr->setDisplayed(false);
     setResult(aConstr);
 
     aProjection->selection(EXTERNAL_ID())->setValue(lastResult(), lastResult()->shape());
@@ -114,6 +115,13 @@ void SketchPlugin_Projection::computeProjection(const std::string& theID)
 
   std::shared_ptr<GeomAPI_Pln> aSketchPlane = sketch()->plane();
 
+  ResultConstructionPtr aResult =
+      std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(lastResult());
+  if (aResult && aResult->shape()) {
+    aResult->setShape(std::shared_ptr<GeomAPI_Edge>());
+    aProjection->selection(EXTERNAL_ID())->setValue(lastResult(), lastResult()->shape());
+  }
+
   if (anEdge->isLine()) {
     std::shared_ptr<GeomAPI_Pnt> aFirst = aSketchPlane->project(anEdge->firstPoint());
     std::shared_ptr<GeomAPI_Pnt> aLast = aSketchPlane->project(anEdge->lastPoint());
@@ -184,6 +192,13 @@ void SketchPlugin_Projection::computeProjection(const std::string& theID)
     aFixed->execute();
   }
 
-  if (theID == EXTERNAL_FEATURE_ID())
+  if (theID == EXTERNAL_FEATURE_ID()) {
     selection(EXTERNAL_ID())->setValue(aExtFeature->context(), aExtFeature->context()->shape());
+
+    if (aResult) {
+      aResult->setShape(aProjection->lastResult()->shape());
+      setResult(aResult);
+      aProjection->selection(EXTERNAL_ID())->setValue(lastResult(), lastResult()->shape());
+    }
+  }
 }