]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/SketchAPI/SketchAPI_Sketch.cpp
Salome HOME
Implement changing sketch plane through Python API. Add unit test.
[modules/shaper.git] / src / SketchAPI / SketchAPI_Sketch.cpp
index 380ec24691922d127e312c490b917c735a4b0d4e..7476380df64883cc5312f9ef257df8d527045890 100644 (file)
@@ -127,6 +127,26 @@ void SketchAPI_Sketch::setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane)
   execute();
 }
 
+void SketchAPI_Sketch::setPlane(const ModelHighAPI_Selection & thePlane,
+                                bool theRemoveExternalDependency)
+{
+  std::shared_ptr<SketchPlugin_Sketch> aSketch =
+      std::dynamic_pointer_cast<SketchPlugin_Sketch>(feature());
+
+  DocumentPtr aDoc = aSketch->document();
+  bool useVisible = false;
+  FeaturePtr aCurFeatureBefore = aDoc->currentFeature(useVisible);
+  aDoc->setCurrentFeature(aSketch, useVisible);
+
+  if (theRemoveExternalDependency)
+    aSketch->customAction(SketchPlugin_Sketch::ACTION_REMOVE_EXTERNAL());
+
+  setExternal(thePlane);
+
+  aDoc->setCurrentFeature(aCurFeatureBefore, useVisible);
+}
+
+//--------------------------------------------------------------------------------------
 void SketchAPI_Sketch::setExternal(const ModelHighAPI_Selection & theExternal)
 {
   fillAttribute(theExternal, myexternal);