]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix regressions in SketchPlugin unit tests
authorazv <azv@opencascade.com>
Tue, 1 Oct 2019 12:10:04 +0000 (15:10 +0300)
committerazv <azv@opencascade.com>
Tue, 1 Oct 2019 12:10:40 +0000 (15:10 +0300)
src/GeomAPI/GeomAPI_Curve.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp
src/SketchPlugin/Test/TestProjectionIntoResult.py

index fb5f034ab3df1e0a5601c534f88465ed45ab3f61..9c5330a86d9c1fb7dd1dfd738241d90b9f645603 100644 (file)
@@ -49,8 +49,6 @@ GeomAPI_Curve::GeomAPI_Curve(const std::shared_ptr<GeomAPI_Shape>& theShape)
   if (!anEdge.IsNull()) {
     Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, myStart, myEnd);
     if (!aCurve.IsNull()) {
-      if (!BRep_Tool::IsClosed(anEdge))
-        aCurve = new Geom_TrimmedCurve(aCurve, myStart, myEnd);
       setImpl(new Handle(Geom_Curve)(aCurve));
     }
   }
index 21a66fa026b54f5e0f92d1d1deb20a01ca8ca8bd..e85b9254fdc9478c80199260a2d364e6fe363ea4 100644 (file)
 #include <Geom_Plane.hxx>
 #include <GeomProjLib.hxx>
 
+#include <BRep_Tool.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+
 GeomAlgoAPI_Projection::GeomAlgoAPI_Projection(const GeomPlanePtr& thePlane)
   : myPlane(thePlane)
 {
@@ -46,6 +51,17 @@ GeomCurvePtr GeomAlgoAPI_Projection::project(const GeomCurvePtr& theCurve)
 
 GeomCurvePtr GeomAlgoAPI_Projection::project(const GeomEdgePtr& theEdge)
 {
-  GeomCurvePtr aCurve(new GeomAPI_Curve(theEdge));
+  GeomCurvePtr aCurve(new GeomAPI_Curve);
+
+  const TopoDS_Shape& aShape = theEdge->impl<TopoDS_Shape>();
+  TopoDS_Edge anEdge = TopoDS::Edge(aShape);
+  if (!anEdge.IsNull()) {
+    double aStart, aEnd;
+    Handle(Geom_Curve) anEdgeCurve = BRep_Tool::Curve(anEdge, aStart, aEnd);
+    if (!anEdgeCurve.IsNull() && !BRep_Tool::IsClosed(anEdge))
+      anEdgeCurve = new Geom_TrimmedCurve(anEdgeCurve, aStart, aEnd);
+    aCurve->setImpl(new Handle_Geom_Curve(anEdgeCurve));
+  }
+
   return project(aCurve);
 }
index 016bbc6deead2ee3ba3fb9f7efc95a9bffa5ce71..49cdb2ab5a57037ee08e6ffac27806e234b002ce 100644 (file)
@@ -159,7 +159,7 @@ testProjections(Part_1_doc, Sketch_7, aProjectedList, aFailedIDs)
 
 # Test projection to slope side face of the prism
 Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2"))
-aFailedIDs = set([1])
+aFailedIDs = set()
 testProjections(Part_1_doc, Sketch_8, aProjectedList, aFailedIDs)
 
 model.end()