From: azv Date: Tue, 1 Oct 2019 12:10:04 +0000 (+0300) Subject: Fix regressions in SketchPlugin unit tests X-Git-Tag: V9_4_0a2~4^2~39 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d523f6884b6247200fb9e4272ed0e44dde95a868;p=modules%2Fshaper.git Fix regressions in SketchPlugin unit tests --- diff --git a/src/GeomAPI/GeomAPI_Curve.cpp b/src/GeomAPI/GeomAPI_Curve.cpp index fb5f034ab..9c5330a86 100644 --- a/src/GeomAPI/GeomAPI_Curve.cpp +++ b/src/GeomAPI/GeomAPI_Curve.cpp @@ -49,8 +49,6 @@ GeomAPI_Curve::GeomAPI_Curve(const std::shared_ptr& 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)); } } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp index 21a66fa02..e85b9254f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp @@ -27,6 +27,11 @@ #include #include +#include +#include +#include +#include + 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_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); } diff --git a/src/SketchPlugin/Test/TestProjectionIntoResult.py b/src/SketchPlugin/Test/TestProjectionIntoResult.py index 016bbc6de..49cdb2ab5 100644 --- a/src/SketchPlugin/Test/TestProjectionIntoResult.py +++ b/src/SketchPlugin/Test/TestProjectionIntoResult.py @@ -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()