X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_MeshEditor_i.cxx;h=421a0babf9d09ee7b3781f9222453746a5e7ec5d;hb=fe414fe4e7ff1d0488d8a9b9795e04a1ad34a75a;hp=7ef847bf0bfed8c35733d740c45d814dcc1b14d5;hpb=401b2a2e54af16513f98bf23584a7f69ab8a2956;p=modules%2Fsmesh.git diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index 7ef847bf0..421a0babf 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -4115,8 +4115,6 @@ SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::Offset( SMESH::SMESH_IDSource_ptr theO } else { - theGroups = theCopyGroups ? getGroups( groupIds.get() ) : new SMESH::ListOfGroups; - if ( *theMeshName && mesh_var->NbFaces() == 0 ) { // new mesh empty, remove it @@ -4126,6 +4124,10 @@ SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::Offset( SMESH::SMESH_IDSource_ptr theO builder->RemoveObjectWithChildren( meshSO ); THROW_SALOME_CORBA_EXCEPTION("Offset failed", SALOME::INTERNAL_ERROR); } + if ( !groupIds ) // nothing changed in the current mesh + THROW_SALOME_CORBA_EXCEPTION("Offset failed", SALOME::INTERNAL_ERROR); + + theGroups = theCopyGroups ? getGroups( groupIds.get() ) : new SMESH::ListOfGroups; // result of Offset() is a tuple (mesh, groups) if ( mesh_var->_is_nil() ) pyDump << myMesh_i->_this() << ", "; @@ -5617,23 +5619,20 @@ CORBA::Boolean SMESH_MeshEditor_i::ChangeElemNodes(CORBA::Long ide, initData(); const SMDS_MeshElement* elem = getMeshDS()->FindElement(ide); - if(!elem) return false; + if ( !elem ) return false; int nbn = newIDs.length(); - int i=0; vector aNodes(nbn); - int nbn1=-1; - for(; iFindNode(newIDs[i]); - if(aNode) { - nbn1++; - aNodes[nbn1] = aNode; - } + for ( int i = 0; i < nbn; i++ ) { + const SMDS_MeshNode* aNode = getMeshDS()->FindNode( newIDs[ i ]); + if ( !aNode ) + return false; + aNodes[ i ] = aNode; } TPythonDump() << "isDone = " << this << ".ChangeElemNodes( " << ide << ", " << newIDs << " )"; - bool res = getMeshDS()->ChangeElementNodes( elem, & aNodes[0], nbn1+1 ); + bool res = getMeshDS()->ChangeElementNodes( elem, & aNodes[0], aNodes.size() ); declareMeshModified( /*isReComputeSafe=*/ !res ); @@ -7394,16 +7393,16 @@ void SMESH_MeshEditor_i::MakePolyLine(SMESH::ListOfPolySegments& theSegments, } else if ( theGroupName[0] ) // find/create a group of segments { - SMESH_Mesh::GroupIteratorPtr grpIt = myMesh->GetGroups(); - while ( !groupDS && grpIt->more() ) - { - SMESH_Group* group = grpIt->next(); - if ( group->GetGroupDS()->GetType() == SMDSAbs_Edge && - strcmp( group->GetName(), theGroupName ) == 0 ) - { - groupDS = dynamic_cast< SMESHDS_Group* >( group->GetGroupDS() ); - } - } + // SMESH_Mesh::GroupIteratorPtr grpIt = myMesh->GetGroups(); + // while ( !groupDS && grpIt->more() ) + // { + // SMESH_Group* group = grpIt->next(); + // if ( group->GetGroupDS()->GetType() == SMDSAbs_Edge && + // strcmp( group->GetName(), theGroupName ) == 0 ) + // { + // groupDS = dynamic_cast< SMESHDS_Group* >( group->GetGroupDS() ); + // } + // } if ( !groupDS ) { SMESH::SMESH_Group_var groupVar = myMesh_i->CreateGroup( SMESH::EDGE, theGroupName ); @@ -7490,7 +7489,7 @@ void SMESH_MeshEditor_i::MakePolyLine(SMESH::ListOfPolySegments& theSegments, //================================================================================ /*! * \brief Create a slot of given width around given 1D elements lying on a triangle mesh. - * The slot is consrtucted by cutting faces by cylindrical surfaces made + * The slot is constructed by cutting faces by cylindrical surfaces made * around each segment. Segments are expected to be created by MakePolyLine(). * \return Edges located at the slot boundary */ @@ -7513,9 +7512,18 @@ SMESH::ListOfEdges* SMESH_MeshEditor_i::MakeSlot(SMESH::SMESH_GroupBase_ptr theS SMESHDS_Mesh* meshDS = getMeshDS(); + // get standalone face groups to be updated + std::vector< SMDS_MeshGroup* > faceGroups; + const std::set& allGroups = meshDS->GetGroups(); + std::set::const_iterator grIt = allGroups.begin(); + for ( ; grIt != allGroups.end(); ++grIt ) + if ( const SMESHDS_Group* gr = dynamic_cast< const SMESHDS_Group* >( *grIt )) + if ( gr->GetType() == SMDSAbs_Face ) + faceGroups.push_back( & const_cast< SMESHDS_Group* >( gr )->SMDSGroup() ); + std::vector< SMESH_MeshAlgos::Edge > edges = SMESH_MeshAlgos::MakeSlot( SMESH_Mesh_i::GetElements( theSegments, SMESH::EDGE ), - theWidth, meshDS ); + theWidth, meshDS, faceGroups ); resultEdges->length( edges.size() ); for ( size_t i = 0; i < edges.size(); ++i )