Salome HOME
AA
[modules/shaper.git] / src / PartSet / PartSet_Tools.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 0d91654..3ef5b73
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include <PartSet_Tools.h>
@@ -312,6 +311,17 @@ std::shared_ptr<GeomAPI_Pln> PartSet_Tools::sketchPlane(CompositeFeaturePtr theS
   return aPlane;
 }
 
+void PartSet_Tools::nullifySketchPlane(CompositeFeaturePtr theSketch)
+{
+  std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast<GeomDataAPI_Point>(
+    theSketch->data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+  std::shared_ptr<GeomDataAPI_Dir> aNormal = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
+    theSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
+
+  aNormal->reset();
+  anOrigin->reset();
+}
+
 std::shared_ptr<GeomAPI_Pnt> PartSet_Tools::point3D(std::shared_ptr<GeomAPI_Pnt2d> thePoint2D,
                                                       CompositeFeaturePtr theSketch)
 {
@@ -773,14 +783,10 @@ void PartSet_Tools::getFirstAndLastIndexInFolder(const ObjectPtr& theFolder,
   if (!aFirstFeatureInFolder.get())
     return;
 
-  AttributeReferencePtr aLastFeatAttr =
-    aFolder->data()->reference(ModelAPI_Folder::LAST_FEATURE_ID());
-  if (!aLastFeatAttr.get())
-    return;
-  FeaturePtr aLastFeatureInFolder = ModelAPI_Feature::feature(aLastFeatAttr->value());
+  FeaturePtr aLastFeatureInFolder = aFolder->lastVisibleFeature();
   if (!aLastFeatureInFolder.get())
     return;
 
   theFirst = aDoc->index(aFirstFeatureInFolder);
   theLast = aDoc->index(aLastFeatureInFolder);
-}
\ No newline at end of file
+}