]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
2.3.2 Point creation: on a line
authordbv <dbv@opencascade.com>
Fri, 22 Jun 2018 12:56:17 +0000 (15:56 +0300)
committerdbv <dbv@opencascade.com>
Sat, 23 Jun 2018 06:10:35 +0000 (09:10 +0300)
Implemented with toolbox widgets which should be later replaced by radio buttons.

src/ConstructionAPI/ConstructionAPI_Point.cpp
src/ConstructionAPI/ConstructionAPI_Point.h
src/ConstructionPlugin/CMakeLists.txt
src/ConstructionPlugin/ConstructionPlugin_Point.cpp
src/ConstructionPlugin/ConstructionPlugin_Point.h
src/ConstructionPlugin/Test/TestPoint_Edge.py [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_distance_on_edge_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_ratio_on_edge_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/point_widget.xml

index 48222cfc4e3c5384f6452d83744718b1778d0e0e..8d045791f3404bb4e4032f16246322e8e93dc3cf 100644 (file)
@@ -45,18 +45,18 @@ ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feat
   }
 }
 
-/*//==================================================================================================
+//==================================================================================================
 ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                              const ModelHighAPI_Selection& theEdge,
-                                             const ModelHighAPI_Double& theDistanceValue,
-                                             const bool theDistancePercent,
+                                             const ModelHighAPI_Double& theOffset,
+                                             const bool theUseRatio,
                                              const bool theReverse)
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    setByDistanceOnEdge(theEdge, theDistanceValue, theDistancePercent, theReverse);
+    setByOffsetOnEdge(theEdge, theOffset, theUseRatio, theReverse);
   }
-}*/
+}
 
 //==================================================================================================
 ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
@@ -101,21 +101,28 @@ void ConstructionAPI_Point::setByXYZ(const ModelHighAPI_Double& theX,
   execute(false);
 }
 
-/*//==================================================================================================
-void ConstructionAPI_Point::setByDistanceOnEdge(const ModelHighAPI_Selection& theEdge,
-                                                const ModelHighAPI_Double& theDistanceValue,
-                                                const bool theDistancePercent,
-                                                const bool theReverse)
+//==================================================================================================
+void ConstructionAPI_Point::setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge,
+                                              const ModelHighAPI_Double& theOffset,
+                                              const bool theUseRatio,
+                                              const bool theReverse)
 {
   fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_DISTANCE_ON_EDGE(), mycreationMethod);
   fillAttribute(theEdge, myedge);
-  fillAttribute(theDistanceValue, mydistanceValue);
-  fillAttribute(theDistancePercent, mydistancePercent);
+  if (theUseRatio) {
+    fillAttribute(ConstructionPlugin_Point::OFFSET_TYPE_BY_RATIO(), myoffsetType);
+    fillAttribute(theOffset, myratio);
+  }
+  else {
+    fillAttribute(ConstructionPlugin_Point::OFFSET_TYPE_BY_DISTANCE(), myoffsetType);
+    fillAttribute(theOffset, mydistance);
+  }
   fillAttribute(theReverse, myreverse);
 
   execute();
 }
 
+/*
 //==================================================================================================
 void ConstructionAPI_Point::setByProjection(const ModelHighAPI_Selection& theVertex,
                                             const ModelHighAPI_Selection& theFace)
@@ -136,7 +143,8 @@ void ConstructionAPI_Point::setByLinesIntersection(const ModelHighAPI_Selection&
   fillAttribute(theEdge2, mysecondLine);
 
   execute();
-}*/
+}
+*/
 
 //==================================================================================================
 void ConstructionAPI_Point::setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
@@ -170,6 +178,16 @@ void ConstructionAPI_Point::dump(ModelHighAPI_Dumper& theDumper) const
     }
     theDumper << ")" << std::endl;
   }
+  else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_DISTANCE_ON_EDGE()) {
+    theDumper << edge() << ", ";
+    if (offsetType()->value() == ConstructionPlugin_Point::OFFSET_TYPE_BY_DISTANCE()) {
+      theDumper << distance() << ", " << false;
+    }
+    else {
+      theDumper << ratio() << ", " << true;
+    }
+    theDumper << ", " << reverse()->value() << ")" << std::endl;
+  }
 }
 
 //==================================================================================================
@@ -182,16 +200,16 @@ PointPtr addPoint(const std::shared_ptr<ModelAPI_Document>& thePart,
   return PointPtr(new ConstructionAPI_Point(aFeature, theX, theY, theZ));
 }
 
-/*//==================================================================================================
+//==================================================================================================
 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
                   const ModelHighAPI_Selection& theEdge,
-                  const ModelHighAPI_Double& theDistanceValue,
-                  const bool theDistancePercent,
+                  const ModelHighAPI_Double& theOffset,
+                  const bool theUseRatio,
                   const bool theReverse)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
-  return PointPtr(new ConstructionAPI_Point(aFeature, theEdge, theDistanceValue, theDistancePercent, theReverse));
-}*/
+  return PointPtr(new ConstructionAPI_Point(aFeature, theEdge, theOffset, theUseRatio, theReverse));
+}
 
 //==================================================================================================
 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
index 322176c4a771da37892a58d1dd92790ada02ffea..087ea95e84711a92dfd6f0e4dc55ab1de6790879 100644 (file)
@@ -49,14 +49,14 @@ public:
                         const ModelHighAPI_Double& theY,
                         const ModelHighAPI_Double& theZ);
 
-  /*/// Constructor with values.
+  /// Constructor with values.
   CONSTRUCTIONAPI_EXPORT
   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                         const ModelHighAPI_Selection& theEdge,
-                        const ModelHighAPI_Double& theDistanceValue,
-                        const bool theDistancePercent = false,
+                        const ModelHighAPI_Double& theOffset,
+                        const bool theUseRatio = false,
                         const bool theReverse = false);
-  */
+
   /// Constructor with values: intersected objects.
   CONSTRUCTIONAPI_EXPORT
   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
@@ -67,22 +67,32 @@ public:
   CONSTRUCTIONAPI_EXPORT
   virtual ~ConstructionAPI_Point();
 
-  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 */,
-              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 */)
+  INTERFACE_14(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 */,
+               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 */,
+               edge, ConstructionPlugin_Point::EDGE(),
+               ModelAPI_AttributeSelection, /** Edge */,
+               offsetType, ConstructionPlugin_Point::OFFSET_TYPE(),
+               ModelAPI_AttributeString, /** Type of the offset on edge */,
+               distance, ConstructionPlugin_Point::DISTANCE(),
+               ModelAPI_AttributeDouble, /** Distance */,
+               ratio, ConstructionPlugin_Point::RATIO(),
+               ModelAPI_AttributeDouble, /** Ratio */,
+               reverse, ConstructionPlugin_Point::REVERSE(),
+               ModelAPI_AttributeBoolean, /** Reverse */)
 
 
   /// Set point values.
@@ -91,13 +101,14 @@ public:
                 const ModelHighAPI_Double & theY,
                 const ModelHighAPI_Double & theZ);
 
-  /*/// Set edge and distance on it for point.
+  /// Set edge and distance on it for point.
   CONSTRUCTIONAPI_EXPORT
-  void setByDistanceOnEdge(const ModelHighAPI_Selection& theEdge,
-                           const ModelHighAPI_Double& theDistanceValue,
-                           const bool theDistancePercent = false,
-                           const bool theReverse = false);
+  void setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge,
+                         const ModelHighAPI_Double& theOffset,
+                         const bool theUseRatio = false,
+                         const bool theReverse = false);
 
+  /*
   /// Set point and plane for projection.
   CONSTRUCTIONAPI_EXPORT
   void setByProjection(const ModelHighAPI_Selection& theVertex,
@@ -129,15 +140,15 @@ PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
                   const ModelHighAPI_Double & theY,
                   const ModelHighAPI_Double & theZ);
 
-/*/// \ingroup CPPHighAPI
+/// \ingroup CPPHighAPI
 /// \brief Create Point feature
 CONSTRUCTIONAPI_EXPORT
 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
                   const ModelHighAPI_Selection& theEdge,
-                  const ModelHighAPI_Double& theDistanceValue,
-                  const bool theDistancePercent = false,
+                  const ModelHighAPI_Double& theOffset,
+                  const bool theUseRatio = false,
                   const bool theReverse = false);
-*/
+
 /// \ingroup CPPHighAPI
 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
 CONSTRUCTIONAPI_EXPORT
index 0cbcec0492bf9101f1f075eb76bc8e953d89dea0..11cfdcedc106841b05ff604f13b72495b2f99f2a 100644 (file)
@@ -79,5 +79,6 @@ ADD_UNIT_TESTS(TestAxisCreation.py
                UnitTestAxis.py
                TestPoint_XYZ.py
                TestPoint_LineAndPlane.py
+               TestPoint_Edge.py
                TestPointName.py
                TestPlane.py)
index 08ff70a3a7a2ed8a7f5cdba439c975df2f0fe4ef..2081f4ed12a3ca764a9bb6f7f2b9f1c4dae33168 100644 (file)
@@ -55,23 +55,26 @@ void ConstructionPlugin_Point::initAttributes()
 
   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());
-  data()->addAttribute(REVERSE(), ModelAPI_AttributeBoolean::typeId());
-
+/*
   data()->addAttribute(POINT(), ModelAPI_AttributeSelection::typeId());
   data()->addAttribute(PLANE(), ModelAPI_AttributeSelection::typeId());
 
   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(USE_OFFSET(), ModelAPI_AttributeString::typeId());
   data()->addAttribute(OFFSET(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(REVERSE_OFFSET(), ModelAPI_AttributeBoolean::typeId());
+
+  data()->addAttribute(EDGE(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(OFFSET_TYPE(), ModelAPI_AttributeString::typeId());
+  data()->addAttribute(DISTANCE(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(RATIO(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(REVERSE(), ModelAPI_AttributeBoolean::typeId());
 }
 
 //==================================================================================================
@@ -85,9 +88,9 @@ void ConstructionPlugin_Point::execute()
     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()) {
+  }/* else if(aCreationMethod == CREATION_METHOD_BY_PROJECTION()) {
     aShape = createByProjection();
   } else if(aCreationMethod == CREATION_METHOD_BY_LINES_INTERSECTION()) {
     aShape = createByLinesIntersection();
@@ -138,7 +141,7 @@ std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByXYZ()
                                           real(Z())->value());
 }
 
-/*//==================================================================================================
+//==================================================================================================
 std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByDistanceOnEdge()
 {
   // Get edge.
@@ -150,15 +153,22 @@ std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByDistanceOnEdge
   std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShape));
 
   // Get distance value and percent flag.
-  double aValue = real(DISTANCE_VALUE())->value();
-  bool anIsPercent = boolean(DISTANCE_PERCENT())->value();
+  double aValue;
+  bool anIsPercent = false;
+  if (string(OFFSET_TYPE())->value() == OFFSET_TYPE_BY_DISTANCE()) {
+    aValue = real(DISTANCE())->value();
+    anIsPercent = false;
+  } else {
+    aValue = real(RATIO())->value() * 100.0;
+    anIsPercent = true;
+  }
 
   // Get reverse flag.
   bool anIsReverse = boolean(REVERSE())->value();
 
   return GeomAlgoAPI_PointBuilder::vertexOnEdge(anEdge, aValue, anIsPercent, anIsReverse);
 }
-
+/*
 //==================================================================================================
 std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByProjection()
 {
index f983ec3270015565d858b96836e67beecd008c14..7537970a86564e671d0b94c9cabef0e26611d266 100644 (file)
@@ -60,7 +60,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()
   {
@@ -68,6 +68,7 @@ public:
     return MY_CREATION_METHOD_ID;
   }
 
+  /*
   /// Attribute name for creation method.
   inline static const std::string& CREATION_METHOD_BY_PROJECTION()
   {
@@ -82,6 +83,7 @@ public:
     return MY_CREATION_METHOD_ID;
   }
   */
+
   /// Attribute name for creation method.
   inline static const std::string& CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()
   {
@@ -110,24 +112,45 @@ public:
     return POINT_ATTR_Z;
   }
 
-  /*/// Attribute name for selected edge.
+  /// Attribute name for selected edge.
   inline static const std::string& EDGE()
   {
     static const std::string ATTR_ID("edge");
     return ATTR_ID;
   }
 
+  /// Attribute name for offset type on selected edge.
+  inline static const std::string& OFFSET_TYPE()
+  {
+    static const std::string ATTR_ID("offset_type");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for offset type by distance.
+  inline static const std::string& OFFSET_TYPE_BY_DISTANCE()
+  {
+    static const std::string ATTR_ID("offset_type_by_distance");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for offset type by ratio.
+  inline static const std::string& OFFSET_TYPE_BY_RATIO()
+  {
+    static const std::string ATTR_ID("offset_type_by_ratio");
+    return ATTR_ID;
+  }
+
   /// Attribute name for distance.
-  inline static const std::string& DISTANCE_VALUE()
+  inline static const std::string& DISTANCE()
   {
-    static const std::string ATTR_ID("value");
+    static const std::string ATTR_ID("distance");
     return ATTR_ID;
   }
 
   /// Attribute name for percent flag.
-  inline static const std::string& DISTANCE_PERCENT()
+  inline static const std::string& RATIO()
   {
-    static const std::string ATTR_ID("percent");
+    static const std::string ATTR_ID("ratio");
     return ATTR_ID;
   }
 
@@ -138,6 +161,7 @@ public:
     return ATTR_ID;
   }
 
+  /*
   /// Attribute name for point.
   inline static const std::string& POINT()
   {
@@ -220,8 +244,8 @@ public:
 
 private:
   std::shared_ptr<GeomAPI_Vertex> createByXYZ();
-  /*std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
-  std::shared_ptr<GeomAPI_Vertex> createByProjection();
+  std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
+  /*std::shared_ptr<GeomAPI_Vertex> createByProjection();
   std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();*/
   std::list<std::shared_ptr<GeomAPI_Vertex> > createByLineAndPlaneIntersection();
 
diff --git a/src/ConstructionPlugin/Test/TestPoint_Edge.py b/src/ConstructionPlugin/Test/TestPoint_Edge.py
new file mode 100644 (file)
index 0000000..4f6c5ef
--- /dev/null
@@ -0,0 +1,67 @@
+## 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 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"))
+SketchLine_1 = Sketch_1.addLine(0, 0, 100, 100)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result())
+model.do()
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 50, False, False)
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 0.4, True, False)
+Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 0.4, True, True)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 50, 10)
+Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), 0.25, True, False)
+Point_6 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), 0.25, True, True)
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(35.3553390593, 35.3553390593, 0)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(40, 40, 0)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_4.results()) > 0)
+rightPosition = GeomAPI_Vertex(60, 60, 0)
+assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_5.results()) > 0)
+rightPosition = GeomAPI_Vertex(0, 50, 10)
+assert(rightPosition.isEqual(Point_5.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_6.results()) > 0)
+rightPosition = GeomAPI_Vertex(0, -50, 10)
+assert(rightPosition.isEqual(Point_6.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
diff --git a/src/ConstructionPlugin/icons/point_by_distance_on_edge_24x24.png b/src/ConstructionPlugin/icons/point_by_distance_on_edge_24x24.png
new file mode 100644 (file)
index 0000000..e00036b
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_distance_on_edge_24x24.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_ratio_on_edge_24x24.png b/src/ConstructionPlugin/icons/point_by_ratio_on_edge_24x24.png
new file mode 100644 (file)
index 0000000..ac0e749
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_ratio_on_edge_24x24.png differ
index 20f2f3cb9a553f37184ac9ddb5199261f3d5c868..47918c049522aca3a33fefd071ef1d2076e371f8 100644 (file)
@@ -41,7 +41,6 @@ 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."
@@ -53,22 +52,39 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       shape_types="edge">
         <validator id="GeomValidators_Finite"/>
       </shape_selector>
-      <groupbox title="Distance">
-        <doublevalue id="value"
-                     label="Value"
-                     tooltip="Distance value."
-                     icon="icons/Construction/distance_value.png"
-                     default="50"/>
-        <boolvalue id="percent"
-                   label="Percent(%)"
-                   tooltip="Distance in percent from length."
-                   default="true"/>
-      </groupbox>
+      <toolbox id="offset_type">
+        <box id="offset_type_by_distance"
+             title="Distance on edge by value"
+             tooltip="Point on an edge, at a given distance specified by value."
+             icon="icons/Construction/point_by_distance_on_edge_24x24.png">
+          <doublevalue id="distance"
+             label="Distance"
+             tooltip="Distance value."
+             icon="icons/Construction/distance_value.png"
+             min="0.0"
+             default="10">
+          </doublevalue>
+        </box>
+        <box id="offset_type_by_ratio"
+             title="Distance on edge by ratio"
+             tooltip="Point on an edge, at a given distance specified by ratio."
+             icon="icons/Construction/point_by_ratio_on_edge_24x24.png">
+          <doublevalue id="ratio"
+             label="Ratio"
+             tooltip="Ratio value."
+             icon="icons/Construction/distance_value.png"
+             min="0.0"
+             max="1.0"
+             default="0.5">
+          </doublevalue>
+        </box>
+      </toolbox>
       <boolvalue id="reverse"
            label="Reverse"
            tooltip="Distance from edge end point."
            default="false"/>
     </box>
+<!--
     <box id="by_projection"
          title="By projection"
          tooltip="Point on face surface by projection selected point."