Fix SMESH_Mesh_i::CheckGeomGroupModif()
52731: Exception at export of SEG3 groups
Fix BUGs concerning Export:
1) Exception at export of the SEG3 group as a separate object.
2) Many formats available in the pop-up menu when several objects selected while only MED and CGNS formats support several meshes in one file.
3) Export of the mesh and its group to the same file results of storage of the group only. Object names are not kept.
/*!
* \brief Driver reading a mesh from the CGNS file. The mesh to read is selected by
/*!
* \brief Driver reading a mesh from the CGNS file. The mesh to read is selected by
- * an index (counted form 0) set via SetMeshId()
+ * an index (counted from 0) set via SetMeshId()
*/
class MESHDriverCGNS_EXPORT DriverCGNS_Read : public Driver_SMESHDS_Mesh
{
*/
class MESHDriverCGNS_EXPORT DriverCGNS_Read : public Driver_SMESHDS_Mesh
{
// 0 ------------------ - DON't USE 0!!!
// 1 . * .
// 2 . *
// 0 ------------------ - DON't USE 0!!!
// 1 . * .
// 2 . *
// 10 *
// 11
// 12 *
// 13 *
// 14
// 15 *
// 10 *
// 11
// 12 *
// 13 *
// 14
// 15 *
myShift.resize(SMDSAbs_NbElementTypes, 0);
myShift[ SMDSAbs_Face ] = +15;// 3->18, 4->19, etc.
myShift.resize(SMDSAbs_NbElementTypes, 0);
myShift[ SMDSAbs_Face ] = +15;// 3->18, 4->19, etc.
- myShift[ SMDSAbs_Edge ] = +5; // 2->7, 4->9
+ myShift[ SMDSAbs_Edge ] = +14;// 2->16, 3->17
myShift[ SMDSAbs_0DElement ] = +2; // 1->3
myShift[ SMDSAbs_Ball ] = +1; // 1->2
myShift[ SMDSAbs_0DElement ] = +2; // 1->3
myShift[ SMDSAbs_Ball ] = +1; // 1->2
myNb[ index( SMDSAbs_Ball,1 )] = & myNbBalls;
myNb[ index( SMDSAbs_Edge,2 )] = & myNbEdges;
myNb[ index( SMDSAbs_Ball,1 )] = & myNbBalls;
myNb[ index( SMDSAbs_Edge,2 )] = & myNbEdges;
- myNb[ index( SMDSAbs_Edge,4 )] = & myNbQuadEdges;
+ myNb[ index( SMDSAbs_Edge,3 )] = & myNbQuadEdges;
myNb[ index( SMDSAbs_Face,3 )] = & myNbTriangles;
myNb[ index( SMDSAbs_Face,4 )] = & myNbQuadrangles;
myNb[ index( SMDSAbs_Face,3 )] = & myNbTriangles;
myNb[ index( SMDSAbs_Face,4 )] = & myNbQuadrangles;
//================================================================================
void SMESH_Mesh::ExportCGNS(const char * file,
//================================================================================
void SMESH_Mesh::ExportCGNS(const char * file,
- const SMESHDS_Mesh* meshDS)
+ const SMESHDS_Mesh* meshDS,
+ const char * meshName)
{
int res = Driver_Mesh::DRS_FAIL;
#ifdef WITH_CGNS
{
int res = Driver_Mesh::DRS_FAIL;
#ifdef WITH_CGNS
myWriter.SetFile( file );
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
myWriter.SetMeshName( SMESH_Comment("Mesh_") << meshDS->GetPersistentId());
myWriter.SetFile( file );
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
myWriter.SetMeshName( SMESH_Comment("Mesh_") << meshDS->GetPersistentId());
+ if ( meshName && meshName[0] )
+ myWriter.SetMeshName( meshName );
res = myWriter.Perform();
#endif
if ( res != Driver_Mesh::DRS_OK )
res = myWriter.Perform();
#endif
if ( res != Driver_Mesh::DRS_OK )
const bool isascii,
const SMESHDS_Mesh* meshPart = 0) throw(SALOME_Exception);
void ExportCGNS(const char * file,
const bool isascii,
const SMESHDS_Mesh* meshPart = 0) throw(SALOME_Exception);
void ExportCGNS(const char * file,
- const SMESHDS_Mesh* mesh);
+ const SMESHDS_Mesh* mesh,
+ const char * meshName = 0);
void ExportGMF(const char * file,
const SMESHDS_Mesh* mesh,
bool withRequiredGroups = true );
void ExportGMF(const char * file,
const SMESHDS_Mesh* mesh,
bool withRequiredGroups = true );
const bool isMED = ( theCommandID == SMESHOp::OpExportMED || theCommandID == SMESHOp::OpPopupExportMED );
const bool isUNV = ( theCommandID == SMESHOp::OpExportUNV || theCommandID == SMESHOp::OpPopupExportUNV );
const bool isSTL = ( theCommandID == SMESHOp::OpExportSTL || theCommandID == SMESHOp::OpPopupExportSTL );
const bool isMED = ( theCommandID == SMESHOp::OpExportMED || theCommandID == SMESHOp::OpPopupExportMED );
const bool isUNV = ( theCommandID == SMESHOp::OpExportUNV || theCommandID == SMESHOp::OpPopupExportUNV );
const bool isSTL = ( theCommandID == SMESHOp::OpExportSTL || theCommandID == SMESHOp::OpPopupExportSTL );
const bool isCGNS= ( theCommandID == SMESHOp::OpExportCGNS || theCommandID == SMESHOp::OpPopupExportCGNS );
const bool isCGNS= ( theCommandID == SMESHOp::OpExportCGNS || theCommandID == SMESHOp::OpPopupExportCGNS );
const bool isCGNS= false;
const bool isCGNS= false;
const bool isSAUV= ( theCommandID == SMESHOp::OpExportSAUV || theCommandID == SMESHOp::OpPopupExportSAUV );
const bool isGMF = ( theCommandID == SMESHOp::OpExportGMF || theCommandID == SMESHOp::OpPopupExportGMF );
const bool isSAUV= ( theCommandID == SMESHOp::OpExportSAUV || theCommandID == SMESHOp::OpPopupExportSAUV );
const bool isGMF = ( theCommandID == SMESHOp::OpExportGMF || theCommandID == SMESHOp::OpPopupExportGMF );
- // actually, the following condition can't be met (added for insurance)
- if( selected.Extent() == 0 ||
- ( selected.Extent() > 1 && !isMED && !isSTL ))
+ const bool multiMeshSupported = ( isMED || isCGNS ); // file can hold several meshes
+ if ( selected.Extent() == 0 || ( selected.Extent() > 1 && !multiMeshSupported ))
return;
// get mesh object from selection and check duplication of their names
return;
// get mesh object from selection and check duplication of their names
#ifdef WITH_CGNS
createPopupItem( SMESHOp::OpPopupExportCGNS, OB, mesh_group, multiple_non_empty, anId );
#endif
#ifdef WITH_CGNS
createPopupItem( SMESHOp::OpPopupExportCGNS, OB, mesh_group, multiple_non_empty, anId );
#endif
- createPopupItem( SMESHOp::OpPopupExportSAUV, OB, mesh_group, multiple_non_empty, anId );
- createPopupItem( SMESHOp::OpPopupExportGMF, OB, mesh_group, multiple_non_empty, anId );
- createPopupItem( SMESHOp::OpPopupExportDAT, OB, mesh_group, multiple_non_empty, anId );
+ createPopupItem( SMESHOp::OpPopupExportSAUV, OB, mesh_group, only_one_non_empty, anId );
+ createPopupItem( SMESHOp::OpPopupExportGMF, OB, mesh_group, only_one_non_empty, anId );
+ createPopupItem( SMESHOp::OpPopupExportDAT, OB, mesh_group, only_one_non_empty, anId );
createPopupItem( SMESHOp::OpDelete, OB, mesh_part + " " + hyp_alg );
createPopupItem( SMESHOp::OpDeleteGroup, OB, group );
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( SMESHOp::OpDelete, OB, mesh_part + " " + hyp_alg );
createPopupItem( SMESHOp::OpDeleteGroup, OB, group );
popupMgr()->insert( separator(), -1, 0 );
groupData.push_back
( make_pair( TIndexedShape( gog->GetID(),gog->GetShape()), gog->GetType()));
}
groupData.push_back
( make_pair( TIndexedShape( gog->GetID(),gog->GetShape()), gog->GetType()));
}
- // set new shape to mesh -> DS of submeshes and geom groups is deleted
+ // set new shape to mesh -> DS of sub-meshes and geom groups is deleted
+ _impl->ShapeToMesh( TopoDS_Shape() ); // IPAL52730
_impl->ShapeToMesh( newShape );
_impl->ShapeToMesh( newShape );
// reassign hypotheses
TShapeHypList::iterator indS_hyps = assignedHyps.begin();
for ( ; indS_hyps != assignedHyps.end(); ++indS_hyps )
// reassign hypotheses
TShapeHypList::iterator indS_hyps = assignedHyps.begin();
for ( ; indS_hyps != assignedHyps.end(); ++indS_hyps )
continue;
for ( hypIt = hyps.begin(); hypIt != hyps.end(); ++hypIt )
_impl->AddHypothesis( geom._shape, (*hypIt)->GetID());
continue;
for ( hypIt = hyps.begin(); hypIt != hyps.end(); ++hypIt )
_impl->AddHypothesis( geom._shape, (*hypIt)->GetID());
SMESH_subMesh* newSubmesh = _impl->GetSubMesh( geom._shape );
if ( newID != oldID ) {
_mapSubMesh [ newID ] = newSubmesh;
SMESH_subMesh* newSubmesh = _impl->GetSubMesh( geom._shape );
if ( newID != oldID ) {
_mapSubMesh [ newID ] = newSubmesh;
PrepareForWriting(file,overwrite);
PrepareForWriting(file,overwrite);
+ std::string meshName("");
+ SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
+ SALOMEDS::SObject_wrap so = _gen_i->ObjectToSObject( study, meshPart );
+ if ( !so->_is_nil() )
+ {
+ CORBA::String_var name = so->GetName();
+ meshName = name.in();
+ }
SMESH_MeshPartDS partDS( meshPart );
SMESH_MeshPartDS partDS( meshPart );
- _impl->ExportCGNS(file, &partDS);
+ _impl->ExportCGNS(file, &partDS, meshName.c_str() );
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportCGNS( "
<< meshPart<< ", r'" << file << "', " << overwrite << ")";
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportCGNS( "
<< meshPart<< ", r'" << file << "', " << overwrite << ")";