- if ( CanPublishInStudy( aMesh ) )
- PublishInStudy( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
+ if ( CanPublishInStudy( aMesh ) ) {
+ SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
+ aStudyBuilder->NewCommand(); // There is a transaction
+ SALOMEDS::SObject_var aSO = PublishInStudy
+ ( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
+ aStudyBuilder->CommitCommand();
+ if ( !aSO->_is_nil() ) {
+ // Update Python script
+ TCollection_AsciiString aStr (aSO->GetID());
+ aStr += " = smesh.CreateMeshesFromSTL(\"";
+ aStr += Standard_CString(theFileName);
+ aStr += "\")";
+
+ AddToCurrentPyScript(aStr);
+ }
+ }