]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESH_I/SMESH_DumpPython.cxx
Salome HOME
cf473648f69aef2a50ac152269bd084d573f2a49
[modules/smesh.git] / src / SMESH_I / SMESH_DumpPython.cxx
1 // File    : SMESH_Gen_i_DumpPython.cxx
2 // Created : Thu Mar 24 17:17:59 2005
3 // Author  : Julia DOROVSKIKH
4 // Module  : SMESH
5 // $Header : $
6
7 #include "SMESH_PythonDump.hxx"
8 #include "SMESH_Gen_i.hxx"
9 #include "SMESH_Filter_i.hxx"
10 #include "SALOMEDSImpl_Study.hxx"
11
12 #include <TColStd_HSequenceOfInteger.hxx>
13 #include <TCollection_AsciiString.hxx>
14
15
16 #ifdef _DEBUG_
17 static int MYDEBUG = 0;
18 #else
19 static int MYDEBUG = 0;
20 #endif
21
22 static TCollection_AsciiString NotPublishedObjectName()
23 {
24   return "__NOT__Published__Object__";
25 }
26
27 namespace SMESH
28 {
29
30   size_t TPythonDump::myCounter = 0;
31
32   TPythonDump::
33   TPythonDump()
34   {
35     ++myCounter;
36   }
37   TPythonDump::
38   ~TPythonDump()
39   {
40     if(--myCounter == 0){
41       SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
42       SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
43       if(!aStudy->_is_nil()){
44         std::string aString = myStream.str();
45         TCollection_AsciiString aCollection(Standard_CString(aString.c_str()));
46         aSMESHGen->AddToPythonScript(aStudy->StudyId(),aCollection);
47         if(MYDEBUG) MESSAGE(aString);
48       }
49     }
50   }
51
52   TPythonDump& 
53   TPythonDump::
54   operator<<(long int theArg){
55     myStream<<theArg;
56     return *this;
57   }
58
59   TPythonDump& 
60   TPythonDump::
61   operator<<(int theArg){
62     myStream<<theArg;
63     return *this;
64   }
65
66   TPythonDump& 
67   TPythonDump::
68   operator<<(double theArg){
69     myStream<<theArg;
70     return *this;
71   }
72
73   TPythonDump& 
74   TPythonDump::
75   operator<<(float theArg){
76     myStream<<theArg;
77     return *this;
78   }
79
80   TPythonDump& 
81   TPythonDump::
82   operator<<(const void* theArg){
83     myStream<<theArg;
84     return *this;
85   }
86
87   TPythonDump& 
88   TPythonDump::
89   operator<<(const char* theArg){
90     myStream<<theArg;
91     return *this;
92   }
93
94   TPythonDump& 
95   TPythonDump::
96   operator<<(const SMESH::ElementType& theArg)
97   {
98     myStream<<"SMESH.";
99     switch(theArg){
100     case ALL: 
101       myStream<<"ALL"; 
102       break;
103     case NODE: 
104       myStream<<"NODE"; 
105       break;
106     case EDGE: 
107       myStream<<"EDGE"; 
108       break;
109     case FACE: 
110       myStream<<"FACE"; 
111       break;
112     case VOLUME: 
113       myStream<<"VOLUME"; 
114       break;
115     }
116     return *this;
117   }
118
119
120   TPythonDump& 
121   TPythonDump::
122   operator<<(const SMESH::long_array& theArg)
123   {
124     myStream<<"[ ";
125     CORBA::Long i = 1, iEnd = theArg.length();
126     for(; i <= iEnd; i++) {
127       myStream<<theArg[i-1];
128       if(i < iEnd)
129         myStream<< ", ";
130     }
131     myStream<<" ]";
132     return *this;
133   }
134
135
136   TPythonDump& 
137   TPythonDump::
138   operator<<(CORBA::Object_ptr theArg)
139   {
140     TCollection_AsciiString aString("None");
141     SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
142     SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
143     SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
144     if(!aSObject->_is_nil()){
145       aString = aSObject->GetID();
146     }else if(!CORBA::is_nil(theArg)){
147       aString = "smeshObj_";
148       if ( aSMESHGen->CanPublishInStudy( theArg )) // not published SMESH object
149         aString += (int) theArg;
150       else
151         aString = NotPublishedObjectName();
152     }
153     myStream<<aString.ToCString();
154     return *this;
155   }
156
157   TPythonDump& 
158   TPythonDump::
159   operator<<(SMESH::FilterLibrary_i* theArg)
160   {
161     myStream<<"aFilterLibrary"<<theArg;
162     return *this;
163   }
164
165   TPythonDump& 
166   TPythonDump::
167   operator<<(SMESH::FilterManager_i* theArg)
168   {
169     myStream<<"aFilterManager";
170     return *this;
171   }
172
173   TPythonDump& 
174   TPythonDump::
175   operator<<(SMESH::Filter_i* theArg)
176   {
177     myStream<<"aFilter"<<theArg;
178     return *this;
179   }
180
181   TPythonDump& 
182   TPythonDump::
183   operator<<(SMESH::Functor_i* theArg)
184   {
185     FunctorType aFunctorType = theArg->GetFunctorType();
186     switch(aFunctorType){
187     case FT_AspectRatio:
188       myStream<<"anAspectRatio";
189       break;
190     case FT_AspectRatio3D:
191       myStream<<"anAspectRatio3D";
192       break;
193     case FT_Warping:
194       myStream<<"aWarping";
195       break;
196     case FT_MinimumAngle:
197       myStream<<"aMinimumAngle";
198       break;
199     case FT_Taper:
200       myStream<<"aTaper";
201       break;
202     case FT_Skew:
203       myStream<<"aSkew";
204       break;
205     case FT_Area:
206       myStream<<"aArea";
207       break;
208     case FT_FreeBorders:
209       myStream<<"aFreeBorders";
210       break;
211     case FT_FreeEdges:
212       myStream<<"aFreeEdges";
213       break;
214     case FT_MultiConnection:
215       myStream<<"aMultiConnection";
216       break;
217     case FT_MultiConnection2D:
218       myStream<<"aMultiConnection2D";
219       break;
220     case FT_Length:
221       myStream<<"aLength";
222       break;
223     case FT_Length2D:
224       myStream<<"aLength";
225       break;
226     case FT_BelongToGeom:
227       myStream<<"aBelongToGeom";
228       break;
229     case FT_BelongToPlane:
230       myStream<<"aBelongToPlane";
231       break;
232     case FT_BelongToCylinder:
233       myStream<<"aBelongToCylinder";
234       break;
235     case FT_LyingOnGeom:
236       myStream<<"aLyingOnGeom";
237       break;
238     case FT_RangeOfIds:
239       myStream<<"aRangeOfIds";
240       break;
241     case FT_BadOrientedVolume:
242       myStream<<"aBadOrientedVolume";
243       break;
244     case FT_LessThan:
245       myStream<<"aLessThan";
246       break;
247     case FT_MoreThan:
248       myStream<<"aMoreThan";
249       break;
250     case FT_EqualTo:
251       myStream<<"anEqualTo";
252       break;
253     case FT_LogicalNOT:
254       myStream<<"aLogicalNOT";
255       break;
256     case FT_LogicalAND:
257       myStream<<"aLogicalAND";
258       break;
259     case FT_LogicalOR:
260       myStream<<"aLogicalOR";
261       break;
262     case FT_Undefined:
263       myStream<<"anUndefined";
264       break;
265     }
266     myStream<<theArg;
267     return *this;
268   }
269 }
270
271 //=======================================================================
272 //function : DumpPython
273 //purpose  : 
274 //=======================================================================
275 Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Object_ptr theStudy,
276                                            CORBA::Boolean isPublished,
277                                            CORBA::Boolean& isValidScript)
278 {
279   SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
280   if (CORBA::is_nil(aStudy))
281     return new Engines::TMPFile(0);
282
283   SALOMEDS::SObject_var aSO = aStudy->FindComponent(ComponentDataType());
284   if (CORBA::is_nil(aSO))
285     return new Engines::TMPFile(0);
286
287   // Map study entries to object names
288   Resource_DataMapOfAsciiStringAsciiString aMap;
289   Resource_DataMapOfAsciiStringAsciiString aMapNames;
290   TCollection_AsciiString s ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_");
291
292   SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO);
293   for (Itr->InitEx(true); Itr->More(); Itr->Next()) {
294     SALOMEDS::SObject_var aValue = Itr->Value();
295     CORBA::String_var anID = aValue->GetID();
296     CORBA::String_var aName = aValue->GetName();
297     TCollection_AsciiString aGUIName ( (char*) aName.in() );
298     TCollection_AsciiString anEnrty ( (char*) anID.in() );
299     if (aGUIName.Length() > 0) {
300       aMapNames.Bind( anEnrty, aGUIName );
301       aMap.Bind( anEnrty, aGUIName );
302     }
303   }
304
305   // Get trace of restored study
306   //SALOMEDS::SObject_var aSO = SMESH_Gen_i::ObjectToSObject(theStudy, _this());
307   SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
308   SALOMEDS::GenericAttribute_var anAttr =
309     aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePythonObject");
310
311   char* oldValue = SALOMEDS::AttributePythonObject::_narrow(anAttr)->GetObject();
312   TCollection_AsciiString aSavedTrace (oldValue);
313
314   // Add trace of API methods calls and replace study entries by names
315   TCollection_AsciiString aScript =
316     SALOMEDSImpl_Study::GetDumpStudyComment("SMESH") + "\n\n" +
317       DumpPython_impl(aStudy->StudyId(), aMap, aMapNames, isPublished, isValidScript, aSavedTrace);
318
319   int aLen = aScript.Length(); 
320   unsigned char* aBuffer = new unsigned char[aLen+1];
321   strcpy((char*)aBuffer, aScript.ToCString());
322
323   CORBA::Octet* anOctetBuf =  (CORBA::Octet*)aBuffer;
324   Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aLen+1, aLen+1, anOctetBuf, 1); 
325
326   bool hasNotPublishedObjects = aScript.Location( NotPublishedObjectName(), 1, aLen);
327   isValidScript = isValidScript && !hasNotPublishedObjects;
328
329   return aStreamFile._retn(); 
330 }
331
332 //=============================================================================
333 /*!
334  *  AddToPythonScript
335  */
336 //=============================================================================
337 void SMESH_Gen_i::AddToPythonScript (int theStudyID, const TCollection_AsciiString& theString)
338 {
339   if (myPythonScripts.find(theStudyID) == myPythonScripts.end()) {
340     myPythonScripts[theStudyID] = new TColStd_HSequenceOfAsciiString;
341   }
342   myPythonScripts[theStudyID]->Append(theString);
343 }
344
345 //=============================================================================
346 /*!
347  *  RemoveLastFromPythonScript
348  */
349 //=============================================================================
350 void SMESH_Gen_i::RemoveLastFromPythonScript (int theStudyID)
351 {
352   if (myPythonScripts.find(theStudyID) != myPythonScripts.end()) {
353     int aLen = myPythonScripts[theStudyID]->Length();
354     myPythonScripts[theStudyID]->Remove(aLen);
355   }
356 }
357
358 //=======================================================================
359 //function : AddToCurrentPyScript
360 //purpose  : 
361 //=======================================================================
362
363 void SMESH_Gen_i::AddToCurrentPyScript (const TCollection_AsciiString& theString)
364 {
365   SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
366   SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
367   if (aStudy->_is_nil()) return;
368   aSMESHGen->AddToPythonScript(aStudy->StudyId(), theString);
369 }
370
371
372 //=======================================================================
373 //function : AddObject
374 //purpose  : add object to script string
375 //=======================================================================
376
377 TCollection_AsciiString& SMESH_Gen_i::AddObject(TCollection_AsciiString& theStr,
378                                                 CORBA::Object_ptr        theObject)
379 {
380   TCollection_AsciiString aString("None");
381   SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
382   SALOMEDS::SObject_var aSObject =
383     aSMESHGen->ObjectToSObject(aSMESHGen->GetCurrentStudy(), theObject);
384   if ( !aSObject->_is_nil() ) {
385     aString = aSObject->GetID();
386   } else if ( !CORBA::is_nil( theObject )) {
387     aString = "smeshObj_";
388     if ( aSMESHGen->CanPublishInStudy( theObject )) // not published SMESH object
389       aString += (int) theObject;
390     else
391       aString = NotPublishedObjectName();
392   }
393   theStr += aString;
394   return theStr;
395 }
396
397 //=======================================================================
398 //function : SavePython
399 //purpose  : 
400 //=======================================================================
401 void SMESH_Gen_i::SavePython (SALOMEDS::Study_ptr theStudy)
402 {
403   // Dump trace of API methods calls
404   TCollection_AsciiString aScript = GetNewPythonLines(theStudy->StudyId());
405
406   // Check contents of PythonObject attribute
407   SALOMEDS::SObject_var aSO = theStudy->FindComponent(ComponentDataType());
408   //SALOMEDS::SObject_var aSO = SMESH_Gen_i::ObjectToSObject(theStudy, _this());
409   SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
410   SALOMEDS::GenericAttribute_var anAttr =
411     aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePythonObject");
412
413   char* oldValue = SALOMEDS::AttributePythonObject::_narrow(anAttr)->GetObject();
414   TCollection_AsciiString oldScript (oldValue);
415
416   if (oldScript.Length() > 0) {
417     oldScript += "\n";
418     oldScript += aScript;
419   } else {
420     oldScript = aScript;
421   }
422
423   // Store in PythonObject attribute
424   SALOMEDS::AttributePythonObject::_narrow(anAttr)->SetObject(oldScript.ToCString(), 1);
425
426   // Clean trace of API methods calls
427   CleanPythonTrace(theStudy->StudyId());
428 }
429
430
431 // impl
432
433
434 //=============================================================================
435 /*!
436  *  FindEntries: Returns a sequence of start/end positions of entries in the string
437  */
438 //=============================================================================
439 Handle(TColStd_HSequenceOfInteger) FindEntries (TCollection_AsciiString& theString)
440 {
441   Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
442   Standard_Integer aLen = theString.Length();
443   Standard_Boolean isFound = Standard_False;
444
445   char* arr = theString.ToCString();
446   Standard_Integer i = 0, j;
447
448   while(i < aLen) {
449     int c = (int)arr[i];
450     j = i+1;
451     if(c >= 48 && c <= 57) { //Is digit?
452  
453       isFound = Standard_False;
454       while((j < aLen) && ((c >= 48 && c <= 57) || c == 58) ) { //Check if it is an entry
455         c = (int)arr[j++];  
456         if(c == 58) isFound = Standard_True;
457       }
458
459       if (isFound) {
460         int prev = (i < 1) ? 0 : (int)arr[i - 1];
461         // last char should be a diggit,
462         // previous char should not be '"'.
463         if (arr[j-2] != 58 && prev != 34) {
464           aSeq->Append(i+1); // +1 because AsciiString starts from 1
465           aSeq->Append(j-1);
466         }
467       }
468     }
469
470     i = j;
471   }
472
473   return aSeq;
474 }
475
476 //=============================================================================
477 /*!
478  *  DumpPython
479  */
480 //=============================================================================
481 TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
482                         (int theStudyID, 
483                          Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
484                          Resource_DataMapOfAsciiStringAsciiString& theNames,
485                          bool isPublished, 
486                          bool& aValidScript,
487                          const TCollection_AsciiString& theSavedTrace)
488 {
489   TCollection_AsciiString aScript;
490   aScript = "def RebuildData(theStudy):";
491   aScript += "\n\tsmesh = salome.lcc.FindOrLoadComponent(\"FactoryServer\", \"SMESH\")";
492   aScript += "\n\taFilterManager = smesh.CreateFilterManager()";
493   if ( isPublished )
494     aScript += "\n\tsmesh.SetCurrentStudy(theStudy)";
495   else
496     aScript += "\n\tsmesh.SetCurrentStudy(None)";
497
498   // Dump trace of restored study
499   if (theSavedTrace.Length() > 0) {
500     aScript += "\n";
501     aScript += theSavedTrace;
502   }
503
504   // Dump trace of API methods calls
505   TCollection_AsciiString aNewLines = GetNewPythonLines(theStudyID);
506   if (aNewLines.Length() > 0) {
507     aScript += "\n";
508     aScript += aNewLines;
509   }
510
511   // Find entries to be replaced by names
512   Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(aScript);
513   Standard_Integer aLen = aSeq->Length();
514
515   if (aLen == 0)
516     return aScript;
517
518   // Replace entries by the names
519   GEOM::GEOM_Gen_ptr geom = GetGeomEngine();
520   TColStd_SequenceOfAsciiString seqRemoved;
521   Resource_DataMapOfAsciiStringAsciiString mapRemoved;
522   Standard_Integer objectCounter = 0, aStart = 1, aScriptLength = aScript.Length();
523   TCollection_AsciiString anUpdatedScript, anEntry, aName, aBaseName("smeshObj_"),
524     allowedChars ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_");
525
526   // Collect names of GEOM objects to exclude same names for SMESH objects
527   GEOM::string_array_var aGeomNames = geom->GetAllDumpNames();
528   int ign = 0, nbgn = aGeomNames->length();
529   for (; ign < nbgn; ign++) {
530     aName = aGeomNames[ign];
531     theObjectNames.Bind(aName, "1");
532   }
533
534   bool importGeom = false;
535   for (Standard_Integer i = 1; i <= aLen; i += 2) {
536     anUpdatedScript += aScript.SubString(aStart, aSeq->Value(i) - 1);
537     anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i + 1));
538     // is a GEOM object?
539     aName = geom->GetDumpName( anEntry.ToCString() );
540     if (aName.IsEmpty()) {
541       // is a SMESH object
542       if (theObjectNames.IsBound(anEntry)) {
543         // The Object is in Study
544         aName = theObjectNames.Find(anEntry);
545         // check validity of aName
546         bool isValidName = true;
547         if ( aName.IsIntegerValue() ) { // aName must not start with a digit
548           aName.Insert( 1, 'a' );
549           isValidName = false;
550         }
551         int p, p2=1; // replace not allowed chars
552         while ((p = aName.FirstLocationNotInSet(allowedChars, p2, aName.Length()))) {
553           aName.SetValue(p, '_');
554           p2=p;
555           isValidName = false;
556         }
557         if (theObjectNames.IsBound(aName) && anEntry != theObjectNames(aName)) {
558           // diff objects have same name - make a new name by appending a digit
559           TCollection_AsciiString aName2;
560           Standard_Integer i = 0;
561           do {
562             aName2 = aName + "_" + ++i;
563           } while (theObjectNames.IsBound(aName2) && anEntry != theObjectNames(aName2));
564           aName = aName2;
565           isValidName = false;
566         }
567         if ( !isValidName )
568           theObjectNames(anEntry) = aName;
569
570       } else {
571         // Removed Object
572         do {
573           aName = aBaseName + TCollection_AsciiString(++objectCounter);
574         } while (theObjectNames.IsBound(aName));
575         seqRemoved.Append(aName);
576         mapRemoved.Bind(anEntry, "1");
577         theObjectNames.Bind(anEntry, aName);
578       }
579       theObjectNames.Bind(aName, anEntry); // to detect same name of diff objects
580     }
581     else
582     {
583       importGeom = true;
584     }
585     anUpdatedScript += aName;
586     aStart = aSeq->Value(i + 1) + 1;
587   }
588
589   // set initial part of aSript
590   TCollection_AsciiString initPart = "import salome, SMESH, StdMeshers\n\n";
591   if ( importGeom )
592   {
593     initPart += ("import string, os, sys, re\n"
594                  "sys.path.insert( 0, os.path.dirname(__file__) )\n"
595                  "exec(\"from \"+re.sub(\"SMESH$\",\"GEOM\",__name__)+\" import *\")\n\n");
596   }
597   anUpdatedScript.Insert ( 1, initPart );
598
599   // add final part of aScript
600   if (aSeq->Value(aLen) < aScriptLength)
601     anUpdatedScript += aScript.SubString(aSeq->Value(aLen) + 1, aScriptLength);
602
603   // Remove removed objects
604   anUpdatedScript += "\n\taStudyBuilder = theStudy.NewBuilder()";
605   for (int ir = 1; ir <= seqRemoved.Length(); ir++) {
606     anUpdatedScript += "\n\tSO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(";
607     anUpdatedScript += seqRemoved.Value(ir);
608     anUpdatedScript += "))\n\tif SO is not None: aStudyBuilder.RemoveObjectWithChildren(SO)";
609   }
610
611   // Set object names
612   anUpdatedScript += "\n\n\tisGUIMode = ";
613   anUpdatedScript += isPublished;
614   anUpdatedScript += "\n\tif isGUIMode:";
615   anUpdatedScript += "\n\t\tsmeshgui = salome.ImportComponentGUI(\"SMESH\")";
616   anUpdatedScript += "\n\t\tsmeshgui.Init(theStudy._get_StudyId())";
617   anUpdatedScript += "\n";
618
619   TCollection_AsciiString aGUIName;
620   Resource_DataMapOfAsciiStringAsciiString mapEntries;
621   for (Standard_Integer i = 1; i <= aLen; i += 2) {
622     anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i + 1));
623     aName = geom->GetDumpName( anEntry.ToCString() );
624     if (aName.IsEmpty() && // Not a GEOM object
625         theNames.IsBound(anEntry) &&
626         !mapEntries.IsBound(anEntry) && // Not yet processed
627         !mapRemoved.IsBound(anEntry)) { // Was not removed
628       aName = theObjectNames.Find(anEntry);
629       aGUIName = theNames.Find(anEntry);
630       mapEntries.Bind(anEntry, aName);
631       anUpdatedScript += "\n\t\tsmeshgui.SetName(salome.ObjectToID(";
632       anUpdatedScript += aName + "), \"" + aGUIName + "\")";
633     }
634   }
635   anUpdatedScript += "\n\n\t\tsalome.sg.updateObjBrowser(0)";
636
637   anUpdatedScript += "\n\n\tpass\n";
638
639   aValidScript = true;
640
641   return anUpdatedScript;
642 }
643
644 //=============================================================================
645 /*!
646  *  GetNewPythonLines
647  */
648 //=============================================================================
649 TCollection_AsciiString SMESH_Gen_i::GetNewPythonLines (int theStudyID)
650 {
651   TCollection_AsciiString aScript;
652
653   // Dump trace of API methods calls
654   if (myPythonScripts.find(theStudyID) != myPythonScripts.end()) {
655     Handle(TColStd_HSequenceOfAsciiString) aPythonScript = myPythonScripts[theStudyID];
656     Standard_Integer istr, aLen = aPythonScript->Length();
657     for (istr = 1; istr <= aLen; istr++) {
658       aScript += "\n\t";
659       aScript += aPythonScript->Value(istr);
660     }
661     aScript += "\n";
662   }
663
664   return aScript;
665 }
666
667 //=============================================================================
668 /*!
669  *  CleanPythonTrace
670  */
671 //=============================================================================
672 void SMESH_Gen_i::CleanPythonTrace (int theStudyID)
673 {
674   TCollection_AsciiString aScript;
675
676   // Clean trace of API methods calls
677   if (myPythonScripts.find(theStudyID) != myPythonScripts.end()) {
678     myPythonScripts[theStudyID]->Clear();
679   }
680 }