mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 17:30:35 +05:00
fix dumping colors:
use valid python names instead of names in Study
This commit is contained in:
parent
216883b953
commit
99c8d3b659
@ -461,7 +461,7 @@ Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Object_ptr theStudy,
|
||||
// Add trace of API methods calls and replace study entries by names
|
||||
TCollection_AsciiString aScript =
|
||||
"### This file is generated by SALOME automatically by dump python functionality of SMESH component\n\n";
|
||||
aScript += DumpPython_impl(aStudy->StudyId(), aMap, aMapNames,
|
||||
aScript += DumpPython_impl(aStudy, aMap, aMapNames,
|
||||
isPublished, isValidScript, aSavedTrace);
|
||||
|
||||
//inserting export for Object Names
|
||||
@ -650,7 +650,7 @@ namespace {
|
||||
*/
|
||||
//=============================================================================
|
||||
TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
||||
(int theStudyID,
|
||||
(SALOMEDS::Study_ptr theStudy,
|
||||
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
||||
Resource_DataMapOfAsciiStringAsciiString& theNames,
|
||||
bool isPublished,
|
||||
@ -707,7 +707,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
||||
}
|
||||
|
||||
// Dump trace of API methods calls
|
||||
TCollection_AsciiString aNewLines = GetNewPythonLines(theStudyID);
|
||||
TCollection_AsciiString aNewLines = GetNewPythonLines(theStudy->StudyId());
|
||||
if (aNewLines.Length() > 0) {
|
||||
aScript += helper + "\n" + aNewLines;
|
||||
}
|
||||
@ -801,49 +801,33 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
||||
if (aSeq->Value(aLen) < aScriptLength)
|
||||
anUpdatedScript += aScript.SubString(aSeq->Value(aLen) + 1, aScriptLength);
|
||||
|
||||
|
||||
SMESH_Gen_i* aSMESHGenI = SMESH_Gen_i::GetSMESHGen();
|
||||
SALOMEDS::Study_ptr aStudy = aSMESHGenI->GetCurrentStudy();
|
||||
if( !CORBA::is_nil(aStudy) )
|
||||
// Set colors
|
||||
SALOMEDS::SObject_var aComp = theStudy->FindComponent(ComponentDataType());
|
||||
if( !CORBA::is_nil(aComp) )
|
||||
{
|
||||
SALOMEDS::SObject_var aComp = aStudy->FindComponent(ComponentDataType());
|
||||
if( !CORBA::is_nil(aComp) )
|
||||
SALOMEDS::ChildIterator_var Itr = theStudy->NewChildIterator(aComp);
|
||||
for( Itr->InitEx(true); Itr->More(); Itr->Next() )
|
||||
{
|
||||
SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aComp);
|
||||
for( Itr->InitEx(true); Itr->More(); Itr->Next() )
|
||||
SALOMEDS::SObject_var aSObj = Itr->Value();
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SObjectToObject( aSObj ) );
|
||||
// mesh auto color
|
||||
if( !CORBA::is_nil(aMesh) && aMesh->GetAutoColor() )
|
||||
{
|
||||
SALOMEDS::SObject_var aSObj = Itr->Value();
|
||||
CORBA::String_var aName = aSObj->GetName();
|
||||
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH_Gen_i::SObjectToObject( aSObj ) );
|
||||
if( !CORBA::is_nil(aMesh) )
|
||||
{
|
||||
bool isAutoColor = aMesh->GetAutoColor();
|
||||
if( isAutoColor )
|
||||
{
|
||||
anUpdatedScript += "\n\t";
|
||||
anUpdatedScript += (char*)aName.in();
|
||||
anUpdatedScript += ".SetAutoColor(1)";
|
||||
}
|
||||
}
|
||||
|
||||
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH_Gen_i::SObjectToObject( aSObj ) );
|
||||
if( !CORBA::is_nil(aGroup) )
|
||||
{
|
||||
SALOMEDS::Color aColor = aGroup->GetColor();
|
||||
if ( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 )
|
||||
{
|
||||
anUpdatedScript += "\n\t";
|
||||
anUpdatedScript += (char*)aName.in();
|
||||
anUpdatedScript += ".SetColor(SALOMEDS.Color(";
|
||||
anUpdatedScript += aColor.R;
|
||||
anUpdatedScript += ",";
|
||||
anUpdatedScript += aColor.G;
|
||||
anUpdatedScript += ",";
|
||||
anUpdatedScript += aColor.B;
|
||||
anUpdatedScript += "))";
|
||||
}
|
||||
}
|
||||
CORBA::String_var anEntry = aSObj->GetID();
|
||||
anUpdatedScript +=
|
||||
SMESH_Comment("\n\t") << theObjectNames(anEntry.inout()) << ".SetAutoColor(1)";
|
||||
}
|
||||
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SObjectToObject(aSObj));
|
||||
if( !CORBA::is_nil(aGroup) )
|
||||
{
|
||||
SALOMEDS::Color aColor = aGroup->GetColor();
|
||||
if ( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 )
|
||||
{
|
||||
CORBA::String_var anEntry = aSObj->GetID();
|
||||
anUpdatedScript += SMESH_Comment("\n\t")
|
||||
<< theObjectNames(anEntry.inout()) << ".SetColor(SALOMEDS.Color("
|
||||
<< aColor.R <<", "<< aColor.G <<", "<< aColor.B <<" ))";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ public:
|
||||
|
||||
void SavePython (SALOMEDS::Study_ptr theStudy);
|
||||
|
||||
TCollection_AsciiString DumpPython_impl (int theStudyID,
|
||||
TCollection_AsciiString DumpPython_impl (SALOMEDS::Study_ptr theStudy,
|
||||
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
||||
Resource_DataMapOfAsciiStringAsciiString& theNames,
|
||||
bool isPublished,
|
||||
|
Loading…
Reference in New Issue
Block a user