Salome HOME
PAL15161 (Mesh to pass through a point - preview works wrong for the submesh and...
[modules/smesh.git] / src / OBJECT / SMESH_Object.cxx
index 1e52ccb015f51400b44bd2ec6c493a081841e02f..6957422696cc79f10ba071d5bdd7f70c15751f8c 100644 (file)
@@ -29,6 +29,7 @@
 #include "SMESH_ActorUtils.h"
 
 #include "SMDS_Mesh.hxx"
+#include "SMDS_PolyhedralVolumeOfNodes.hxx"
 #include "SMESH_Actor.h"
 #include "SMESH_ControlsDef.hxx"
 #include "SalomeApp_Application.h"
@@ -345,15 +346,21 @@ void SMESH_VisualObjDef::buildElemPrs()
         SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
        switch(aType){
        case SMDSAbs_Volume:{
+          aConnect.clear();
          std::vector<int> aConnectivities;
-         GetConnect(aNodesIter,aConnect);
          // Convertions connectivities from SMDS to VTK
          if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
-           for (int k = 0; k < aNbNodes; k++) {
+
+            if ( const SMDS_PolyhedralVolumeOfNodes* ph =
+                 dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem))
+            {
+              aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect);
+              anIdList->SetNumberOfIds( aNbNodes );
+            }
+           for (int k = 0; k < aNbNodes; k++)
              aConnectivities.push_back(k);
-           }
 
-         } else if (aNbNodes == 4) {
+          } else if (aNbNodes == 4) {
            static int anIds[] = {0,2,1,3};
            for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
 
@@ -395,6 +402,9 @@ void SMESH_VisualObjDef::buildElemPrs()
           else {
           }
 
+          if ( aConnect.empty() )
+            GetConnect(aNodesIter,aConnect);
+
          if (aConnectivities.size() > 0) {
            for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
              SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);