Salome HOME
Fix for the issue #2917 : Adding a Point based on an object in python makes it create...
[modules/shaper.git] / src / ConstructionAPI / ConstructionAPI_Point.cpp
index 5fa78bf6727063e672a58ec4fd0be1e56181bebc..0029708af6f768cb9c1baf29195b91e87ce2ab18 100644 (file)
@@ -109,14 +109,15 @@ ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feat
 //==================================================================================================
 ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                              const ModelHighAPI_Selection& theObject,
-                                             const bool theIsCircularEdge)
+                                             const bool theIsCircularEdge,
+                                             const bool theIsXYZSelection)
 : ModelHighAPI_Interface(theFeature)
 {
   if (initialize())
   {
     if (theIsCircularEdge) {
       setByCenterOfCircle(theObject);
-    } else if (theObject.shapeType() == "VERTEX") {
+    } else if (theObject.shapeType() == "VERTEX" && theIsXYZSelection) {
       // This is tricky way to get vertex shape.
       fillAttribute(theObject, mypointToProject);
       GeomShapePtr aShape = mypointToProject->value();
@@ -416,3 +417,11 @@ PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
   return PointPtr(new ConstructionAPI_Point(aFeature, theObject, theIsCircularEdge));
 }
+
+//==================================================================================================
+PointPtr addPointXYZ(const std::shared_ptr<ModelAPI_Document> & thePart,
+                     const ModelHighAPI_Selection& theObject)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
+  return PointPtr(new ConstructionAPI_Point(aFeature, theObject, false, true));
+}