Salome HOME
Issue #2209 : New option of creation of construction points
authormpv <mpv@opencascade.com>
Thu, 7 Sep 2017 13:55:25 +0000 (16:55 +0300)
committermpv <mpv@opencascade.com>
Thu, 7 Sep 2017 13:55:25 +0000 (16:55 +0300)
24 files changed:
src/ConstructionAPI/ConstructionAPI_Point.cpp
src/ConstructionAPI/ConstructionAPI_Point.h
src/ConstructionPlugin/CMakeLists.txt
src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp
src/ConstructionPlugin/ConstructionPlugin_Point.cpp
src/ConstructionPlugin/ConstructionPlugin_Point.h
src/ConstructionPlugin/ConstructionPlugin_Validators.cpp
src/ConstructionPlugin/ConstructionPlugin_Validators.h
src/ConstructionPlugin/Test/TestAxisCreation.py
src/ConstructionPlugin/Test/TestPoint.py [deleted file]
src/ConstructionPlugin/Test/TestPointName.py
src/ConstructionPlugin/Test/TestPoint_LineAndPlane.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_XYZ.py [new file with mode: 0644]
src/ConstructionPlugin/point_widget.xml
src/GeomAPI/GeomAPI_Pln.cpp
src/GeomAPI/GeomAPI_Pln.h
src/GeomAPI/GeomAPI_Shape.cpp
src/GeomAPI/GeomAPI_Shape.h
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h
src/InitializationPlugin/InitializationPlugin_Plugin.cpp
src/ModelAPI/Test/TestUndoRedo.py
src/SketchPlugin/Test/TestConstraintCoincidence.py
src/SketchPlugin/Test/TestConstraintMiddlePoint.py

index 2656c55dc23528881c5478826f72b9b76ec86ae2..48222cfc4e3c5384f6452d83744718b1778d0e0e 100644 (file)
@@ -56,7 +56,7 @@ ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feat
   if(initialize()) {
     setByDistanceOnEdge(theEdge, theDistanceValue, theDistancePercent, theReverse);
   }
-}
+}*/
 
 //==================================================================================================
 ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
@@ -67,19 +67,19 @@ ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feat
   if(initialize()) {
     GeomAPI_Shape::ShapeType aType1 = getShapeType(theObject1);
     GeomAPI_Shape::ShapeType aType2 = getShapeType(theObject2);
-
+    /*
     if(aType1 == GeomAPI_Shape::VERTEX && aType2 == GeomAPI_Shape::FACE) {
       // If first object is vertex and second object is face then set by projection.
       setByProjection(theObject1, theObject2);
     } else if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::EDGE) {
       // If both objects are edges then set by lines intersection.
       setByLinesIntersection(theObject1, theObject2);
-    } else if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::FACE) {
+    } else */if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::FACE) {
       // If first object is edge and second object is face then set by line and plane intersection.
       setByLineAndPlaneIntersection(theObject1, theObject2);
     }
   }
-}*/
+}
 
 //==================================================================================================
 ConstructionAPI_Point::~ConstructionAPI_Point()
@@ -96,6 +96,7 @@ void ConstructionAPI_Point::setByXYZ(const ModelHighAPI_Double& theX,
   fillAttribute(theX, myx);
   fillAttribute(theY, myy);
   fillAttribute(theZ, myz);
+  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ(), mycreationMethod);
 
   execute(false);
 }
@@ -135,32 +136,40 @@ void ConstructionAPI_Point::setByLinesIntersection(const ModelHighAPI_Selection&
   fillAttribute(theEdge2, mysecondLine);
 
   execute();
-}
+}*/
 
 //==================================================================================================
 void ConstructionAPI_Point::setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
                                                           const ModelHighAPI_Selection& theFace)
 {
-  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION(), mycreationMethod);
+  fillAttribute(
+    ConstructionPlugin_Point::CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION(), mycreationMethod);
   fillAttribute(theEdge, myintersectionLine);
   fillAttribute(theFace, myintersectionPlane);
-
+  fillAttribute("", useOffset()); // not used by default
   execute();
-}*/
+}
 
 //==================================================================================================
 void ConstructionAPI_Point::dump(ModelHighAPI_Dumper& theDumper) const
 {
-  // TODO: all types of points
-
   FeaturePtr aBase = feature();
   const std::string& aDocName = theDumper.name(aBase->document());
-
-  AttributeDoublePtr anAttrX = aBase->real(ConstructionPlugin_Point::X());
-  AttributeDoublePtr anAttrY = aBase->real(ConstructionPlugin_Point::Y());
-  AttributeDoublePtr anAttrZ = aBase->real(ConstructionPlugin_Point::Z());
-  theDumper << aBase << " = model.addPoint(" << aDocName << ", "
-            << anAttrX << ", " << anAttrY << ", " << anAttrZ << ")" << std::endl;
+  const std::string& aMeth = creationMethod()->value();
+
+  // common part
+  theDumper << aBase << " = model.addPoint(" << aDocName << ", ";
+
+  if (aMeth == "" || // default is XYZ
+      aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ()) {
+    theDumper << x() << ", " << y() << ", " << z() << ")" << std::endl;
+  } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()) {
+    theDumper << intersectionLine() << ", " <<intersectionPlane() ;
+    if (!useOffset()->value().empty()) { // call method with defined offset
+      theDumper << ", " << offset() << ", " << reverseOffset();
+    }
+    theDumper << ")" << std::endl;
+  }
 }
 
 //==================================================================================================
@@ -180,17 +189,32 @@ PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
                   const bool theDistancePercent,
                   const bool theReverse)
 {
-  // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
   return PointPtr(new ConstructionAPI_Point(aFeature, theEdge, theDistanceValue, theDistancePercent, theReverse));
-}
+}*/
 
 //==================================================================================================
 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
                   const ModelHighAPI_Selection& theObject1,
                   const ModelHighAPI_Selection& theObject2)
 {
-  // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
   return PointPtr(new ConstructionAPI_Point(aFeature, theObject1, theObject2));
-}*/
+}
+
+//==================================================================================================
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+                  const ModelHighAPI_Selection& theObject1,
+                  const ModelHighAPI_Selection& theObject2,
+                  const ModelHighAPI_Double& theDistanceValue,
+                  const bool theReverse)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
+  PointPtr anAPI(new ConstructionAPI_Point(aFeature, theObject1, theObject2));
+
+  fillAttribute(ConstructionPlugin_Point::USE_OFFSET(), anAPI->useOffset());
+  fillAttribute(theDistanceValue, anAPI->offset());
+  fillAttribute(theReverse, anAPI->reverseOffset());
+
+  return anAPI;
+}
index eb5f06719b1d431eb960d7465d2cffa03a4dd9ed..322176c4a771da37892a58d1dd92790ada02ffea 100644 (file)
@@ -56,21 +56,33 @@ public:
                         const ModelHighAPI_Double& theDistanceValue,
                         const bool theDistancePercent = false,
                         const bool theReverse = false);
-
-  /// Constructor with values.
+  */
+  /// Constructor with values: intersected objects.
   CONSTRUCTIONAPI_EXPORT
   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                         const ModelHighAPI_Selection& theObject1,
-                        const ModelHighAPI_Selection& theObject2);*/
+                        const ModelHighAPI_Selection& theObject2);
 
   /// Destructor.
   CONSTRUCTIONAPI_EXPORT
   virtual ~ConstructionAPI_Point();
 
-  INTERFACE_3(ConstructionPlugin_Point::ID(),
+  INTERFACE_9(ConstructionPlugin_Point::ID(),
               x, ConstructionPlugin_Point::X(), ModelAPI_AttributeDouble, /** X attribute */,
               y, ConstructionPlugin_Point::Y(), ModelAPI_AttributeDouble, /** Y attribute */,
-              z, ConstructionPlugin_Point::Z(), ModelAPI_AttributeDouble, /** Z attribute */)
+              z, ConstructionPlugin_Point::Z(), ModelAPI_AttributeDouble, /** Z attribute */,
+              creationMethod, ConstructionPlugin_Point::CREATION_METHOD(),
+              ModelAPI_AttributeString, /** Creation method */,
+              intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(),
+              ModelAPI_AttributeSelection, /** Line for intersection */,
+              intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(),
+              ModelAPI_AttributeSelection, /** Plane for intersection */,
+              useOffset, ConstructionPlugin_Point::USE_OFFSET(),
+              ModelAPI_AttributeString, /** Use offset */,
+              offset, ConstructionPlugin_Point::OFFSET(),
+              ModelAPI_AttributeDouble, /** Offset */,
+              reverseOffset, ConstructionPlugin_Point::REVERSE_OFFSET(),
+              ModelAPI_AttributeBoolean, /** Reverse offset */)
 
 
   /// Set point values.
@@ -95,11 +107,11 @@ public:
   CONSTRUCTIONAPI_EXPORT
   void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
                               const ModelHighAPI_Selection& theEdge2);
-
+  */
   /// Set line and plane for intersections.
   CONSTRUCTIONAPI_EXPORT
   void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
-                                     const ModelHighAPI_Selection& theFace);*/
+                                     const ModelHighAPI_Selection& theFace);
 
   /// Dump wrapped feature
   CONSTRUCTIONAPI_EXPORT
@@ -125,12 +137,22 @@ PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
                   const ModelHighAPI_Double& theDistanceValue,
                   const bool theDistancePercent = false,
                   const bool theReverse = false);
+*/
+/// \ingroup CPPHighAPI
+/// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
+CONSTRUCTIONAPI_EXPORT
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+                  const ModelHighAPI_Selection& theObject1,
+                  const ModelHighAPI_Selection& theObject2);
 
 /// \ingroup CPPHighAPI
-/// \brief Create Point feature
+/// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
+/// with positive distance from the plane and flag to reverse the offset direction.
 CONSTRUCTIONAPI_EXPORT
 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
                   const ModelHighAPI_Selection& theObject1,
-                  const ModelHighAPI_Selection& theObject2);*/
+                  const ModelHighAPI_Selection& theObject2,
+                  const ModelHighAPI_Double& theDistanceValue,
+                  const bool theReverse = false);
 
 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */
index 96e79cedaa33870eb7a8299f7b3ba5fa4b57b7e4..0cbcec0492bf9101f1f075eb76bc8e953d89dea0 100644 (file)
@@ -77,6 +77,7 @@ INCLUDE_DIRECTORIES(
 
 ADD_UNIT_TESTS(TestAxisCreation.py
                UnitTestAxis.py
-               TestPoint.py
+               TestPoint_XYZ.py
+               TestPoint_LineAndPlane.py
                TestPointName.py
                TestPlane.py)
index 04864cfb6543d5bb365d4daea83eaa5d86e7db4f..9f18a33189327e9f0087eb70356275be36520717 100644 (file)
@@ -42,8 +42,8 @@ ConstructionPlugin_Plugin::ConstructionPlugin_Plugin()
   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
   aFactory->registerValidator("ConstructionPlugin_ValidatorPointLines",
                               new ConstructionPlugin_ValidatorPointLines());
-  aFactory->registerValidator("ConstructionPlugin_ValidatorPointLineAndPlaneNotParallel",
-                              new ConstructionPlugin_ValidatorPointLineAndPlaneNotParallel());
+  aFactory->registerValidator("ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel",
+                              new ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel());
   aFactory->registerValidator("ConstructionPlugin_ValidatorPlaneThreePoints",
                               new ConstructionPlugin_ValidatorPlaneThreePoints());
   aFactory->registerValidator("ConstructionPlugin_ValidatorPlaneLinePoint",
index 43f2e78e2fb503ad75e2348a517a2290ad0c5da0..f08cd5fa42661a5d97b3d325f02e52af0fa71928 100644 (file)
 #include <ModelAPI_ResultConstruction.h>
 
 #include <GeomAlgoAPI_PointBuilder.h>
+#include <GeomAlgoAPI_ShapeTools.h>
 
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Vertex.h>
+#include <GeomAPI_Pln.h>
 
 //==================================================================================================
 ConstructionPlugin_Point::ConstructionPlugin_Point()
@@ -47,12 +49,12 @@ const std::string& ConstructionPlugin_Point::getKind()
 //==================================================================================================
 void ConstructionPlugin_Point::initAttributes()
 {
-  //data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
-
   data()->addAttribute(X(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(Y(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(Z(), ModelAPI_AttributeDouble::typeId());
 
+  data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
+
   /*data()->addAttribute(EDGE(), ModelAPI_AttributeSelection::typeId());
   data()->addAttribute(DISTANCE_VALUE(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(DISTANCE_PERCENT(), ModelAPI_AttributeBoolean::typeId());
@@ -63,32 +65,38 @@ void ConstructionPlugin_Point::initAttributes()
 
   data()->addAttribute(FIRST_LINE(), ModelAPI_AttributeSelection::typeId());
   data()->addAttribute(SECOND_LINE(), ModelAPI_AttributeSelection::typeId());
-
+*/
   data()->addAttribute(INTERSECTION_LINE(), ModelAPI_AttributeSelection::typeId());
-  data()->addAttribute(INTERSECTION_PLANE(), ModelAPI_AttributeSelection::typeId());*/
+  data()->addAttribute(INTERSECTION_PLANE(), ModelAPI_AttributeSelection::typeId());
+
+  data()->addAttribute(USE_OFFSET(), ModelAPI_AttributeString::typeId());
+  data()->addAttribute(OFFSET(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(REVERSE_OFFSET(), ModelAPI_AttributeBoolean::typeId());
 }
 
 //==================================================================================================
 void ConstructionPlugin_Point::execute()
 {
-  GeomShapePtr aShape = createByXYZ();
-
-  /*GeomShapePtr aShape;
+  GeomShapePtr aShape;
 
-  std::string aCreationMethod = string(CREATION_METHOD())->value();
+   // to support compatibility with old documents where aCreationMethod did not exist
+  std::string aCreationMethod =
+    string(CREATION_METHOD()).get() && !string(CREATION_METHOD())->value().empty() ?
+    string(CREATION_METHOD())->value() : CREATION_METHOD_BY_XYZ();
   if(aCreationMethod == CREATION_METHOD_BY_XYZ()) {
     aShape = createByXYZ();
-  } else if(aCreationMethod == CREATION_METHOD_BY_DISTANCE_ON_EDGE()) {
+  }/* else if(aCreationMethod == CREATION_METHOD_BY_DISTANCE_ON_EDGE()) {
     aShape = createByDistanceOnEdge();
   } else if(aCreationMethod == CREATION_METHOD_BY_PROJECTION()) {
     aShape = createByProjection();
   } else if(aCreationMethod == CREATION_METHOD_BY_LINES_INTERSECTION()) {
     aShape = createByLinesIntersection();
-  } else if(aCreationMethod == CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()) {
+  }*/ else if(aCreationMethod == CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()) {
     aShape = createByLineAndPlaneIntersection();
-  }*/
+  }
 
   if(!aShape.get()) {
+    setError("Error: intersection not found.");
     return;
   }
 
@@ -180,12 +188,13 @@ std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByLinesIntersect
 
   return GeomAlgoAPI_PointBuilder::vertexByIntersection(aFirstEdge, aSecondEdge);
 }
+*/
 
 //==================================================================================================
 std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByLineAndPlaneIntersection()
 {
   // Get line.
-  AttributeSelectionPtr aLineSelection= selection(INTERSECTION_LINE());
+  AttributeSelectionPtr aLineSelection = selection(INTERSECTION_LINE());
   GeomShapePtr aLineShape = aLineSelection->value();
   if(!aLineShape.get()) {
     aLineShape = aLineSelection->context()->shape();
@@ -200,5 +209,14 @@ std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByLineAndPlaneIn
   }
   std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aPlaneShape));
 
-  return GeomAlgoAPI_PointBuilder::vertexByIntersection(anEdge, aFace);
-}*/
+  if (!string(USE_OFFSET())->value().empty()) {
+    double anOffset = real(OFFSET())->value();
+    if (boolean(REVERSE_OFFSET())->value())
+      anOffset = -anOffset;
+    if (fabs(anOffset) > 1.e-9) { // move face
+      aFace->translate(aFace->getPlane()->direction(), anOffset);
+    }
+  }
+
+  return GeomAlgoAPI_ShapeTools::intersect(anEdge, aFace);
+}
index e9efd6ab023e4ce7637d0019be600e4491a951c7..346fe8022c3e87284628673020315ad7edd09c31 100644 (file)
@@ -45,7 +45,7 @@ public:
     return CONSTRUCTION_POINT_KIND;
   }
 
-  /*/// Attribute name for creation method.
+  /// Attribute name for creation method.
   inline static const std::string& CREATION_METHOD()
   {
     static const std::string MY_CREATION_METHOD_ID("creation_method");
@@ -58,7 +58,7 @@ public:
     static const std::string MY_CREATION_METHOD_ID("by_xyz");
     return MY_CREATION_METHOD_ID;
   }
-
+  /*
   /// Attribute name for creation method.
   inline static const std::string& CREATION_METHOD_BY_DISTANCE_ON_EDGE()
   {
@@ -79,13 +79,13 @@ public:
     static const std::string MY_CREATION_METHOD_ID("by_lines_intersection");
     return MY_CREATION_METHOD_ID;
   }
-
+  */
   /// Attribute name for creation method.
   inline static const std::string& CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()
   {
     static const std::string MY_CREATION_METHOD_ID("by_line_and_plane_intersection");
     return MY_CREATION_METHOD_ID;
-  }*/
+  }
 
   /// Attribute name for X coordinate.
   inline static const std::string& X()
@@ -163,6 +163,7 @@ public:
     static const std::string ATTR_ID("second_line");
     return ATTR_ID;
   }
+  */
 
   /// Attribute name for selected intersection line.
   inline static const std::string& INTERSECTION_LINE()
@@ -176,7 +177,28 @@ public:
   {
     static const std::string ATTR_ID("intersection_plane");
     return ATTR_ID;
-  }*/
+  }
+
+  /// Attribute name for use offset for the intersection plane.
+  inline static const std::string& USE_OFFSET()
+  {
+    static const std::string ATTR_ID("use_offset");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for offset for the intersection plane.
+  inline static const std::string& OFFSET()
+  {
+    static const std::string ATTR_ID("offset");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for reverse offset for the intersection plane.
+  inline static const std::string& REVERSE_OFFSET()
+  {
+    static const std::string ATTR_ID("reverse_offset");
+    return ATTR_ID;
+  }
 
   /// Creates a new part document if needed.
   CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
@@ -198,8 +220,8 @@ private:
   std::shared_ptr<GeomAPI_Vertex> createByXYZ();
   /*std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
   std::shared_ptr<GeomAPI_Vertex> createByProjection();
-  std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();
-  std::shared_ptr<GeomAPI_Vertex> createByLineAndPlaneIntersection();*/
+  std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();*/
+  std::shared_ptr<GeomAPI_Vertex> createByLineAndPlaneIntersection();
 
 };
 
index 33d98d704ebe2c0fbf29907d5b0d1ed3fcf7cb8a..a3bd2bd539eb5efe4821d70451e09bd7e6da32cd 100644 (file)
 #include <GeomAPI_Lin.h>
 #include <GeomAPI_Pln.h>
 #include <GeomAPI_Vertex.h>
+#include <GeomAlgoAPI_ShapeTools.h>
 
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_AttributeBoolean.h>
 
 #include <Events_InfoMessage.h>
 
+static std::shared_ptr<GeomAPI_Edge> getEdge(const GeomShapePtr theShape);
 static std::shared_ptr<GeomAPI_Lin> getLin(const GeomShapePtr theShape);
 static std::shared_ptr<GeomAPI_Pln> getPln(const GeomShapePtr theShape);
 static std::shared_ptr<GeomAPI_Pnt> getPnt(const GeomShapePtr theShape);
@@ -94,7 +96,7 @@ bool ConstructionPlugin_ValidatorPointLines::isValid(const AttributePtr& theAttr
 }
 
 //==================================================================================================
-bool ConstructionPlugin_ValidatorPointLineAndPlaneNotParallel::isValid(
+bool ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel::isValid(
     const AttributePtr& theAttribute,
     const std::list<std::string>& theArguments,
     Events_InfoMessage& theError) const
@@ -105,7 +107,7 @@ bool ConstructionPlugin_ValidatorPointLineAndPlaneNotParallel::isValid(
     std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
   AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front());
 
-  std::shared_ptr<GeomAPI_Lin> aLin;
+  std::shared_ptr<GeomAPI_Edge> anEdge;
   std::shared_ptr<GeomAPI_Pln> aPln;
 
   GeomShapePtr aShape1 = anAttribute1->value();
@@ -127,20 +129,23 @@ bool ConstructionPlugin_ValidatorPointLineAndPlaneNotParallel::isValid(
     aShape2 = aContext2->shape();
   }
 
-  aLin = getLin(aShape1);
+  bool isPlaneFirst = false;
+  anEdge = getEdge(aShape1);
   aPln = getPln(aShape2);
-  if(!aLin.get() || !aPln.get()) {
-    aLin = getLin(aShape2);
+  if(!anEdge.get() || !aPln.get()) {
+    anEdge = getEdge(aShape2);
     aPln = getPln(aShape1);
+    isPlaneFirst = true;
   }
 
-  if(!aLin.get() || !aPln.get()) {
+  if(!anEdge.get() || !aPln.get()) {
     theError = "Wrong shape types selected.";
     return false;
   }
 
-  if(aPln->isParallel(aLin)) {
-    theError = "Plane and line are parallel.";
+  std::shared_ptr<GeomAPI_Face> aPlaneFace(new GeomAPI_Face(isPlaneFirst ? aShape1 : aShape2));
+  if(GeomAlgoAPI_ShapeTools::isParallel(anEdge, aPlaneFace)) {
+    theError = "Plane and edge are parallel.";
     return false;
   }
 
@@ -381,6 +386,17 @@ bool ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes::isValid(
   return true;
 }
 
+std::shared_ptr<GeomAPI_Edge> getEdge(const GeomShapePtr theShape)
+{
+  if(!theShape->isEdge()) {
+    return std::shared_ptr<GeomAPI_Edge>();
+  }
+
+  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(theShape));
+
+  return anEdge;
+}
+
 std::shared_ptr<GeomAPI_Lin> getLin(const GeomShapePtr theShape)
 {
   std::shared_ptr<GeomAPI_Lin> aLin;
index cb13f6abbccde02d84d77556381071236697e85b..3254672de855045b8786492e870c7e97ecd00c63 100644 (file)
@@ -38,10 +38,10 @@ public:
                         Events_InfoMessage& theError) const;
 };
 
-/// \class ConstructionPlugin_ValidatorPointLineAndPlaneNotParallel
+/// \class ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel
 /// \ingroup Validators
-/// \brief A validator for selection line and plane for point by intersection.
-class ConstructionPlugin_ValidatorPointLineAndPlaneNotParallel: public ModelAPI_AttributeValidator
+/// \brief A validator for selection edge and plane for point by intersection.
+class ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel: public ModelAPI_AttributeValidator
 {
 public:
   //! \return True if the attribute is valid.
index 80db16361a6e0beb3f7ebe76cb52795ad0cec711..a645c548e03fff88011f13993285b2e4e50b1485 100644 (file)
@@ -52,6 +52,7 @@ assert(aPointFeatureData is not None)
 aPointFeatureData.real("x").setValue(0.)
 aPointFeatureData.real("y").setValue(0.)
 aPointFeatureData.real("z").setValue(0.)
+aPointFeatureData.string("creation_method").setValue("by_xyz")
 aPointFeature.execute()
 aSession.finishOperation()
 aPoint1Result = aPointFeature.firstResult();
@@ -67,6 +68,7 @@ assert(aPointFeatureData is not None)
 aPointFeatureData.real("x").setValue(0.)
 aPointFeatureData.real("y").setValue(0.)
 aPointFeatureData.real("z").setValue(100.)
+aPointFeatureData.string("creation_method").setValue("by_xyz")
 aPointFeature.execute()
 aSession.finishOperation()
 aPoint2Result = aPointFeature.firstResult();
diff --git a/src/ConstructionPlugin/Test/TestPoint.py b/src/ConstructionPlugin/Test/TestPoint.py
deleted file mode 100644 (file)
index 4241bc5..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-## Copyright (C) 2014-2017  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
-## License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-##
-## This library is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## Lesser General Public License for more details.
-##
-## 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
-##
-## See http:##www.salome-platform.org/ or
-## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-##
-
-"""
-Test case for Construction Point feature. Written on High API.
-"""
-from ModelAPI import *
-from GeomAPI import *
-
-from salome.shaper import model
-
-# Get session
-aSession = ModelAPI_Session.get()
-
-# Create a part
-aDocument = aSession.activeDocument()
-aSession.startOperation()
-model.addPart(aDocument)
-aDocument = aSession.activeDocument()
-aSession.finishOperation()
-
-# Create a point by coordinates
-aSession.startOperation()
-aPoint = model.addPoint(aDocument, 50, 50, 50)
-aSession.finishOperation()
-assert (len(aPoint.results()) > 0)
-
-# # Create a sketch with lines
-# aSession.startOperation()
-# anOrigin = GeomAPI_Pnt(0, 0, 0)
-# aDirX = GeomAPI_Dir(1, 0, 0)
-# aNorm = GeomAPI_Dir(0, 0, 1)
-# aSketch = model.addSketch(aDocument, GeomAPI_Ax3(anOrigin, aDirX, aNorm))
-# aSketchLine1 = aSketch.addLine(0, 0, 100, 100)
-# aSketchLine2 = aSketch.addLine(0, 100, 100, 0)
-# aSession.finishOperation()
-#
-# # Create a point on line
-# aSession.startOperation()
-# aPoint = model.addPoint(aDocument, aSketchLine1.result()[0], 25, True, False)
-# aSession.finishOperation()
-# assert (len(aPoint.result()) > 0)
-#
-# # Create plane
-# aSession.startOperation()
-# aPlane = model.addPlane(aDocument, 1, 1, 1, 1)
-# aSession.finishOperation()
-#
-# # Create a point by projection
-# aSession.startOperation()
-# aPoint = model.addPoint(aDocument, aPoint.result()[0], aPlane.result()[0])
-# aSession.finishOperation()
-# assert (len(aPoint.result()) > 0)
-#
-# # Create a point by lines intersection
-# aSession.startOperation()
-# aPoint = model.addPoint(aDocument, aSketchLine1.result()[0], aSketchLine2.result()[0])
-# aSession.finishOperation()
-# assert (len(aPoint.result()) > 0)
-#
-# # Create a point by line and plane intersection
-# aSession.startOperation()
-# aPoint = model.addPoint(aDocument, aSketchLine1.result()[0], aPlane.result()[0])
-# aSession.finishOperation()
-# assert (len(aPoint.result()) > 0)
-
-assert(model.checkPythonDump())
index 33ff527c403295e1e67de21f1b9e6cd0d1996983..5579700911197b14bae4f48e8523ca90a2243d49 100644 (file)
@@ -31,6 +31,7 @@ assert(aFeatureData is not None)
 aFeatureData.real("x").setValue(0.)
 aFeatureData.real("y").setValue(0.)
 aFeatureData.real("z").setValue(0.)
+aFeatureData.string("creation_method").setValue("by_xyz")
 aFeatureName = aFeature.name()
 aFeature.execute()
 aSession.finishOperation()
diff --git a/src/ConstructionPlugin/Test/TestPoint_LineAndPlane.py b/src/ConstructionPlugin/Test/TestPoint_LineAndPlane.py
new file mode 100644 (file)
index 0000000..635ab81
--- /dev/null
@@ -0,0 +1,55 @@
+## Copyright (C) 2014-2017  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
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## 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
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature as intersection of line and plane.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
+SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "Origin"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 60)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
+model.do()
+Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_2.addLine(60, 100, 0, 20)
+SketchArc_1 = Sketch_2.addArc(0, 0, -65.89631323066888, 61.2998850129882, -90, 0, False)
+model.do()
+
+# point by sketch face and a line
+Point_1 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"))
+model.do()
+# check the point position
+rightPosition = GeomAPI_Vertex(-15, 0, 0)
+assert(rightPosition.isEqual(Point_1.results()[0].resultSubShapePair()[0].shape()))
+
+# point by sketch face and an arc, intersection outside of the face, offset is defined
+Point_2 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchArc_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, True)
+# check the point position
+rightPosition = GeomAPI_Vertex(-89.442719099991606, 0, -10)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+
+model.end()
+assert(model.checkPythonDump())
diff --git a/src/ConstructionPlugin/Test/TestPoint_XYZ.py b/src/ConstructionPlugin/Test/TestPoint_XYZ.py
new file mode 100644 (file)
index 0000000..df73e5f
--- /dev/null
@@ -0,0 +1,45 @@
+## Copyright (C) 2014-2017  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
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## 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
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by coordinates.
+"""
+from ModelAPI import *
+from GeomAPI import *
+
+from salome.shaper import model
+
+# Get session
+aSession = ModelAPI_Session.get()
+
+# Create a part
+aDocument = aSession.activeDocument()
+aSession.startOperation()
+model.addPart(aDocument)
+aDocument = aSession.activeDocument()
+aSession.finishOperation()
+
+# Create a point by coordinates
+aSession.startOperation()
+aPoint = model.addPoint(aDocument, 50, 50, 50)
+aSession.finishOperation()
+assert (len(aPoint.results()) > 0)
+
+assert(model.checkPythonDump())
index 42368daf2b48b2c4519ebafa3b4279f7b6baadb8..20f2f3cb9a553f37184ac9ddb5199261f3d5c868 100644 (file)
@@ -20,11 +20,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
 -->
 
 <source>
-  <doublevalue id="x" label="X " tooltip="X coordinate" default="0"/>
-  <doublevalue id="y" label="Y " tooltip="Y coordinate" default="0"/>
-  <doublevalue id="z" label="Z " tooltip="Z coordinate" default="0"/>
-
-  <!--<toolbox id="creation_method">
+  <toolbox id="creation_method">
     <box id="by_xyz"
          title="By X, Y, Z"
          tooltip="Point at a given distance from the origin."
@@ -45,6 +41,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                    icon="icons/Construction/z_size.png"
                    default="0"/>
     </box>
+<!--
     <box id="by_distance_on_edge"
          title="By distance on edge"
          tooltip="Point on an edge, at a given distance of one of its end."
@@ -111,6 +108,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
         <validator id="ConstructionPlugin_ValidatorPointLines" parameters="first_line"/>
       </shape_selector>
     </box>
+-->
     <box id="by_line_and_plane_intersection"
          title="By line and plane intersection"
          tooltip="Point by intersection of line and plane."
@@ -120,8 +118,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       tooltip="Line for intersection."
                       icon="icons/Construction/edge.png"
                       shape_types="edge">
-        <validator id="GeomValidators_ShapeType" parameters="line"/>
-        <validator id="ConstructionPlugin_ValidatorPointLineAndPlaneNotParallel" parameters="intersection_plane"/>
+        <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel" parameters="intersection_plane"/>
       </shape_selector>
       <shape_selector id="intersection_plane"
                       label="Plane"
@@ -129,9 +126,13 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       icon="icons/Construction/face.png"
                       shape_types="face">
         <validator id="GeomValidators_Face" parameters="plane"/>
-        <validator id="ConstructionPlugin_ValidatorPointLineAndPlaneNotParallel" parameters="intersection_line"/>
+        <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel" parameters="intersection_line"/>
       </shape_selector>
+      <optionalbox id="use_offset" title="Offset from the plane">
+        <doublevalue id="offset" label="Distance " tooltip="Distance from the plane" min="0" default="0"/>
+        <boolvalue id="reverse_offset" label="Reverse" tooltip="Reverse offset value" default="false"/>
+      </optionalbox>
     </box>
 
-  </toolbox>-->
+  </toolbox>
 </source>
index f7950f6f1d8599237bfd883beb8ff33a7db5e51c..60e417c7c5df4d79f6c29ab2f9ecb2c8533f2c86 100644 (file)
@@ -81,18 +81,6 @@ bool GeomAPI_Pln::isCoincident(const std::shared_ptr<GeomAPI_Pln> thePlane,
     aMyPln.Axis().IsParallel(anOtherPln.Axis(), theTolerance));
 }
 
-bool GeomAPI_Pln::isParallel(const std::shared_ptr<GeomAPI_Lin> theLine)
-{
-  std::shared_ptr<GeomAPI_XYZ> aLineDir = theLine->direction()->xyz();
-  std::shared_ptr<GeomAPI_XYZ> aLineLoc = theLine->location()->xyz();
-
-  std::shared_ptr<GeomAPI_XYZ> aNormal = direction()->xyz();
-  std::shared_ptr<GeomAPI_XYZ> aLocation = location()->xyz();
-
-  double aDot = aNormal->dot(aLineDir);
-  return Abs(aDot) < Precision::SquareConfusion();
-}
-
 std::shared_ptr<GeomAPI_Pnt>
   GeomAPI_Pln::intersect(const std::shared_ptr<GeomAPI_Lin>& theLine) const
 {
index 14d886ee3f94c17cab943c3f9e3c5eea4f8dfb8f..863a72f617edfe1329eacf23220c0222a08bb000 100644 (file)
@@ -70,10 +70,6 @@ class GeomAPI_Pln : public GeomAPI_Interface
   GEOMAPI_EXPORT
   bool isCoincident(const std::shared_ptr<GeomAPI_Pln> thePlane, const double theTolerance = 1.e-7);
 
-  /// Returns true if plane is parallel to theLine.
-  GEOMAPI_EXPORT
-  bool isParallel(const std::shared_ptr<GeomAPI_Lin> theLine);
-
   /// Returns intersection point or empty if no intersections
   GEOMAPI_EXPORT
   std::shared_ptr<GeomAPI_Pnt> intersect(const std::shared_ptr<GeomAPI_Lin>& theLine) const;
index fd1d6adeb9fc13d4430149af8e9b0ef1b65b8a29..c1df335558bd9f4f7680e158f68a43984bd27619 100644 (file)
@@ -490,3 +490,13 @@ bool GeomAPI_Shape::isIntersect(const GeomShapePtr theShape) const
 
   return false;
 }
+
+void GeomAPI_Shape::translate(const std::shared_ptr<GeomAPI_Dir> theDir, const double theOffset)
+{
+  gp_Dir aDir = theDir->impl<gp_Dir>();
+  gp_Vec aTrsfVec(aDir.XYZ() * theOffset);
+  gp_Trsf aTranslation;
+  aTranslation.SetTranslation(aTrsfVec);
+  TopoDS_Shape aResult = MY_SHAPE->Moved(aTranslation);
+  setImpl(new TopoDS_Shape(aResult));
+}
index c7345461bd6a3bebfaea24509edfbb77ebc3c133..4e148978cd162140c5b9316ebd6ef0e5d89c9c6a 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef GeomAPI_Shape_H_
 #define GeomAPI_Shape_H_
 
+#include "GeomAPI_Dir.h"
+
 #include <GeomAPI_Interface.h>
 #include <memory>
 #include <list>
@@ -142,6 +144,10 @@ public:
   /// Returns true if min distance between shapes < tolerance.
   GEOMAPI_EXPORT
   bool isIntersect(const std::shared_ptr<GeomAPI_Shape> theShape) const;
+
+  // Translates the shape along the direction for the given offset
+  GEOMAPI_EXPORT
+  void translate(const std::shared_ptr<GeomAPI_Dir> theDir, const double theOffset);
 };
 
 //! Pointer on list of shapes
index da5fa0ac06621d751499d63dbb53af5787407c73..2886fa7b428900b07a940297b6cb60a244864958 100644 (file)
@@ -43,6 +43,7 @@
 #include <BRepGProp.hxx>
 #include <BRepTools.hxx>
 #include <BRepTopAdaptor_FClass2d.hxx>
+#include <BRepClass_FaceClassifier.hxx>
 #include <Geom2d_Curve.hxx>
 #include <Geom2d_Curve.hxx>
 #include <BRepLib_CheckCurveOnSurface.hxx>
@@ -50,6 +51,7 @@
 #include <Geom_Plane.hxx>
 #include <GeomLib_IsPlanarSurface.hxx>
 #include <GeomLib_Tool.hxx>
+#include <GeomAPI_ExtremaCurveSurface.hxx>
 #include <gp_Pln.hxx>
 #include <GProp_GProps.hxx>
 #include <IntAna_IntConicQuad.hxx>
@@ -67,6 +69,7 @@
 #include <TopExp_Explorer.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 
+
 #include <BOPAlgo_Builder.hxx>
 #include <BRepBuilderAPI_MakeVertex.hxx>
 #include <TopoDS_Edge.hxx>
@@ -707,6 +710,50 @@ bool GeomAlgoAPI_ShapeTools::isParallel(const std::shared_ptr<GeomAPI_Edge> theE
   return anExt.IsParallel() == Standard_True;
 }
 
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_ShapeTools::intersect(
+  const std::shared_ptr<GeomAPI_Edge> theEdge, const std::shared_ptr<GeomAPI_Face> theFace)
+{
+  if(!theEdge.get() || !theFace.get()) {
+    return false;
+  }
+
+  TopoDS_Edge anEdge = TopoDS::Edge(theEdge->impl<TopoDS_Shape>());
+  double aFirstOnCurve, aLastOnCurve;
+  Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirstOnCurve, aLastOnCurve);
+
+  TopoDS_Face aFace  = TopoDS::Face(theFace->impl<TopoDS_Shape>());
+  Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
+
+  GeomAPI_ExtremaCurveSurface anExt(aCurve, aSurf);
+  // searching for the best point-intersection
+  int aMaxLevel = 0;
+  gp_Pnt aResult;
+  for(int anIntNum = 1; anIntNum <= anExt.NbExtrema(); anIntNum++) {
+    if (anExt.Distance(anIntNum) > Precision::Confusion())
+      continue;
+    Standard_Real aW, aU, aV;
+    anExt.Parameters(anIntNum, aW, aU, aV);
+    gp_Pnt2d aPointOfSurf(aU, aV);
+    // level of the intersection: if it is inside of edge and/or face the level is higher
+    int aIntLevel = aW > aFirstOnCurve && aW < aLastOnCurve ? 2 : 1;
+    BRepClass_FaceClassifier aFClass(aFace, aPointOfSurf, Precision::Confusion());
+    if (aFClass.State() == TopAbs_IN) // "in" is better than "on"
+      aIntLevel += 2;
+    else if (aFClass.State() == TopAbs_ON)
+      aIntLevel += 1;
+    if (aMaxLevel < aIntLevel) {
+      aMaxLevel = anIntNum;
+      anExt.Points(anIntNum, aResult, aResult);
+    }
+  }
+  if (aMaxLevel > 0) { // intersection found
+    return std::shared_ptr<GeomAPI_Vertex>(
+      new GeomAPI_Vertex(aResult.X(), aResult.Y(), aResult.Z()));
+  }
+  return std::shared_ptr<GeomAPI_Vertex>(); // no intersection found
+}
+
 //==================================================================================================
 void GeomAlgoAPI_ShapeTools::splitShape(const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
                                       const GeomAlgoAPI_ShapeTools::PointToRefsMap& thePointsInfo,
index ba530ebd5567da8b6e8dad1fbe974943f48250b3..2e48c96bbf61ee8cb28585d49976fa56a06370c5 100644 (file)
@@ -133,6 +133,12 @@ public:
   GEOMALGOAPI_EXPORT static bool isParallel(const std::shared_ptr<GeomAPI_Edge> theEdge,
                                             const std::shared_ptr<GeomAPI_Face> theFace);
 
+  // Computes intersection point between the edge curve and a face surface (only one point, with
+  // preferences to point that belongs to edge and face boundaries.
+  /// \returns null if there is no intersection
+  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Vertex> intersect(
+    const std::shared_ptr<GeomAPI_Edge> theEdge, const std::shared_ptr<GeomAPI_Face> theFace);
+
   typedef std::map<std::shared_ptr<GeomAPI_Pnt>,
                    std::pair<std::list<std::shared_ptr<GeomDataAPI_Point2D> >,
                              std::list<std::shared_ptr<ModelAPI_Object> > > > PointToRefsMap;
index 0d10a4b15f9e50c6deff99df5c896fc929e13129..5d4781494052ee0537e05832c291c8482f9b5397 100644 (file)
@@ -141,6 +141,7 @@ FeaturePtr InitializationPlugin_Plugin::createPoint(DocumentPtr theDoc, const st
   aPoint->real("x")->setValue(theX);
   aPoint->real("y")->setValue(theY);
   aPoint->real("z")->setValue(theZ);
+  aPoint->string("creation_method")->setValue("by_xyz");
   aPoint->data()->setName(theName);
   // don't show automatically created feature in the features history
   aPoint->setInHistory(aPoint, false);
index 34aa535eb849f5a4b54ee200908efdcda0b50cb4..5f748b665f9164a2869d6491cfef6a7db078956d 100644 (file)
@@ -32,6 +32,7 @@ aFeature = aDoc.addFeature("Point")
 aFeature.real("x").setValue(1.)
 aFeature.real("y").setValue(-1.)
 aFeature.real("z").setValue(0.)
+aFeature.string("creation_method").setValue("by_xyz")
 aFeatureName = aFeature.name()
 # "2" is because Origin is the first point
 assert(aFeatureName == "Point_2")
index 082de9f9ae165153b9df42f80e7e3242e047744f..4ce25cd89b2033a504266abde2c2e3a667d5f91d 100644 (file)
@@ -87,6 +87,7 @@ aFeature = aDocument.addFeature("Point")
 aFeature.real("x").setValue(0.)
 aFeature.real("y").setValue(0.)
 aFeature.real("z").setValue(0.)
+aFeature.string("creation_method").setValue("by_xyz")
 anOriginName = aFeature.name()
 aSession.finishOperation()
 #=========================================================================
index e7e8a5c128a7e16797ce84d47c06308730d984e6..c5aaa01a867056b217a72eb9ba7c0480532b9414 100644 (file)
@@ -71,6 +71,7 @@ aFeature = aDocument.addFeature("Point")
 aFeature.real("x").setValue(0.)
 aFeature.real("y").setValue(0.)
 aFeature.real("z").setValue(0.)
+aFeature.string("creation_method").setValue("by_xyz")
 anOriginName = aFeature.name()
 aSession.finishOperation()
 #=========================================================================