]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Throw exception and fix a step case eap/ASERIS
authoreap <eap@opencascade.com>
Wed, 4 Oct 2017 16:00:38 +0000 (19:00 +0300)
committereap <eap@opencascade.com>
Wed, 4 Oct 2017 16:00:38 +0000 (19:00 +0300)
src/SMESH/SMESH_MeshEditor.cxx

index 9bc9371ee59ef58051938217de8e36f0b7353b2a..6accfe3d1ca6cb5aa4a7747e37b12c6064b1bcdb 100644 (file)
@@ -13177,7 +13177,8 @@ namespace // utils for MakePolyLine
           throw SALOME_Exception(LOCALIZED( "Infinite loop in MakePolyLine()"));
       }
 
-      return;
+      if ( myPaths[ iSeg ].myPoints.empty() )
+        throw SALOME_Exception( SMESH_Comment("Can't find a full path for PolySegment #") << iSeg );
 
     } // PolyPathCompute::Compute()
 
@@ -13227,15 +13228,16 @@ void SMESH_MeshEditor::MakePolyLine( TListOfPolySegments&   theSegments,
       gp_XYZ pMid = 0.5 * ( p1 + p2 );
       const SMDS_MeshElement* face;
       polySeg.myMidProjPoint = searcher->Project( pMid, SMDSAbs_Face, &face );
+      polySeg.myVector       = polySeg.myMidProjPoint.XYZ() - pMid;
 
-      if ( polySeg.myMidProjPoint.Distance( pMid ) < Precision::Confusion() )
-      {
-        SMESH_MeshAlgos::FaceNormal( face, const_cast< gp_XYZ& >( polySeg.myVector.XYZ() ));
-        polySeg.myMidProjPoint = pMid + polySeg.myVector.XYZ() * ( p1 - p2 ).Modulus() * planarCoef;
-      }
-      else
+      gp_XYZ faceNorm;
+      SMESH_MeshAlgos::FaceNormal( face, faceNorm );
+
+      if ( polySeg.myVector.Magnitude() < Precision::Confusion() ||
+           polySeg.myVector * faceNorm  < Precision::Confusion() )
       {
-        polySeg.myVector = polySeg.myMidProjPoint.XYZ() - pMid;
+        polySeg.myVector = faceNorm;
+        polySeg.myMidProjPoint = pMid + faceNorm * ( p1 - p2 ).Modulus() * planarCoef;
       }
     }
     else