]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
2.3.4 Point creation: by intersection
authordbv <dbv@opencascade.com>
Thu, 28 Jun 2018 20:57:36 +0000 (23:57 +0300)
committerdbv <dbv@opencascade.com>
Thu, 28 Jun 2018 20:57:36 +0000 (23:57 +0300)
18 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/TestPoint_IntersectLineAndPlane.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_IntersectLines.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_IntersectPlanes.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_LineAndPlane.py [deleted file]
src/ConstructionPlugin/icons/point_by_intersection_32x32.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_line_and_plane_intersection_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_lines_intersection_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_planes_intersection_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/point_widget.xml
src/ModelHighAPI/ModelHighAPI_Macro.h

index fd6d468ec6f6c8392b011138c36ea968097604d5..e5925482f7c5e32eb995969dab3dee13e608cb76 100644 (file)
@@ -73,16 +73,37 @@ ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feat
     } else if (aType1 == GeomAPI_Shape::VERTEX && aType2 == GeomAPI_Shape::EDGE) {
       // If first object is vertex and second object is edge then set by projection.
       setByProjectionOnEdge(theObject1, theObject2);
-    } /* else if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::EDGE) {
+    } 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(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                             const ModelHighAPI_Selection& theObject1,
+                                             const ModelHighAPI_Selection& theObject2,
+                                             const ModelHighAPI_Selection& theObject3)
+: ModelHighAPI_Interface(theFeature)
+{
+  if (initialize())
+  {
+    GeomAPI_Shape::ShapeType aType1 = getShapeType(theObject1);
+    GeomAPI_Shape::ShapeType aType2 = getShapeType(theObject2);
+    GeomAPI_Shape::ShapeType aType3 = getShapeType(theObject3);
+    if (aType1 == GeomAPI_Shape::FACE
+        && aType2 == GeomAPI_Shape::FACE
+        && aType3 == GeomAPI_Shape::FACE)
+    {
+      setByPlanesIntersection(theObject1, theObject2, theObject3);
+    }
+  }
+}
+
 //==================================================================================================
 ConstructionAPI_Point::~ConstructionAPI_Point()
 {
@@ -152,37 +173,53 @@ void ConstructionAPI_Point::setByProjectionOnFace(const ModelHighAPI_Selection&
   execute();
 }
 
-/*
 //==================================================================================================
 void ConstructionAPI_Point::setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
                                                    const ModelHighAPI_Selection& theEdge2)
 {
-  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_LINES_INTERSECTION(), mycreationMethod);
-  fillAttribute(theEdge1, myfirstLine);
-  fillAttribute(theEdge2, mysecondLine);
+  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_INTERSECTION(), mycreationMethod);
+  fillAttribute(ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINES(),
+                myintersectionType);
+  fillAttribute(theEdge1, myintersectionLine1);
+  fillAttribute(theEdge2, myintersectionLine2);
 
   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_INTERSECTION(), mycreationMethod);
+  fillAttribute(ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINE_AND_PLANE(),
+                myintersectionType);
   fillAttribute(theEdge, myintersectionLine);
   fillAttribute(theFace, myintersectionPlane);
   fillAttribute("", useOffset()); // not used by default
   execute();
 }
 
+//==================================================================================================
+void ConstructionAPI_Point::setByPlanesIntersection(const ModelHighAPI_Selection& theFace1,
+                                                    const ModelHighAPI_Selection& theFace2,
+                                                    const ModelHighAPI_Selection& theFace3)
+{
+  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_INTERSECTION(), mycreationMethod);
+  fillAttribute(ConstructionPlugin_Point::INTERSECTION_TYPE_BY_PLANES(),
+                myintersectionType);
+  fillAttribute(theFace1, myintersectionPlane1);
+  fillAttribute(theFace2, myintersectionPlane2);
+  fillAttribute(theFace3, myintersectionPlane3);
+
+  execute();
+}
+
 //==================================================================================================
 void ConstructionAPI_Point::dump(ModelHighAPI_Dumper& theDumper) const
 {
   FeaturePtr aBase = feature();
   const std::string& aDocName = theDumper.name(aBase->document());
-  const std::string& aMeth = creationMethod()->value();
+  const std::string aMeth = creationMethod()->value();
 
   // common part
   theDumper << aBase << " = model.addPoint(" << aDocName << ", ";
@@ -190,10 +227,24 @@ void ConstructionAPI_Point::dump(ModelHighAPI_Dumper& theDumper) const
   if (aMeth == "" || // default is XYZ
       aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ()) {
     theDumper << x() << ", " << y() << ", " << z();
-  } 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();
+  } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_INTERSECTION()) {
+    const std::string anIntersectionType = intersectionType()->value();
+    if (anIntersectionType == ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINES())
+    {
+      theDumper << intersectionLine1() << ", " << intersectionLine2();
+    }
+    else if (anIntersectionType == ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINE_AND_PLANE())
+    {
+      theDumper << intersectionLine() << ", " << intersectionPlane();
+      if (!useOffset()->value().empty()) { // call method with defined offset
+        theDumper << ", " << offset() << ", " << reverseOffset();
+      }
+    }
+    else if (anIntersectionType == ConstructionPlugin_Point::INTERSECTION_TYPE_BY_PLANES())
+    {
+      theDumper << intersectionPlane1() << ", "
+                << intersectionPlane2() << ", "
+                << intersectionPlane3();
     }
   } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_DISTANCE_ON_EDGE()) {
     theDumper << edge() << ", ";
@@ -262,3 +313,13 @@ PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
 
   return anAPI;
 }
+
+//==================================================================================================
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+                  const ModelHighAPI_Selection& theObject1,
+                  const ModelHighAPI_Selection& theObject2,
+                  const ModelHighAPI_Selection& theObject3)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
+  return PointPtr(new ConstructionAPI_Point(aFeature, theObject1, theObject2, theObject3));
+}
index a6145dc4774ae28cf55ad484b3c05afc67e7933c..247a5c22bc6243291396ba6de1e6a2fcf1f9fc44 100644 (file)
@@ -63,20 +63,39 @@ public:
                         const ModelHighAPI_Selection& theObject1,
                         const ModelHighAPI_Selection& theObject2);
 
+  /// 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& theObject3);
+
   /// Destructor.
   CONSTRUCTIONAPI_EXPORT
   virtual ~ConstructionAPI_Point();
 
-  INTERFACE_18(ConstructionPlugin_Point::ID(),
+  INTERFACE_24(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 */,
                creationMethod, ConstructionPlugin_Point::CREATION_METHOD(),
                ModelAPI_AttributeString, /** Creation method */,
+               intersectionType, ConstructionPlugin_Point::INTERSECTION_TYPE(),
+               ModelAPI_AttributeString, /** Type of the intersection */,
+               intersectionLine1, ConstructionPlugin_Point::INTERSECTION_LINE_1(),
+               ModelAPI_AttributeSelection, /** Line for intersection */,
+               intersectionLine2, ConstructionPlugin_Point::INTERSECTION_LINE_2(),
+               ModelAPI_AttributeSelection, /** Line for intersection */,
                intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(),
                ModelAPI_AttributeSelection, /** Line for intersection */,
                intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(),
                ModelAPI_AttributeSelection, /** Plane for intersection */,
+               intersectionPlane1, ConstructionPlugin_Point::INTERSECTION_PLANE_1(),
+               ModelAPI_AttributeSelection, /** Plane for intersection */,
+               intersectionPlane2, ConstructionPlugin_Point::INTERSECTION_PLANE_2(),
+               ModelAPI_AttributeSelection, /** Plane for intersection */,
+               intersectionPlane3, ConstructionPlugin_Point::INTERSECTION_PLANE_3(),
+               ModelAPI_AttributeSelection, /** Plane for intersection */,
                useOffset, ConstructionPlugin_Point::USE_OFFSET(),
                ModelAPI_AttributeString, /** Use offset */,
                offset, ConstructionPlugin_Point::OFFSET(),
@@ -126,18 +145,22 @@ public:
   void setByProjectionOnFace(const ModelHighAPI_Selection& theVertex,
                              const ModelHighAPI_Selection& theFace);
 
-  /*
   /// Set lines for intersections.
   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);
 
+  /// Set faces for intersections.
+  CONSTRUCTIONAPI_EXPORT
+  void setByPlanesIntersection(const ModelHighAPI_Selection& theFace1,
+                               const ModelHighAPI_Selection& theFace2,
+                               const ModelHighAPI_Selection& theFace3);
+
   /// Dump wrapped feature
   CONSTRUCTIONAPI_EXPORT
   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
@@ -180,4 +203,12 @@ PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
                   const ModelHighAPI_Double& theDistanceValue,
                   const bool theReverse = false);
 
+/// \ingroup CPPHighAPI
+/// \brief Create Point feature as an intersection of selected planes
+CONSTRUCTIONAPI_EXPORT
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+                  const ModelHighAPI_Selection& theObject1,
+                  const ModelHighAPI_Selection& theObject2,
+                  const ModelHighAPI_Selection& theObject3);
+
 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */
index e9c42f29915aafe3a676bbff5ed45aeab07798dd..919c7dcf23e8688368ac78ed06aad390f82b1cd2 100644 (file)
@@ -78,7 +78,9 @@ INCLUDE_DIRECTORIES(
 ADD_UNIT_TESTS(TestAxisCreation.py
                UnitTestAxis.py
                TestPoint_XYZ.py
-               TestPoint_LineAndPlane.py
+               TestPoint_IntersectLines.py
+               TestPoint_IntersectLineAndPlane.py
+               TestPoint_IntersectPlanes.py
                TestPoint_Edge.py
                TestPoint_ProjectOnEdge.py
                TestPoint_ProjectOnFace.py
index a9f231b8246e11fa14ab5eb9b98677a2b53b0707..3eaecc591c14106c2b7948e6f3e7ee54b2f8bdca 100644 (file)
@@ -52,6 +52,8 @@ ConstructionPlugin_Plugin::ConstructionPlugin_Plugin()
                               new ConstructionPlugin_ValidatorPlaneTwoParallelPlanes());
   aFactory->registerValidator("ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes",
                               new ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes());
+  aFactory->registerValidator("ConstructionPlugin_ValidatorPointThreeNonParallelPlanes",
+                              new ConstructionPlugin_ValidatorPointThreeNonParallelPlanes());
 
   Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_size", "Size", Config_Prop::DblSpin,
                                    PLANE_SIZE);
index 400824b7d4b78157c4615492d9fc37f6faca007a..e6ee010c24e08c03c7eb08ae2809a6a1523a1a24 100644 (file)
@@ -55,14 +55,11 @@ void ConstructionPlugin_Point::initAttributes()
 
   data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
 
-/*
-  data()->addAttribute(FIRST_LINE(), ModelAPI_AttributeSelection::typeId());
-  data()->addAttribute(SECOND_LINE(), ModelAPI_AttributeSelection::typeId());
-*/
+  data()->addAttribute(INTERSECTION_LINE_1(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(INTERSECTION_LINE_2(), ModelAPI_AttributeSelection::typeId());
 
   data()->addAttribute(INTERSECTION_LINE(), 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());
@@ -77,6 +74,12 @@ void ConstructionPlugin_Point::initAttributes()
   data()->addAttribute(PROJECTION_TYPE(), ModelAPI_AttributeString::typeId());
   data()->addAttribute(EDGE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection::typeId());
   data()->addAttribute(FACE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection::typeId());
+
+  data()->addAttribute(INTERSECTION_TYPE(), ModelAPI_AttributeString::typeId());
+
+  data()->addAttribute(INTERSECTION_PLANE_1(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(INTERSECTION_PLANE_2(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(INTERSECTION_PLANE_3(), ModelAPI_AttributeSelection::typeId());
 }
 
 //==================================================================================================
@@ -98,22 +101,27 @@ void ConstructionPlugin_Point::execute()
     } else {
       aShape = createByProjectionOnFace();
     }
-  } /* else if(aCreationMethod == CREATION_METHOD_BY_LINES_INTERSECTION()) {
-    aShape = createByLinesIntersection();
-  } */ else if(aCreationMethod == CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()) {
-    // this may produce several points
-    std::list<std::shared_ptr<GeomAPI_Vertex> > aPoints = createByLineAndPlaneIntersection();
-    if (!aPoints.empty()) { // if no points found produce the standard error later
-      int anIndex = 0;
-      std::list<std::shared_ptr<GeomAPI_Vertex> >::iterator aPIter = aPoints.begin();
-      for(; aPIter != aPoints.end(); aPIter++, anIndex++) {
-        std::shared_ptr<ModelAPI_ResultConstruction> aConstr =
-          document()->createConstruction(data(), anIndex);
-        aConstr->setShape(*aPIter);
-        setResult(aConstr, anIndex);
+  } else if(aCreationMethod == CREATION_METHOD_BY_INTERSECTION()) {
+    std::string anIntersectionType = string(INTERSECTION_TYPE())->value();
+    if (anIntersectionType == INTERSECTION_TYPE_BY_LINES()) {
+      aShape = createByLinesIntersection();
+    } else if (anIntersectionType == INTERSECTION_TYPE_BY_LINE_AND_PLANE()) {
+      // this may produce several points
+      std::list<std::shared_ptr<GeomAPI_Vertex> > aPoints = createByLineAndPlaneIntersection();
+      if (!aPoints.empty()) { // if no points found produce the standard error later
+        int anIndex = 0;
+        std::list<std::shared_ptr<GeomAPI_Vertex> >::iterator aPIter = aPoints.begin();
+        for (; aPIter != aPoints.end(); aPIter++, anIndex++) {
+          std::shared_ptr<ModelAPI_ResultConstruction> aConstr =
+            document()->createConstruction(data(), anIndex);
+          aConstr->setShape(*aPIter);
+          setResult(aConstr, anIndex);
+        }
+        removeResults(anIndex);
+        return;
       }
-      removeResults(anIndex);
-      return;
+    } else {
+      aShape = createByPlanesIntersection();
     }
   }
 
@@ -219,12 +227,11 @@ std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByProjectionOnFa
   return GeomAlgoAPI_PointBuilder::vertexByProjection(aVertex, aFace);
 }
 
-/*
 //==================================================================================================
 std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByLinesIntersection()
 {
   // Get first line.
-  AttributeSelectionPtr aFirstLineSelection= selection(FIRST_LINE());
+  AttributeSelectionPtr aFirstLineSelection= selection(INTERSECTION_LINE_1());
   GeomShapePtr aFirstLineShape = aFirstLineSelection->value();
   if(!aFirstLineShape.get()) {
     aFirstLineShape = aFirstLineSelection->context()->shape();
@@ -232,7 +239,7 @@ std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByLinesIntersect
   std::shared_ptr<GeomAPI_Edge> aFirstEdge(new GeomAPI_Edge(aFirstLineShape));
 
   // Get second line.
-  AttributeSelectionPtr aSecondLineSelection= selection(SECOND_LINE());
+  AttributeSelectionPtr aSecondLineSelection= selection(INTERSECTION_LINE_2());
   GeomShapePtr aSecondLineShape = aSecondLineSelection->value();
   if(!aSecondLineShape.get()) {
     aSecondLineShape = aSecondLineSelection->context()->shape();
@@ -241,7 +248,6 @@ std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByLinesIntersect
 
   return GeomAlgoAPI_PointBuilder::vertexByIntersection(aFirstEdge, aSecondEdge);
 }
-*/
 
 //==================================================================================================
 std::list<std::shared_ptr<GeomAPI_Vertex> >
@@ -275,3 +281,48 @@ std::list<std::shared_ptr<GeomAPI_Vertex> >
   return GeomAlgoAPI_ShapeTools::intersect(anEdge, aFace,
     aPlaneSelection->context()->groupName() == ModelAPI_ResultConstruction::group());
 }
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByPlanesIntersection()
+{
+  // Get plane.
+  AttributeSelectionPtr aPlaneSelection1 = selection(INTERSECTION_PLANE_1());
+  GeomShapePtr aPlaneShape1 = aPlaneSelection1->value();
+  if (!aPlaneShape1.get()) {
+    aPlaneShape1 = aPlaneSelection1->context()->shape();
+  }
+  std::shared_ptr<GeomAPI_Face> aFace1(new GeomAPI_Face(aPlaneShape1));
+  std::shared_ptr<GeomAPI_Pln> aPln1 = aFace1->getPlane();
+
+  // Get plane.
+  AttributeSelectionPtr aPlaneSelection2 = selection(INTERSECTION_PLANE_2());
+  GeomShapePtr aPlaneShape2 = aPlaneSelection2->value();
+  if (!aPlaneShape2.get()) {
+    aPlaneShape2 = aPlaneSelection2->context()->shape();
+  }
+  std::shared_ptr<GeomAPI_Face> aFace2(new GeomAPI_Face(aPlaneShape2));
+  std::shared_ptr<GeomAPI_Pln> aPln2 = aFace2->getPlane();
+
+  // Get plane.
+  AttributeSelectionPtr aPlaneSelection3 = selection(INTERSECTION_PLANE_3());
+  GeomShapePtr aPlaneShape3 = aPlaneSelection3->value();
+  if (!aPlaneShape3.get()) {
+    aPlaneShape3 = aPlaneSelection3->context()->shape();
+  }
+  std::shared_ptr<GeomAPI_Face> aFace3(new GeomAPI_Face(aPlaneShape3));
+  std::shared_ptr<GeomAPI_Pln> aPln3 = aFace3->getPlane();
+
+  std::shared_ptr<GeomAPI_Vertex> aVertex;
+
+  std::shared_ptr<GeomAPI_Lin> anIntersectLine = aPln1->intersect(aPln2);
+  if (!anIntersectLine.get()) {
+    return aVertex;
+  }
+
+  std::shared_ptr<GeomAPI_Pnt> aPnt = aPln3->intersect(anIntersectLine);
+  if (aPnt.get()) {
+    aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
+  }
+
+  return aVertex;
+}
index 0f4103b4948f54fd8988107ccccfd96d2f6974bb..49db67df9ab6e6a2db8f6707e59fcc6daf50ef51 100644 (file)
@@ -75,19 +75,10 @@ public:
     return MY_CREATION_METHOD_ID;
   }
 
-  /*
   /// Attribute name for creation method.
-  inline static const std::string& CREATION_METHOD_BY_LINES_INTERSECTION()
+  inline static const std::string& CREATION_METHOD_BY_INTERSECTION()
   {
-    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");
+    static const std::string MY_CREATION_METHOD_ID("by_intersection");
     return MY_CREATION_METHOD_ID;
   }
 
@@ -203,21 +194,47 @@ public:
     return ATTR_ID;
   }
 
-  /*
-  /// Attribute name for selected first line.
-  inline static const std::string& FIRST_LINE()
+  /// Attribute name for intersection type.
+  inline static const std::string& INTERSECTION_TYPE()
   {
-    static const std::string ATTR_ID("first_line");
+    static const std::string ATTR_ID("intersection_type");
     return ATTR_ID;
   }
 
-  /// Attribute name for selected second line.
-  inline static const std::string& SECOND_LINE()
+  /// Attribute name for intersection type by lines.
+  inline static const std::string& INTERSECTION_TYPE_BY_LINES()
   {
-    static const std::string ATTR_ID("second_line");
+    static const std::string MY_CREATION_METHOD_ID("intersection_type_by_lines");
+    return MY_CREATION_METHOD_ID;
+  }
+
+  /// Attribute name for intersection type by line and plane.
+  inline static const std::string& INTERSECTION_TYPE_BY_LINE_AND_PLANE()
+  {
+    static const std::string MY_CREATION_METHOD_ID("intersection_type_by_line_and_plane");
+    return MY_CREATION_METHOD_ID;
+  }
+
+  /// Attribute name for intersection type by planes.
+  inline static const std::string& INTERSECTION_TYPE_BY_PLANES()
+  {
+    static const std::string MY_CREATION_METHOD_ID("intersection_type_by_planes");
+    return MY_CREATION_METHOD_ID;
+  }
+
+  /// Attribute name for selected first intersection line.
+  inline static const std::string& INTERSECTION_LINE_1()
+  {
+    static const std::string ATTR_ID("intersection_line_1");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for selected second intersection line.
+  inline static const std::string& INTERSECTION_LINE_2()
+  {
+    static const std::string ATTR_ID("intersection_line_2");
     return ATTR_ID;
   }
-  */
 
   /// Attribute name for selected intersection line.
   inline static const std::string& INTERSECTION_LINE()
@@ -254,6 +271,27 @@ public:
     return ATTR_ID;
   }
 
+  /// Attribute name for selected intersection plane.
+  inline static const std::string& INTERSECTION_PLANE_1()
+  {
+    static const std::string ATTR_ID("intersection_plane_1");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for selected intersection plane.
+  inline static const std::string& INTERSECTION_PLANE_2()
+  {
+    static const std::string ATTR_ID("intersection_plane_2");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for selected intersection plane.
+  inline static const std::string& INTERSECTION_PLANE_3()
+  {
+    static const std::string ATTR_ID("intersection_plane_3");
+    return ATTR_ID;
+  }
+
   /// Creates a new part document if needed.
   CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
 
@@ -275,9 +313,9 @@ private:
   std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
   std::shared_ptr<GeomAPI_Vertex> createByProjectionOnEdge();
   std::shared_ptr<GeomAPI_Vertex> createByProjectionOnFace();
-  /*std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();*/
+  std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();
   std::list<std::shared_ptr<GeomAPI_Vertex> > createByLineAndPlaneIntersection();
-
+  std::shared_ptr<GeomAPI_Vertex> createByPlanesIntersection();
 };
 
 #endif
index 146e3055af468545c0cf0ab585acd1b943e8ca28..2390b83a4eec2b9e9327890a0c3d83f748dc02c5 100644 (file)
@@ -83,6 +83,11 @@ bool ConstructionPlugin_ValidatorPointLines::isValid(const AttributePtr& theAttr
   std::shared_ptr<GeomAPI_Lin> aLine1 = aLineEdge1->line();
   std::shared_ptr<GeomAPI_Lin> aLine2 = aLineEdge2->line();
 
+  if (!aLine1.get() || !aLine2.get()) {
+    theError = "Selected edge is not a line.";
+    return false;
+  }
+
   if(!aLine1->isCoplanar(aLine2)) {
     theError = "Selected lines not coplanar.";
     return false;
@@ -392,6 +397,81 @@ bool ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes::isValid(
   return true;
 }
 
+//==================================================================================================
+bool ConstructionPlugin_ValidatorPointThreeNonParallelPlanes::isValid(
+  const AttributePtr& theAttribute,
+  const std::list<std::string>& theArguments,
+  Events_InfoMessage& theError) const
+{
+  FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
+
+  AttributeSelectionPtr anAttribute1 =
+    std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
+  AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front());
+  AttributeSelectionPtr anAttribute3 = aFeature->selection(theArguments.back());
+
+  GeomShapePtr aShape1 = anAttribute1->value();
+  ResultPtr aContext1 = anAttribute1->context();
+  if (!aContext1.get()) {
+    theError = "One of the attribute not initialized.";
+    return false;
+  }
+  if (!aShape1.get()) {
+    aShape1 = aContext1->shape();
+  }
+
+  std::shared_ptr<GeomAPI_Pln> aPln1 = getPln(aShape1);
+  if (!aPln1.get()) {
+    theError = "Wrong shape types selected.";
+    return false;
+  }
+  std::shared_ptr<GeomAPI_Dir> aDir1 = aPln1->direction();
+
+  if (anAttribute2.get()) {
+    GeomShapePtr aShape2 = anAttribute2->value();
+    ResultPtr aContext2 = anAttribute2->context();
+    if (!aShape2.get() && aContext2.get()) {
+      aShape2 = aContext2->shape();
+    }
+
+    if (aShape2.get()) {
+      std::shared_ptr<GeomAPI_Pln> aPln2 = getPln(aShape2);
+      if (!aPln2.get()) {
+        theError = "Wrong shape types selected.";
+        return false;
+      }
+      std::shared_ptr<GeomAPI_Dir> aDir2 = aPln2->direction();
+      if (aDir1->isParallel(aDir2)) {
+        theError = "Planes are parallel.";
+        return false;
+      }
+    }
+  }
+
+  if (anAttribute3.get()) {
+    GeomShapePtr aShape3 = anAttribute3->value();
+    ResultPtr aContext3 = anAttribute3->context();
+    if (!aShape3.get() && aContext3.get()) {
+      aShape3 = aContext3->shape();
+    }
+
+    if (aShape3.get()) {
+      std::shared_ptr<GeomAPI_Pln> aPln3 = getPln(aShape3);
+      if (!aPln3.get()) {
+        theError = "Wrong shape types selected.";
+        return false;
+      }
+      std::shared_ptr<GeomAPI_Dir> aDir3 = aPln3->direction();
+      if (aDir1->isParallel(aDir3)) {
+        theError = "Planes are parallel.";
+        return false;
+      }
+    }
+  }
+
+  return true;
+}
+
 std::shared_ptr<GeomAPI_Edge> getEdge(const GeomShapePtr theShape)
 {
   if(!theShape->isEdge()) {
index 3254672de855045b8786492e870c7e97ecd00c63..e5dbdd2891c53a6cfc299ffff0e2bf0f57b75da6 100644 (file)
@@ -113,4 +113,19 @@ public:
                         Events_InfoMessage& theError) const;
 };
 
+/// \class ConstructionPlugin_ValidatorPointThreeNonParallelPlanes
+/// \ingroup Validators
+/// \brief A validator for selection three non parallel planes.
+class ConstructionPlugin_ValidatorPointThreeNonParallelPlanes: public ModelAPI_AttributeValidator
+{
+public:
+  //! \return True if the attribute is valid.
+  //! \param[in] theAttribute the checked attribute.
+  //! \param[in] theArguments arguments of the attribute.
+  //! \param[out] theError error message.
+  virtual bool isValid(const AttributePtr& theAttribute,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+};
+
 #endif
\ No newline at end of file
diff --git a/src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py b/src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.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_IntersectLines.py b/src/ConstructionPlugin/Test/TestPoint_IntersectLines.py
new file mode 100644 (file)
index 0000000..f3b0847
--- /dev/null
@@ -0,0 +1,51 @@
+## 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 lines intersection.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchLine_1 = Sketch_1.addLine(-50, 50, 50, 50)
+model.do()
+Box_1 = model.addBox(Part_1_doc, 25, 100, 100)
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Box_1_1/Back&Box_1_1/Bottom"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom"))
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(0, 50, 0)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(25, 50, 0)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
diff --git a/src/ConstructionPlugin/Test/TestPoint_IntersectPlanes.py b/src/ConstructionPlugin/Test/TestPoint_IntersectPlanes.py
new file mode 100644 (file)
index 0000000..16d8977
--- /dev/null
@@ -0,0 +1,50 @@
+## 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 planes intersection.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Point_2 = model.addPoint(Part_1_doc, 50, 50, 50)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OY"), model.selection("VERTEX", "Point_1"), False)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OX"), model.selection("VERTEX", "Point_1"), False)
+Plane_6 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OZ"), model.selection("VERTEX", "Point_1"), True)
+Point_3 = model.addPoint(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_3"))
+Box_1 = model.addBox(Part_1_doc, 50, 25, 100)
+Point_4 = model.addPoint(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_3"), model.selection("FACE", "Box_1_1/Right"))
+model.do()
+model.end()
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(50, 50, 50)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_4.results()) > 0)
+rightPosition = GeomAPI_Vertex(50, 25, 50)
+assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
diff --git a/src/ConstructionPlugin/Test/TestPoint_LineAndPlane.py b/src/ConstructionPlugin/Test/TestPoint_LineAndPlane.py
deleted file mode 100644 (file)
index 635ab81..0000000
+++ /dev/null
@@ -1,55 +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 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/icons/point_by_intersection_32x32.png b/src/ConstructionPlugin/icons/point_by_intersection_32x32.png
new file mode 100644 (file)
index 0000000..ae3fb79
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_intersection_32x32.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_line_and_plane_intersection_24x24.png b/src/ConstructionPlugin/icons/point_by_line_and_plane_intersection_24x24.png
new file mode 100644 (file)
index 0000000..1955e2e
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_line_and_plane_intersection_24x24.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_lines_intersection_24x24.png b/src/ConstructionPlugin/icons/point_by_lines_intersection_24x24.png
new file mode 100644 (file)
index 0000000..4a01f70
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_lines_intersection_24x24.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_planes_intersection_24x24.png b/src/ConstructionPlugin/icons/point_by_planes_intersection_24x24.png
new file mode 100644 (file)
index 0000000..6d5966a
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_planes_intersection_24x24.png differ
index 8fb77b2a7388f853d96339bd51cdc3aff3895d17..00b4caf8ba18c22c91c81a7315c1a74c9fb997f5 100644 (file)
@@ -118,53 +118,100 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
         </box>
       </toolbox>
     </box>
-<!--
-    <box id="by_lines_intersection"
-         title="By two lines intersection"
-         tooltip="Point by intersection of two coplanar lines."
-         icon="icons/Construction/point_by_lines_intersection_32x32.png">
-      <shape_selector id="first_line"
-                      label="First line"
-                      tooltip="First line."
-                      icon="icons/Construction/edge.png"
-                      shape_types="edge">
-        <validator id="GeomValidators_ShapeType" parameters="line"/>
-        <validator id="ConstructionPlugin_ValidatorPointLines" parameters="second_line"/>
-      </shape_selector>
-      <shape_selector id="second_line"
-                      label="Second line"
-                      tooltip="Second line."
-                      icon="icons/Construction/edge.png"
-                      shape_types="edge">
-        <validator id="GeomValidators_ShapeType" parameters="line"/>
-        <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."
-         icon="icons/Construction/point_by_line_and_plane_intersection_32x32.png">
-      <shape_selector id="intersection_line"
-                      label="Line"
-                      tooltip="Line for intersection."
-                      icon="icons/Construction/edge.png"
-                      shape_types="edge">
-        <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel" parameters="intersection_plane"/>
-      </shape_selector>
-      <shape_selector id="intersection_plane"
-                      label="Plane"
-                      tooltip="Plane for intersection."
-                      icon="icons/Construction/face.png"
-                      shape_types="face">
-        <validator id="GeomValidators_Face" parameters="plane"/>
-        <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 id="by_intersection"
+         title="By intersection of objects"
+         tooltip="Point on intersection of different objects."
+         icon="icons/Construction/point_by_intersection_32x32.png">
+      <toolbox id="intersection_type">
+        <box id="intersection_type_by_lines"
+             title="By two lines intersection"
+             tooltip="Point by intersection of two coplanar lines."
+             icon="icons/Construction/point_by_lines_intersection_24x24.png">
+          <shape_selector id="intersection_line_1"
+                          label="First line"
+                          tooltip="First line."
+                          icon="icons/Construction/edge.png"
+                          shape_types="edge">
+            <validator id="GeomValidators_ShapeType" parameters="line"/>
+            <validator id="ConstructionPlugin_ValidatorPointLines"
+                       parameters="intersection_line_2"/>
+          </shape_selector>
+          <shape_selector id="intersection_line_2"
+                          label="Second line"
+                          tooltip="Second line."
+                          icon="icons/Construction/edge.png"
+                          shape_types="edge">
+            <validator id="GeomValidators_ShapeType" parameters="line"/>
+            <validator id="ConstructionPlugin_ValidatorPointLines"
+                       parameters="intersection_line_1"/>
+          </shape_selector>
+        </box>
+        <box id="intersection_type_by_line_and_plane"
+             title="By line and plane intersection"
+             tooltip="Point by intersection of line and plane."
+             icon="icons/Construction/point_by_line_and_plane_intersection_24x24.png">
+          <shape_selector id="intersection_line"
+                          label="Line"
+                          tooltip="Line for intersection."
+                          icon="icons/Construction/edge.png"
+                          shape_types="edge">
+            <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel"
+                       parameters="intersection_plane"/>
+          </shape_selector>
+          <shape_selector id="intersection_plane"
+                          label="Plane"
+                          tooltip="Plane for intersection."
+                          icon="icons/Construction/face.png"
+                          shape_types="face">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+            <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>
+        <box id="intersection_type_by_planes"
+             title="By three planes intersection"
+             tooltip="Point by intersection of three planes."
+             icon="icons/Construction/point_by_planes_intersection_24x24.png">
+          <shape_selector id="intersection_plane_1"
+                          label="1st plane"
+                          tooltip="Select a planar face."
+                          icon="icons/Construction/face.png"
+                          shape_types="face">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+            <validator id="ConstructionPlugin_ValidatorPointThreeNonParallelPlanes"
+                       parameters="intersection_plane_2, intersection_plane_3"/>
+          </shape_selector>
+          <shape_selector id="intersection_plane_2"
+                          label="2nd plane"
+                          tooltip="Select a planar face."
+                          icon="icons/Construction/face.png"
+                          shape_types="face">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+            <validator id="ConstructionPlugin_ValidatorPointThreeNonParallelPlanes"
+                       parameters="intersection_plane_1, intersection_plane_3"/>
+          </shape_selector>
+          <shape_selector id="intersection_plane_3"
+                          label="3rd plane"
+                          tooltip="Select a planar face."
+                          icon="icons/Construction/face.png"
+                          shape_types="face">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+            <validator id="ConstructionPlugin_ValidatorPointThreeNonParallelPlanes"
+                       parameters="intersection_plane_1, intersection_plane_2"/>
+          </shape_selector>
+        </box>
+        </toolbox>
     </box>
-
   </toolbox>
 </source>
index a03e9e72d85e5a0cf6fcce36deeeaf79e7e6a29a..13ced7b69638c5c1f0a6ee8de31d7d19f1cf6aeb 100644 (file)
     END_INIT() \
   public:
 
+//--------------------------------------------------------------------------------------
+#define INTERFACE_24(KIND, \
+                     N_0, AN_0, T_0, C_0, \
+                     N_1, AN_1, T_1, C_1, \
+                     N_2, AN_2, T_2, C_2, \
+                     N_3, AN_3, T_3, C_3, \
+                     N_4, AN_4, T_4, C_4, \
+                     N_5, AN_5, T_5, C_5, \
+                     N_6, AN_6, T_6, C_6, \
+                     N_7, AN_7, T_7, C_7, \
+                     N_8, AN_8, T_8, C_8, \
+                     N_9, AN_9, T_9, C_9, \
+                     N_10, AN_10, T_10, C_10, \
+                     N_11, AN_11, T_11, C_11, \
+                     N_12, AN_12, T_12, C_12, \
+                     N_13, AN_13, T_13, C_13, \
+                     N_14, AN_14, T_14, C_14, \
+                     N_15, AN_15, T_15, C_15, \
+                     N_16, AN_16, T_16, C_16, \
+                     N_17, AN_17, T_17, C_17, \
+                     N_18, AN_18, T_18, C_18, \
+                     N_19, AN_19, T_19, C_19, \
+                     N_20, AN_20, T_20, C_20, \
+                     N_21, AN_21, T_21, C_21, \
+                     N_22, AN_22, T_22, C_22, \
+                     N_23, AN_23, T_23, C_23) \
+  public: \
+    INTERFACE_COMMON(KIND) \
+    DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+    DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+    DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+    DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+    DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+    DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+    DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+    DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+    DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+    DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+    DEFINE_ATTRIBUTE(N_10, T_10, C_10) \
+    DEFINE_ATTRIBUTE(N_11, T_11, C_11) \
+    DEFINE_ATTRIBUTE(N_12, T_12, C_12) \
+    DEFINE_ATTRIBUTE(N_13, T_13, C_13) \
+    DEFINE_ATTRIBUTE(N_14, T_14, C_14) \
+    DEFINE_ATTRIBUTE(N_15, T_15, C_15) \
+    DEFINE_ATTRIBUTE(N_16, T_16, C_16) \
+    DEFINE_ATTRIBUTE(N_17, T_17, C_17) \
+    DEFINE_ATTRIBUTE(N_18, T_18, C_18) \
+    DEFINE_ATTRIBUTE(N_19, T_19, C_19) \
+    DEFINE_ATTRIBUTE(N_20, T_20, C_20) \
+    DEFINE_ATTRIBUTE(N_21, T_21, C_21) \
+    DEFINE_ATTRIBUTE(N_22, T_22, C_22) \
+    DEFINE_ATTRIBUTE(N_23, T_23, C_23) \
+  protected: \
+    START_INIT() \
+      SET_ATTRIBUTE(N_0, T_0, AN_0) \
+      SET_ATTRIBUTE(N_1, T_1, AN_1) \
+      SET_ATTRIBUTE(N_2, T_2, AN_2) \
+      SET_ATTRIBUTE(N_3, T_3, AN_3) \
+      SET_ATTRIBUTE(N_4, T_4, AN_4) \
+      SET_ATTRIBUTE(N_5, T_5, AN_5) \
+      SET_ATTRIBUTE(N_6, T_6, AN_6) \
+      SET_ATTRIBUTE(N_7, T_7, AN_7) \
+      SET_ATTRIBUTE(N_8, T_8, AN_8) \
+      SET_ATTRIBUTE(N_9, T_9, AN_9) \
+      SET_ATTRIBUTE(N_10, T_10, AN_10) \
+      SET_ATTRIBUTE(N_11, T_11, AN_11) \
+      SET_ATTRIBUTE(N_12, T_12, AN_12) \
+      SET_ATTRIBUTE(N_13, T_13, AN_13) \
+      SET_ATTRIBUTE(N_14, T_14, AN_14) \
+      SET_ATTRIBUTE(N_15, T_15, AN_15) \
+      SET_ATTRIBUTE(N_16, T_16, AN_16) \
+      SET_ATTRIBUTE(N_17, T_17, AN_17) \
+      SET_ATTRIBUTE(N_18, T_18, AN_18) \
+      SET_ATTRIBUTE(N_19, T_19, AN_19) \
+      SET_ATTRIBUTE(N_20, T_20, AN_20) \
+      SET_ATTRIBUTE(N_21, T_21, AN_21) \
+      SET_ATTRIBUTE(N_22, T_22, AN_22) \
+      SET_ATTRIBUTE(N_23, T_23, AN_23) \
+    END_INIT() \
+  public:
+
 //--------------------------------------------------------------------------------------
 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_MACRO_H_ */