From 64b2fcfed194fa6b38bfd122df9f893863cd7b78 Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 7 Apr 2014 15:45:23 +0400 Subject: [PATCH] 22526: SMESH 2864 - Projection and Extrusion 1) Set warning mesh icon if the mesh is computed with hyp errors. 2) When edit mesh, get name of geometry from the study directly (not SO -> GEOM_Object -> SO -> name ). 3) Prevent an exception when projecting faces with many holes. --- src/SMESHGUI/SMESHGUI_ComputeDlg.cxx | 4 ++- src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx | 34 +++++++++++++++++++ src/SMESHGUI/SMESHGUI_GEOMGenUtils.h | 2 ++ src/SMESHGUI/SMESHGUI_MeshOp.cxx | 10 ++---- src/StdMeshers/StdMeshers_ProjectionUtils.cxx | 3 +- 5 files changed, 44 insertions(+), 9 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index c0524289c..1966e750d 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -901,7 +901,9 @@ void SMESHGUI_BaseComputeOp::computeMesh() // NPAL16631: if ( !memoryLack ) { - SMESH::ModifiedMesh(aMeshSObj, !computeFailed, myMesh->NbNodes() == 0); + SMESH::ModifiedMesh( aMeshSObj, + !computeFailed && aHypErrors.isEmpty(), + myMesh->NbNodes() == 0); update( UF_ObjBrowser | UF_Model ); // SHOW MESH diff --git a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx index 48821ddad..8c2fa06ef 100644 --- a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx @@ -108,6 +108,40 @@ namespace SMESH return GEOM::GEOM_Object::_nil(); } + SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO ) + { + if (!smeshSO) + return 0; + + _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + if (!aStudy) + return 0; + + _PTR(ChildIterator) anIter (aStudy->NewChildIterator( smeshSO )); + for ( ; anIter->More(); anIter->Next()) { + _PTR(SObject) aSObject = anIter->Value(); + _PTR(SObject) aRefSOClient; + GEOM::GEOM_Object_var aMeshShape; + + if (aSObject->ReferencedObject(aRefSOClient)) { + SALOMEDS_SObject* aRefSO = _CAST(SObject,aRefSOClient); + aMeshShape = GEOM::GEOM_Object::_narrow(aRefSO->GetObject()); + aSObject = aRefSOClient; + } + else { + SALOMEDS_SObject* aSO = _CAST(SObject,aSObject); + aMeshShape = GEOM::GEOM_Object::_narrow(aSO->GetObject()); + } + + if (!aMeshShape->_is_nil()) + { + std::string name = aSObject->GetName(); + return CORBA::string_dup( name.c_str() ); + } + } + return 0; + } + GEOM::GEOM_Object_ptr GetSubShape (GEOM::GEOM_Object_ptr theMainShape, long theID) { diff --git a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h index 3e7760916..72fa9e6d3 100644 --- a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h +++ b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h @@ -47,6 +47,8 @@ namespace SMESH SMESHGUI_EXPORT GEOM::GEOM_Object_ptr GetGeom( _PTR(SObject) ); + SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO ); + SMESHGUI_EXPORT GEOM::GEOM_Object_ptr GetSubShape( GEOM::GEOM_Object_ptr, long ); } diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index c2ec7fcec..10521987a 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -2082,13 +2082,9 @@ void SMESHGUI_MeshOp::readMesh() } // Get name of geometry object - GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj ); - if ( !aGeomVar->_is_nil() ) - { - _PTR(SObject) aGeomSO = studyDS()->FindObjectID( aGeomVar->GetStudyEntry() ); - QString aShapeName = name( aGeomSO ); - myDlg->setObjectText( SMESHGUI_MeshDlg::Geom, aShapeName ); - } + CORBA::String_var name = SMESH::GetGeomName( pObj ); + if ( name.in() ) + myDlg->setObjectText( SMESHGUI_MeshDlg::Geom, name.in() ); } // Get hypotheses and algorithms assigned to the mesh/sub-mesh diff --git a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx index 730f78c62..77d9c1a71 100644 --- a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx @@ -1428,7 +1428,8 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face& face1, // move edge2Beg to place before edge2End edges2.splice( edge2End, edges2, edge2Beg++ ); - if ( sameVertexUV( *edge2Beg, face2, 0, v0f1UV, vTolUV )) + if ( edge2Beg != edges2.end() && + sameVertexUV( *edge2Beg, face2, 0, v0f1UV, vTolUV )) { if ( iW1 == 0 ) OK = true; // OK is for the first wire // reverse edges2 if needed -- 2.39.2