From c81c45e92897cda1aeaf2018722367639cb1231e Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 2 Sep 2010 14:18:22 +0000 Subject: [PATCH] 0020966: How to create GHS3D mesh from an existing mesh ? Fix bad input file (wrong nb of faces) in case if not all faces are bound to geometry --- src/GHS3DPlugin_GHS3D.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin_GHS3D.cxx index 70dc77b..6ff024a 100644 --- a/src/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin_GHS3D.cxx @@ -266,10 +266,8 @@ static bool writeFaces (ofstream & theFile, int shapeID, nbNodes, aSmdsID; bool idFound; - std::cout << " " << theMesh->NbFaces() << " shapes of 2D dimension" << std::endl; - std::cout << std::endl; - - theFile << space << theMesh->NbFaces() << space << dummyint << std::endl; + // count faces bound to geometry + int nbFaces = 0; TopExp_Explorer expface( theMesh->ShapeToMesh(), TopAbs_FACE ); for ( int i = 0; expface.More(); expface.Next(), i++ ) { @@ -286,8 +284,16 @@ static bool writeFaces (ofstream & theFile, if ( ! idFound ) { tabID[i] = shapeID; tabShape[i] = aShape; + theSubMesh = theMesh->MeshElements( aShape ); + if ( theSubMesh ) + nbFaces += theSubMesh->NbElements(); } } + std::cout << " " << nbFaces << " shapes of 2D dimension" << std::endl; + std::cout << std::endl; + + theFile << space << nbFaces << space << dummyint << std::endl; + for ( int i =0; i < nbShape; i++ ) { if ( tabID[i] != 0 ) { aShape = tabShape[i]; -- 2.39.2