23156: EDF 9626 SMESH: Dump study produces a non-working script

52874: List of available groups in 'Group' combo-box is empty for sub-mesh and group.
52871: Mesh Information dialog shows different number of nodes for group of elements
Regression of Grids/smesh/sewing_00/A5
This commit is contained in:
eap 2015-09-25 21:15:51 +03:00
parent 16224f624c
commit 8682ebb1eb
4 changed files with 44 additions and 11 deletions

View File

@ -8751,6 +8751,16 @@ SMESH_MeshEditor::SewFreeBorder (const SMDS_MeshNode* theBordFirstNode,
else
newFaces.Append( myLastCreatedElems(i) );
}
// get segments adjacent to merged nodes
TListOfListOfNodes::iterator groupIt = nodeGroupsToMerge.begin();
for ( ; groupIt != nodeGroupsToMerge.end(); groupIt++ )
{
const list<const SMDS_MeshNode*>& nodes = *groupIt;
SMDS_ElemIteratorPtr segIt = nodes.front()->GetInverseElementIterator( SMDSAbs_Edge );
while ( segIt->more() )
segments.insert( segIt->next() );
}
// find coincident
TListOfListOfElementsID equalGroups;
if ( !segments.empty() )

View File

@ -298,11 +298,12 @@ void SMESHGUI_Add0DElemsOnAllNodesOp::selectionDone()
myDlg->myGroupListCmBox->clear();
myDlg->myGroupListCmBox->addItem( QString() );
if ( !myIO.IsNull() && myIO->hasEntry()) {
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
_PTR(SObject) meshSO = aStudy->FindObjectID( myIO->getEntry() );
SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO( myIO );
_PTR(SObject) meshSO = SMESH::ObjectToSObject( mesh );
_PTR(SObject) group0DRoot;
if ( meshSO->FindSubObject( SMESH::Tag_0DElementsGroups, group0DRoot ))
if ( meshSO && meshSO->FindSubObject( SMESH::Tag_0DElementsGroups, group0DRoot ))
{
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
_PTR(ChildIterator) group0DIter = aStudy->NewChildIterator( group0DRoot );
for ( ; group0DIter->More(); group0DIter->Next() )
{

View File

@ -2912,8 +2912,8 @@ void SMESHGUI_MeshInfoDlg::showInfo( const Handle(SALOME_InteractiveObject)& IO
{
SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
if ( !CORBA::is_nil( obj ) ) {
myBaseInfo->showInfo( obj );
myAddInfo->showInfo( obj );
myAddInfo->showInfo( obj ); // nb of nodes in a group can be computed by myAddInfo,
myBaseInfo->showInfo( obj ); // and it will be used by myBaseInfo (IPAL52871)
myCtrlInfo->showInfo( obj );
myActor = SMESH::FindActorByEntry( IO->getEntry() );

View File

@ -692,6 +692,23 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
{
//id_mesh->second->AddProcessedCmd( aCommand );
// Wrap Export*() into try-except
if ( aCommand->MethodStartsFrom("Export"))
{
_AString tab = "\t";
_AString indent = aCommand->GetIndentation();
_AString tryStr = indent + "try:";
_AString newCmd = indent + tab + ( aCommand->GetString().ToCString() + indent.Length() );
_AString excStr = indent + "except:";
_AString msgStr = indent + "\tprint '"; msgStr += method + "() failed. Invalid file name?'";
myCommands.insert( --myCommands.end(), new _pyCommand( tryStr, myNbCommands ));
aCommand->Clear();
aCommand->GetString() = newCmd;
aCommand->SetOrderNb( ++myNbCommands );
myCommands.push_back( new _pyCommand( excStr, ++myNbCommands ));
myCommands.push_back( new _pyCommand( msgStr, ++myNbCommands ));
}
// check for mesh editor object
if ( aCommand->GetMethod() == "GetMeshEditor" ) { // MeshEditor creation
_pyID editorID = aCommand->GetResultValue();
@ -1880,6 +1897,10 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
}
}
// ----------------------------------------------------------------------
else if ( method == "GetSubMeshes" ) { // clear as the command does nothing (0023156)
theCommand->Clear();
}
// ----------------------------------------------------------------------
else if ( method == "AddHypothesis" ) { // mesh.AddHypothesis(geom, HYPO )
myAddHypCmds.push_back( theCommand );
// set mesh to hypo
@ -3564,11 +3585,9 @@ void _pyCommand::SetBegPos( int thePartIndex, int thePosition )
TCollection_AsciiString _pyCommand::GetIndentation()
{
int end = 1;
if ( GetBegPos( RESULT_IND ) == UNKNOWN )
GetWord( myString, end, true );
else
end = GetBegPos( RESULT_IND );
return myString.SubString( 1, Max( end - 1, 1 ));
while ( end <= Length() && isblank( myString.Value( end )))
++end;
return ( end == 1 ) ? _AString("") : myString.SubString( 1, end - 1 );
}
//================================================================================
@ -3723,12 +3742,15 @@ const TCollection_AsciiString & _pyCommand::GetMethod()
if ( GetBegPos( METHOD_IND ) == UNKNOWN )
{
// beginning
int begPos = GetBegPos( OBJECT_IND ) + myObj.Length();
int begPos = GetBegPos( OBJECT_IND );
bool forward = true;
if ( begPos < 1 ) {
begPos = myString.Location( "(", 1, Length() ) - 1;
forward = false;
}
else {
begPos += myObj.Length();
}
// store
myMeth = GetWord( myString, begPos, forward );
SetBegPos( METHOD_IND, begPos );