Salome HOME
Merge changes imn/IMACS
authorrnv <rnv@opencascade.com>
Thu, 5 Oct 2017 07:35:32 +0000 (10:35 +0300)
committerrnv <rnv@opencascade.com>
Thu, 5 Oct 2017 07:35:32 +0000 (10:35 +0300)
src/SMESH/SMESH_MeshEditor.cxx
src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i

index a3d2b226e49a9f2ffb7b73fa9e297d0347c7e835..6accfe3d1ca6cb5aa4a7747e37b12c6064b1bcdb 100644 (file)
@@ -13119,8 +13119,7 @@ namespace // utils for MakePolyLine
             if ( path.SetCutAtCorner( polySeg.myNode1[ iP ], fIt->next(), plnNorm, plnOrig ))
             {
               if (( path.myDot1 * path.myDot2 != 0 ) ||
-                  ( nodes.insert( path.myNode1._node ).second &&
-                    nodes.insert( path.myNode2._node ).second ))
+                  ( nodes.insert( path.myDot1 == 0 ? path.myNode1._node : path.myNode2._node ).second ))
                 paths.push_back( path );
             }
           }
@@ -13178,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()
 
@@ -13228,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
index aecaf8e0a7ba56862aa57e49f4ee676c82aa5c2e..68b0e1ec5618d51a0aac5c44b623d2d879d02917 100644 (file)
@@ -107,10 +107,6 @@ class SMESH_Swig
   std::vector<int> getSelected( const char* Mesh_Entry );
   std::vector<std::pair<int,int> > getSelectedEdgeOfCell( const char* Mesh_Entry );
 
-  void setSelectionMode( SelectionMode selectionMode);
-  std::vector<int> getSelected( const char* Mesh_Entry );
-  std::vector<std::pair<int,int> > getSelectedEdgeOfCell( const char* Mesh_Entry );
-
   // --------------------- for the test purposes -----------------------
   SelectionMode  getSelectionMode();
   void select( const char *id, std::vector<int> ids, bool append = false );