Bugs in CopyMesh()

1) Assure the mesh is loaded before copying
2) Fix wrong copying polyhedra
This commit is contained in:
eap 2014-02-26 12:55:21 +04:00
parent f34590a67f
commit 3556420099

View File

@ -2654,6 +2654,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
SMESH::array_of_ElementType_var srcElemTypes = meshPart->GetTypes(); SMESH::array_of_ElementType_var srcElemTypes = meshPart->GetTypes();
if ( SMESH::DownCast<SMESH_Mesh_i*>( meshPart )) if ( SMESH::DownCast<SMESH_Mesh_i*>( meshPart ))
{ {
srcMesh_i->Load();
srcElemIt = srcMeshDS->elementsIterator(); srcElemIt = srcMeshDS->elementsIterator();
srcNodeIt = srcMeshDS->nodesIterator(); srcNodeIt = srcMeshDS->nodesIterator();
} }
@ -2720,10 +2721,15 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
const SMDS_MeshElement * newElem; const SMDS_MeshElement * newElem;
switch ( elem->GetEntityType() ) { switch ( elem->GetEntityType() ) {
case SMDSEntity_Polyhedra: case SMDSEntity_Polyhedra:
newElem = editor.GetMeshDS()-> if ( toKeepIDs )
AddPolyhedralVolumeWithID( nodes, newElem = editor.GetMeshDS()->
static_cast<const SMDS_VtkVolume*>(elem)->GetQuantities(), AddPolyhedralVolumeWithID( nodes,
ID); static_cast<const SMDS_VtkVolume*>(elem)->GetQuantities(),
ID);
else
newElem = editor.GetMeshDS()->
AddPolyhedralVolume( nodes,
static_cast<const SMDS_VtkVolume*>(elem)->GetQuantities());
break; break;
case SMDSEntity_Ball: case SMDSEntity_Ball:
newElem = editor.AddElement( nodes, SMDSAbs_Ball, false, ID, newElem = editor.AddElement( nodes, SMDSAbs_Ball, false, ID,