mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-17 02:07:56 +05:00
Dump Python. Solve pb of dif objects having same name. Correct entry detection
This commit is contained in:
parent
705488d6da
commit
fd4f2854ec
@ -395,18 +395,31 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
|||||||
anUpdatedScript += aScript.SubString(aStart, aSeq->Value(i)-1);
|
anUpdatedScript += aScript.SubString(aStart, aSeq->Value(i)-1);
|
||||||
anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i+1));
|
anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i+1));
|
||||||
if(theObjectNames.IsBound(anEntry)) {
|
if(theObjectNames.IsBound(anEntry)) {
|
||||||
aName = theObjectNames.Find(anEntry);
|
aName = theObjectNames.Find(anEntry);
|
||||||
|
if ( theObjectNames.IsBound( aName ) && anEntry != theObjectNames( aName ))
|
||||||
|
{ // diff objects have same name - make a new name
|
||||||
|
TCollection_AsciiString aName2;
|
||||||
|
Standard_Integer i = 0;
|
||||||
|
do {
|
||||||
|
aName2 = aName + "_" + ++i;
|
||||||
|
} while ( theObjectNames.IsBound( aName2 ) && anEntry != theObjectNames( aName2 ));
|
||||||
|
aName = aName2;
|
||||||
|
theObjectNames( anEntry ) = aName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aName = aBaseName + TCollection_AsciiString(++objectCounter);
|
do {
|
||||||
while(theObjectNames.IsBound(aName)) aName = aBaseName + TCollection_AsciiString(++objectCounter);
|
aName = aBaseName + TCollection_AsciiString(++objectCounter);
|
||||||
|
} while(theObjectNames.IsBound(aName));
|
||||||
|
theObjectNames.Bind(anEntry, aName);
|
||||||
}
|
}
|
||||||
|
theObjectNames.Bind(aName, anEntry); // to detect same name of diff objects
|
||||||
|
|
||||||
anUpdatedScript += aName;
|
anUpdatedScript += aName;
|
||||||
aNames.Bind(aName, "1");
|
aNames.Bind(aName, "1");
|
||||||
aStart = aSeq->Value(i+1) + 1;
|
aStart = aSeq->Value(i+1) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add final part of the script
|
//Add final part of the script
|
||||||
if(aSeq->Value(aLen) < aScriptLength) anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength);
|
if(aSeq->Value(aLen) < aScriptLength) anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength);
|
||||||
|
|
||||||
@ -474,7 +487,7 @@ Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theStrin
|
|||||||
if(c == 58) isFound = Standard_True;
|
if(c == 58) isFound = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isFound) {
|
if(isFound && arr[j-2] != 58) { // last char should be a diggit
|
||||||
aSeq->Append(i+1); // +1 because AsciiString starts from 1
|
aSeq->Append(i+1); // +1 because AsciiString starts from 1
|
||||||
aSeq->Append(j-1);
|
aSeq->Append(j-1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user