SALOMEDS::Study_ptr SMESH_Gen_i::GetCurrentStudy()
{
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::GetCurrentStudy: study Id = " << GetCurrentStudyID() );
+ if ( GetCurrentStudyID() < 0 )
+ return SALOMEDS::Study::_nil();
return SALOMEDS::Study::_duplicate( myCurrentStudy );
}
aPythonDump << "([";
if (theStatus == SMESH::DRS_OK) {
- SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
- aStudyBuilder->NewCommand(); // There is a transaction
+ SALOMEDS::StudyBuilder_var aStudyBuilder;
+ if ( GetCurrentStudyID() > -1 )
+ {
+ aStudyBuilder = myCurrentStudy->NewBuilder();
+ aStudyBuilder->NewCommand(); // There is a transaction
+ }
aResult->length( aNames.size() );
int i = 0;
// Iterate through all meshes and create mesh objects
- for ( list<string>::iterator it = aNames.begin(); it != aNames.end(); it++ ) {
+ for ( list<string>::iterator it = aNames.begin(); it != aNames.end(); it++ )
+ {
// Python Dump
if (i > 0) aPythonDump << ", ";
aResult[i++] = SMESH::SMESH_Mesh::_duplicate( mesh );
meshServant->GetImpl().GetMeshDS()->Modified();
}
- aStudyBuilder->CommitCommand();
+ if ( !aStudyBuilder->_is_nil() )
+ aStudyBuilder->CommitCommand();
}
// Update Python script
bool SMESH_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR)
{
if(MYDEBUG) MESSAGE("CanPublishInStudy - "<<!CORBA::is_nil(myCurrentStudy));
- if(CORBA::is_nil(myCurrentStudy))
+ if( GetCurrentStudyID() < 0 )
return false;
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(theIOR);