SALOMEDS::SObject_var aSO =
_gen_i->PublishSubMesh(_gen_i->GetCurrentStudy(), aMesh,
subMesh, aSubShapeObject, theName );
-
- // Update Python script
- TCollection_AsciiString aStr (aSO->GetID());
- aStr += " = ";
- SMESH_Gen_i::AddObject(aStr, _this()) += ".GetSubMesh(";
- SMESH_Gen_i::AddObject(aStr, aSubShapeObject) += ", \"";
- aStr += (char*)theName;
- aStr += "\")";
-
- SMESH_Gen_i::AddToCurrentPyScript(aStr);
+ if ( !aSO->_is_nil()) {
+ // Update Python script
+ TCollection_AsciiString aStr (aSO->GetID());
+ aStr += " = ";
+ SMESH_Gen_i::AddObject(aStr, _this()) += ".GetSubMesh(";
+ SMESH_Gen_i::AddObject(aStr, aSubShapeObject) += ", \"";
+ aStr += (char*)theName;
+ aStr += "\")";
+
+ SMESH_Gen_i::AddToCurrentPyScript(aStr);
+ }
}
}
catch(SALOME_Exception & S_ex) {
SALOMEDS::SObject_var aSO =
_gen_i->PublishGroup(_gen_i->GetCurrentStudy(), _this(),
aNewGroup, GEOM::GEOM_Object::_nil(), theName);
+ if ( !aSO->_is_nil()) {
+ // Update Python script
+ TCollection_AsciiString aStr (aSO->GetID());
+ aStr += " = ";
+ SMESH_Gen_i::AddObject(aStr, _this()) += ".CreateGroup(";
+ aStr += ElementTypeString(theElemType) + ", \"" + (char*)theName + "\")";
- // Update Python script
- TCollection_AsciiString aStr (aSO->GetID());
- aStr += " = ";
- SMESH_Gen_i::AddObject(aStr, _this()) += ".CreateGroup(";
- aStr += ElementTypeString(theElemType) + ", \"" + (char*)theName + "\")";
-
- SMESH_Gen_i::AddToCurrentPyScript(aStr);
+ SMESH_Gen_i::AddToCurrentPyScript(aStr);
+ }
}
return aNewGroup._retn();
SALOMEDS::SObject_var aSO =
_gen_i->PublishGroup(_gen_i->GetCurrentStudy(), _this(),
aNewGroup, theGeomObj, theName);
-
- // Update Python script
- TCollection_AsciiString aStr (aSO->GetID());
- aStr += " = ";
- SMESH_Gen_i::AddObject(aStr, _this()) += ".CreateGroupFromGEOM(";
- aStr += ElementTypeString(theElemType) + ", \"" + (char*)theName + "\", ";
- SMESH_Gen_i::AddObject(aStr, theGeomObj) += ")";
-
- SMESH_Gen_i::AddToCurrentPyScript(aStr);
+ if ( !aSO->_is_nil()) {
+ // Update Python script
+ TCollection_AsciiString aStr (aSO->GetID());
+ aStr += " = ";
+ SMESH_Gen_i::AddObject(aStr, _this()) += ".CreateGroupFromGEOM(";
+ aStr += ElementTypeString(theElemType) + ", \"" + (char*)theName + "\", ";
+ SMESH_Gen_i::AddObject(aStr, theGeomObj) += ")";
+
+ SMESH_Gen_i::AddToCurrentPyScript(aStr);
+ }
}
}