*/
//=============================================================================
-SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
- SMESH::SMESH_Hypothesis_ptr anHyp)
+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(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);
+ if (CORBA::is_nil(aSubShapeObject) && HasShapeToMesh())
+ 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);
+ 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);
- SMESH_Hypothesis::Hypothesis_Status status = SMESH_Hypothesis::HYP_OK;
- try
- {
- TopoDS_Shape myLocSubShape;
- //use PseudoShape in case if mesh has no shape
- if(HasShapeToMesh())
- myLocSubShape = _gen_i->GeomObjectToShape( aSubShapeObject);
- else
- myLocSubShape = _impl->GetShapeToMesh();
-
- int hypId = myHyp->GetId();
- status = _impl->RemoveHypothesis(myLocSubShape, hypId);
- if ( !SMESH_Hypothesis::IsStatusFatal(status) )
- _mapHypo.erase( hypId );
- }
- catch(SALOME_Exception & S_ex)
- {
- THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
- }
- return status;
+ SMESH_Hypothesis::Hypothesis_Status status = SMESH_Hypothesis::HYP_OK;
+ try
+ {
+ TopoDS_Shape myLocSubShape;
+ //use PseudoShape in case if mesh has no shape
+ if(HasShapeToMesh())
+ myLocSubShape = _gen_i->GeomObjectToShape( aSubShapeObject);
+ else
+ myLocSubShape = _impl->GetShapeToMesh();
+
+ int hypId = myHyp->GetId();
+ status = _impl->RemoveHypothesis(myLocSubShape, hypId);
+// if ( !SMESH_Hypothesis::IsStatusFatal(status) ) EAP: hyp can be used on many subshapes
+// _mapHypo.erase( hypId );
+ }
+ catch(SALOME_Exception & S_ex)
+ {
+ THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
+ }
+ return status;
}
//=============================================================================
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();
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
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;
- try {
- SMESH::ListOfHypothesis_var aHypList = GetHypothesisList( theSubShapeObject );
- for ( int i = 0, n = aHypList->length(); i < n; i++ ) {
- removeHypothesis( theSubShapeObject, aHypList[i] );
+ 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());
+ }
}
}
- catch( const SALOME::SALOME_Exception& ) {
- INFOS("SMESH_Mesh_i::removeSubMesh(): exception caught!");
+ else
+ {
+ try {
+ SMESH::ListOfHypothesis_var aHypList = GetHypothesisList( theSubShapeObject );
+ for ( int i = 0, n = aHypList->length(); i < n; i++ ) {
+ removeHypothesis( theSubShapeObject, aHypList[i] );
+ }
+ }
+ catch( const SALOME::SALOME_Exception& ) {
+ INFOS("SMESH_Mesh_i::removeSubMesh(): exception caught!");
+ }
+ removeGeomGroupData( theSubShapeObject );
}
- removeGeomGroupData( theSubShapeObject );
-
int subMeshId = theSubMesh->GetId();
_mapSubMesh.erase(subMeshId);