From 953e51afe39c4e4d619244abdeb7465be283e80b Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 10 Jan 2020 14:39:47 +0300 Subject: [PATCH] #18459 [CEA] With CADSurf discrete, quadrangle elements are not created, and the GMF file is not exported --- src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx | 29 +++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index 828b139..af32973 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -3045,7 +3045,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelpe // add triangles meshgems_integer nbtri = 0; meshgems_mesh_get_triangle_count( omsh, &nbtri ); - const SMDS_MeshNode* nodes[3]; + const SMDS_MeshNode* nodes[4]; for ( i = 1; i <= nbtri; ++i ) { meshgems_mesh_get_triangle_vertices( omsh, i, nodeIDs ); @@ -3057,6 +3057,33 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelpe meshDS->AddFace( nodes[0], nodes[1], nodes[2] ); } + // add quadrangles + meshgems_integer nbquad = 0; + meshgems_mesh_get_quadrangle_count( omsh, &nbquad ); + for ( i = 1; i <= nbquad; ++i ) + { + meshgems_mesh_get_quadrangle_vertices( omsh, i, nodeIDs ); + for ( int j = 0; j < 4; ++j ) + { + meshgems_mesh_get_vertex_tag( omsh, nodeIDs[j], &nodeID ); + nodes[j] = meshDS->FindNode( nodeID ); + } + meshDS->AddFace( nodes[0], nodes[1], nodes[2], nodes[3] ); + } + + if ( _hypothesis ) + { + std::string GMFFileName = _hypothesis->GetGMFFile(); + if ( !GMFFileName.empty() ) + { + bool asciiFound = (GMFFileName.find(".mesh", GMFFileName.size()-5) != std::string::npos); + bool binaryFound = (GMFFileName.find(".meshb",GMFFileName.size()-6) != std::string::npos); + if ( !asciiFound && !binaryFound ) + GMFFileName.append(".mesh"); + mesh_write_mesh(msh, GMFFileName.c_str()); + } + } + cadsurf_regain_mesh(css, omsh); // as we don't assign the new triangles to a shape (the pseudo-shape), -- 2.39.2