mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-01 10:55:38 +05:00
IPAL13617 NbSubMesh() method works wrong
Fix removeSubMesh() for the case of not published subshape
This commit is contained in:
parent
a657a15f5f
commit
30de27ee11
@ -522,20 +522,19 @@ SMESH::Hypothesis_Status SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Object_ptr aS
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
|
||||
SMESH_Hypothesis::Hypothesis_Status
|
||||
SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
|
||||
SMESH::SMESH_Hypothesis_ptr anHyp)
|
||||
{
|
||||
if(MYDEBUG) MESSAGE("removeHypothesis()");
|
||||
// **** proposer liste de subShape (selection multiple)
|
||||
|
||||
if (CORBA::is_nil(aSubShapeObject) && HasShapeToMesh())
|
||||
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
|
||||
SALOME::BAD_PARAM);
|
||||
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", SALOME::BAD_PARAM);
|
||||
|
||||
SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp);
|
||||
if (CORBA::is_nil(myHyp))
|
||||
THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference",
|
||||
SALOME::BAD_PARAM);
|
||||
THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", SALOME::BAD_PARAM);
|
||||
|
||||
SMESH_Hypothesis::Hypothesis_Status status = SMESH_Hypothesis::HYP_OK;
|
||||
try
|
||||
@ -549,8 +548,8 @@ SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Ob
|
||||
|
||||
int hypId = myHyp->GetId();
|
||||
status = _impl->RemoveHypothesis(myLocSubShape, hypId);
|
||||
if ( !SMESH_Hypothesis::IsStatusFatal(status) )
|
||||
_mapHypo.erase( hypId );
|
||||
// if ( !SMESH_Hypothesis::IsStatusFatal(status) ) EAP: hyp can be used on many subshapes
|
||||
// _mapHypo.erase( hypId );
|
||||
}
|
||||
catch(SALOME_Exception & S_ex)
|
||||
{
|
||||
@ -572,8 +571,7 @@ throw(SALOME::SALOME_Exception)
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
if (MYDEBUG) MESSAGE("GetHypothesisList");
|
||||
if (_impl->HasShapeToMesh() && CORBA::is_nil(aSubShapeObject))
|
||||
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
|
||||
SALOME::BAD_PARAM);
|
||||
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", SALOME::BAD_PARAM);
|
||||
|
||||
SMESH::ListOfHypothesis_var aList = new SMESH::ListOfHypothesis();
|
||||
|
||||
@ -669,6 +667,9 @@ void SMESH_Mesh_i::RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
|
||||
if ( anSO->FindSubObject( aTag, anObj ) && anObj->ReferencedObject( aRef ) )
|
||||
aSubShapeObject = GEOM::GEOM_Object::_narrow( aRef->GetObject() );
|
||||
|
||||
// if ( aSubShapeObject->_is_nil() ) // not published shape (IPAL13617)
|
||||
// aSubShapeObject = theSubMesh->GetSubShape();
|
||||
|
||||
aStudy->NewBuilder()->RemoveObjectWithChildren( anSO );
|
||||
|
||||
// Update Python script
|
||||
@ -1976,9 +1977,26 @@ void SMESH_Mesh_i::removeSubMesh (SMESH::SMESH_subMesh_ptr theSubMesh,
|
||||
GEOM::GEOM_Object_ptr theSubShapeObject )
|
||||
{
|
||||
MESSAGE("SMESH_Mesh_i::removeSubMesh()");
|
||||
if ( theSubMesh->_is_nil() || theSubShapeObject->_is_nil() )
|
||||
if ( theSubMesh->_is_nil() /*|| theSubShapeObject->_is_nil()*/ )
|
||||
return;
|
||||
|
||||
if ( theSubShapeObject->_is_nil() ) // not published shape (IPAL13617)
|
||||
{
|
||||
CORBA::Long shapeId = theSubMesh->GetId();
|
||||
if ( _mapSubMesh.find( shapeId ) != _mapSubMesh.end())
|
||||
{
|
||||
TopoDS_Shape S = _mapSubMesh[ shapeId ]->GetSubShape();
|
||||
if ( !S.IsNull() )
|
||||
{
|
||||
list<const SMESHDS_Hypothesis*> hyps = _impl->GetHypothesisList( S );
|
||||
list<const SMESHDS_Hypothesis*>::const_iterator hyp = hyps.begin();
|
||||
for ( ; hyp != hyps.end(); ++hyp )
|
||||
_impl->RemoveHypothesis(S, (*hyp)->GetID());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try {
|
||||
SMESH::ListOfHypothesis_var aHypList = GetHypothesisList( theSubShapeObject );
|
||||
for ( int i = 0, n = aHypList->length(); i < n; i++ ) {
|
||||
@ -1989,7 +2007,7 @@ void SMESH_Mesh_i::removeSubMesh (SMESH::SMESH_subMesh_ptr theSubMesh,
|
||||
INFOS("SMESH_Mesh_i::removeSubMesh(): exception caught!");
|
||||
}
|
||||
removeGeomGroupData( theSubShapeObject );
|
||||
|
||||
}
|
||||
int subMeshId = theSubMesh->GetId();
|
||||
|
||||
_mapSubMesh.erase(subMeshId);
|
||||
|
Loading…
Reference in New Issue
Block a user