X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_MeshEditor_i.cxx;h=3d1a120a8758adee646ae2a8be25b8966974759a;hp=d7afbed39f5ec69c7c73eefbbf905161daf70672;hb=24412178e1a7c741a73d5b23822c43e08c353b97;hpb=5c49d3d8ef7848e3eca007eb38d6513668413b0c diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index d7afbed39..3d1a120a8 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -42,7 +42,6 @@ #include "SMDS_Mesh0DElement.hxx" #include "SMDS_MeshFace.hxx" #include "SMDS_MeshVolume.hxx" -#include "SMDS_PolyhedralVolumeOfNodes.hxx" #include "SMDS_SetIterator.hxx" #include "SMDS_VolumeTool.hxx" #include "SMESHDS_Group.hxx" @@ -102,7 +101,7 @@ namespace MeshEditor_I { SMDSAbs_ElementType myPreviewType; // type to show //!< Constructor TPreviewMesh(SMDSAbs_ElementType previewElements = SMDSAbs_All) { - _isShapeToMesh = (_id =_studyId = 0); + _isShapeToMesh = (_id = 0); _myMeshDS = new SMESHDS_Mesh( _id, true ); myPreviewType = previewElements; } @@ -534,7 +533,9 @@ SMESH::MeshPreviewStruct* SMESH_MeshEditor_i::GetPreviewData() SMESHDS_Mesh* aMeshDS; std::unique_ptr< SMESH_MeshPartDS > aMeshPartDS; if ( hasBadElems ) { - aMeshPartDS.reset( new SMESH_MeshPartDS( getEditor().GetError()->myBadElements )); + const list& badElems = + static_cast( getEditor().GetError().get() )->myBadElements; + aMeshPartDS.reset( new SMESH_MeshPartDS( badElems )); aMeshDS = aMeshPartDS.get(); } else { @@ -680,7 +681,7 @@ SMESH::ComputeError* SMESH_MeshEditor_i::GetLastError() errOut->code = -( errIn->myName < 0 ? errIn->myName + 1: errIn->myName ); // -1 -> 0 errOut->comment = errIn->myComment.c_str(); errOut->subShapeID = -1; - errOut->hasBadMesh = !errIn->myBadElements.empty(); + errOut->hasBadMesh = errIn->HasBadElems(); } else { @@ -2596,7 +2597,7 @@ namespace MeshEditor_I * \param [in] nbOfSteps - number of elements to generate from one element * \param [in] toMakeGroups - if true, new elements will be included into new groups * corresponding to groups the input elements included in. - * \return ListOfGroups - new groups craeted if \a toMakeGroups is true + * \return ListOfGroups - new groups created if \a toMakeGroups is true */ //======================================================================= @@ -4033,6 +4034,7 @@ SMESH_MeshEditor_i::ScaleMakeMesh(SMESH::SMESH_IDSource_ptr theObject, SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::Offset( SMESH::SMESH_IDSource_ptr theObject, CORBA::Double theValue, CORBA::Boolean theCopyGroups, + CORBA::Boolean theCopyElements, const char* theMeshName, SMESH::ListOfGroups_out theGroups) throw (SALOME::SALOME_Exception) @@ -4058,7 +4060,9 @@ SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::Offset( SMESH::SMESH_IDSource_ptr theO TPreviewMesh * tmpMesh = getPreviewMesh(); tgtMesh = tmpMesh; tmpMesh->Copy( elements, copyElements ); + elements.swap( copyElements ); theCopyGroups = false; + theCopyElements = false; } else { @@ -4067,26 +4071,38 @@ SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::Offset( SMESH::SMESH_IDSource_ptr theO SMESH_Mesh_i* mesh_i = SMESH::DownCast( mesh_var ); tgtMesh = & mesh_i->GetImpl(); } - groupIds = getEditor().Offset( elements, theValue, tgtMesh, theCopyGroups, !myIsPreviewMode ); + groupIds = getEditor().Offset( elements, theValue, tgtMesh, + theCopyGroups, theCopyElements, !myIsPreviewMode ); tgtMesh->GetMeshDS()->Modified(); } if ( myIsPreviewMode ) { - getPreviewMesh()->Remove( SMESHUtils::elemSetIterator( copyElements )); + //getPreviewMesh()->Remove( SMESHUtils::elemSetIterator( copyElements )); } else { theGroups = theCopyGroups ? getGroups( groupIds.get() ) : new SMESH::ListOfGroups; + if ( *theMeshName && mesh_var->NbFaces() == 0 ) + { + // new mesh empty, remove it + SALOMEDS::Study_var study = SMESH_Gen_i::getStudyServant(); + SALOMEDS::StudyBuilder_var builder = study->NewBuilder(); + SALOMEDS::SObject_wrap meshSO = SMESH_Gen_i::ObjectToSObject( mesh_var ); + builder->RemoveObjectWithChildren( meshSO ); + THROW_SALOME_CORBA_EXCEPTION("Offset failed", SALOME::INTERNAL_ERROR); + } + // result of Offset() is a tuple (mesh, groups) if ( mesh_var->_is_nil() ) pyDump << myMesh_i->_this() << ", "; else pyDump << mesh_var << ", "; - pyDump << theGroups << " = " - << this << ".Offset( " + pyDump << theGroups << " = " << this << ".Offset( " + << theObject << ", " << theValue << ", " << theCopyGroups << ", " + << theCopyElements << ", " << "'" << theMeshName<< "')"; } @@ -5475,8 +5491,7 @@ SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::makeMesh(const char* theMeshName) { SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen(); SMESH::SMESH_Mesh_var mesh = gen->CreateEmptyMesh(); - SALOMEDS::Study_var study = gen->GetCurrentStudy(); - SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject( study, mesh ); + SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject( mesh ); gen->SetName( meshSO, theMeshName, "Mesh" ); gen->SetPixMap( meshSO, "ICON_SMESH_TREE_MESH_IMPORTED"); @@ -6963,7 +6978,7 @@ CORBA::Long SMESH_MeshEditor_i::MakeBoundaryElements(SMESH::Bnd_Dimension dim, // group of boundary elements SMESH_Group* smesh_group = 0; SMDSAbs_ElementType elemType = (dim == SMESH::BND_2DFROM3D) ? SMDSAbs_Volume : SMDSAbs_Face; - if ( strlen(groupName) ) + if ( strlen( groupName )) { SMESH::ElementType groupType = SMESH::ElementType( int(elemType)-1 ); group_var = mesh_i->CreateGroup( groupType, groupName );