}
}
+//================================================================================
+/*!
+ * \brief Return true if mesh has ICON_SMESH_TREE_GEOM_MODIF icon
+ */
+//================================================================================
+
+bool SMESH_Gen_i::isGeomModifIcon( SMESH::SMESH_Mesh_ptr mesh )
+{
+ SALOMEDS::SObject_wrap so = ObjectToSObject( mesh );
+ SALOMEDS::GenericAttribute_wrap attr;
+ if ( ! so->_is_nil() && so->FindAttribute( attr.inout(), "AttributePixMap" ))
+ {
+ SALOMEDS::AttributePixMap_wrap pm = attr;
+ CORBA::String_var ico = pm->GetPixMap();
+ return ( strcmp( ico.in(), "ICON_SMESH_TREE_GEOM_MODIF" ) == 0 );
+ }
+ return false;
+}
+
//=================================================================================
// function : hasObjectInfo()
// purpose : shows if module provides information for its objects
SALOMEDS::SObject_wrap so = getStudyServant()->FindObjectID( entry );
CORBA::Object_var obj = SObjectToObject( so );
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
- if ( !mesh->_is_nil() )
+ if ( isGeomModifIcon( mesh ))
{
- SALOMEDS::GenericAttribute_wrap attr;
- if ( so->FindAttribute( attr.inout(), "AttributePixMap" ))
- {
- SALOMEDS::AttributePixMap_wrap pm = attr;
- CORBA::String_var ico = pm->GetPixMap();
- if ( strcmp( ico.in(), "ICON_SMESH_TREE_GEOM_MODIF" ) == 0 )
- {
- txt << "The geometry was changed and the mesh needs to be recomputed";
- }
- }
+ txt << "The geometry was changed and the mesh needs to be recomputed";
}
if ( txt.empty() )
SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh );
ASSERT( meshServant );
if ( meshServant ) {
- meshServant->Load();
+ if ( isGeomModifIcon( theMesh ))
+ meshServant->Clear();
+ else
+ meshServant->Load();
// NPAL16168: "geometrical group edition from a submesh don't modify mesh computation"
- // Clear meshy because it was not cleared in CheckGeomModif of previous call
- meshServant->Clear();
meshServant->CheckGeomModif();
// get local TopoDS_Shape
TopoDS_Shape myLocShape;
geomClient->RemoveShapeFromBuffer(aIOR);
}
- // re-assign global hypotheses to the new shape
- _mainShapeTick = -1;
- CheckGeomModif( true );
-
// update the reference to theNewGeom (needed for correct execution of a dumped python script)
- SALOMEDS::SObject_var aSO = _gen_i->ObjectToSObject(_this());
- if (!aSO->_is_nil()) {
- SALOMEDS::SObject_var aShapeRefSO;
- if (aSO->FindSubObject(1, aShapeRefSO)) {
- _gen_i->getStudyServant()->NewBuilder()->Addreference(
- aShapeRefSO, _gen_i->getStudyServant()->FindObjectID(theNewGeom->GetStudyEntry()));
+ SMESH::SMESH_Mesh_var me = _this();
+ SALOMEDS::SObject_wrap aSO = _gen_i->ObjectToSObject( me );
+ CORBA::String_var entry = theNewGeom->GetStudyEntry();
+ if ( !aSO->_is_nil() )
+ {
+ SALOMEDS::SObject_wrap aShapeRefSO;
+ if ( aSO->FindSubObject( _gen_i->GetRefOnShapeTag(), aShapeRefSO.inout() ))
+ {
+ SALOMEDS::SObject_wrap aShapeSO = _gen_i->getStudyServant()->FindObjectID( entry );
+ SALOMEDS::StudyBuilder_var builder = _gen_i->getStudyServant()->NewBuilder();
+ builder->Addreference( aShapeRefSO, aShapeSO );
}
}
- TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ReplaceShape( "
- << theNewGeom->GetStudyEntry() << " )";
+ // re-assign global hypotheses to the new shape
+ _mainShapeTick = -1;
+ CheckGeomModif( true );
TPythonDump() << "SHAPERSTUDY.breakLinkForSubElements(salome.ObjectToSObject("
- << SMESH::SMESH_Mesh_var(_this()) <<".GetMesh()), " << theNewGeom->GetStudyEntry() << ")";
+ << me <<".GetMesh()), " << entry.in() << ")";
+
+ TPythonDump() << me << ".ReplaceShape( " << entry.in() << " )";
+
}
//================================================================================
CORBA::Object_var geomObj = _gen_i->SObjectToObject( geomSO );
GEOM::GEOM_Object_var geom = GEOM::GEOM_Object::_narrow( geomObj );
newShape = _gen_i->GeomObjectToShape( geom );
+ CORBA::String_var entry = geom->GetStudyEntry();
+ groupData._groupEntry = entry.in();
}
}
else
int newID = o2n->second, oldID = o2n->first;
if ( !_mapSubMesh.count( oldID ))
continue;
- _mapSubMesh [ newID ] = _impl->GetSubMeshContaining( newID );
- _mapSubMesh_i [ newID ] = _mapSubMesh_i [ oldID ];
- _mapSubMeshIor[ newID ] = _mapSubMeshIor[ oldID ];
+ if ( newID > 0 )
+ {
+ _mapSubMesh [ newID ] = _impl->GetSubMeshContaining( newID );
+ _mapSubMesh_i [ newID ] = _mapSubMesh_i [ oldID ];
+ _mapSubMeshIor[ newID ] = _mapSubMeshIor[ oldID ];
+ }
_mapSubMesh. erase(oldID);
_mapSubMesh_i. erase(oldID);
_mapSubMeshIor.erase(oldID);
- _mapSubMesh_i [ newID ]->changeLocalId( newID );
+ if ( newID > 0 )
+ _mapSubMesh_i [ newID ]->changeLocalId( newID );
}
// update _mapSubMesh
i_sm->second = _impl->GetSubMesh( meshDS->IndexToShape( i_sm->first ));
}
- _gen_i->UpdateIcons( SMESH::SMESH_Mesh_var( _this() ));
+ _gen_i->UpdateIcons( me );
if ( !isBreakLink )
{