Salome HOME
Get rid of compilation warnings. Part I.
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Tools.cpp
1 // Copyright (C) 2014-2020  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "ModelHighAPI_Tools.h"
21 #include <ModelHighAPI_FeatureStore.h>
22 //--------------------------------------------------------------------------------------
23 #include <GeomAPI_Dir.h>
24 #include <GeomAPI_Pnt.h>
25 #include <GeomAPI_Pnt2d.h>
26 //--------------------------------------------------------------------------------------
27 #include <GeomDataAPI_Dir.h>
28 #include <GeomDataAPI_Point.h>
29 #include <GeomDataAPI_Point2D.h>
30 #include <GeomDataAPI_Point2DArray.h>
31 //--------------------------------------------------------------------------------------
32 #include <ModelAPI_AttributeBoolean.h>
33 #include <ModelAPI_AttributeDocRef.h>
34 #include <ModelAPI_AttributeDouble.h>
35 #include <ModelAPI_AttributeDoubleArray.h>
36 #include <ModelAPI_AttributeIntArray.h>
37 #include <ModelAPI_AttributeInteger.h>
38 #include <ModelAPI_AttributeRefAttr.h>
39 #include <ModelAPI_AttributeRefAttrList.h>
40 #include <ModelAPI_AttributeReference.h>
41 #include <ModelAPI_AttributeRefList.h>
42 #include <ModelAPI_AttributeSelection.h>
43 #include <ModelAPI_AttributeSelectionList.h>
44 #include <ModelAPI_AttributeString.h>
45 #include <ModelAPI_AttributeStringArray.h>
46 #include <ModelAPI_AttributeDoubleArray.h>
47 #include <ModelAPI_Session.h>
48 #include <ModelAPI_Tools.h>
49 #include <ModelAPI_ResultPart.h>
50 #include <ModelAPI_Events.h>
51 //--------------------------------------------------------------------------------------
52 #include <Config_ModuleReader.h>
53 //--------------------------------------------------------------------------------------
54 #include "ModelHighAPI_Double.h"
55 #include "ModelHighAPI_Integer.h"
56 #include "ModelHighAPI_RefAttr.h"
57 #include "ModelHighAPI_Reference.h"
58 #include "ModelHighAPI_Selection.h"
59
60 #include <Events_InfoMessage.h>
61
62 // Have to be included before std headers
63 #include <Python.h>
64
65 #include <algorithm>
66 #include <iostream>
67
68 //--------------------------------------------------------------------------------------
69 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> & theValue,
70                    const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute)
71 {
72   theAttribute->setValue(theValue);
73 }
74
75 void fillAttribute(const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute,
76                    double theX, double theY)
77 {
78   theAttribute->setValue(theX, theY);
79 }
80
81 //--------------------------------------------------------------------------------------
82 void fillAttribute(const std::shared_ptr<GeomAPI_Dir> & theValue,
83                    const std::shared_ptr<GeomDataAPI_Dir> & theAttribute)
84 {
85   theAttribute->setValue(theValue);
86 }
87
88 //--------------------------------------------------------------------------------------
89 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt> & theValue,
90                    const std::shared_ptr<GeomDataAPI_Point> & theAttribute)
91 {
92   theAttribute->setValue(theValue);
93 }
94
95 //--------------------------------------------------------------------------------------
96 void fillAttribute(bool theValue,
97                    const std::shared_ptr<ModelAPI_AttributeBoolean> & theAttribute)
98 {
99   theAttribute->setValue(theValue);
100 }
101
102 //--------------------------------------------------------------------------------------
103 void fillAttribute(const ModelHighAPI_Double & theValue,
104                    const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute)
105 {
106   theValue.fillAttribute(theAttribute);
107 }
108 void fillAttribute(double theValue,
109                    const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute)
110 {
111   theAttribute->setValue(theValue);
112 }
113
114 //--------------------------------------------------------------------------------------
115 void fillAttribute(const ModelHighAPI_Integer & theValue,
116                    const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute)
117 {
118   theValue.fillAttribute(theAttribute);
119 }
120 void fillAttribute(int theValue,
121                    const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute)
122 {
123   theAttribute->setValue(theValue);
124 }
125
126 //--------------------------------------------------------------------------------------
127 void fillAttribute(const ModelHighAPI_RefAttr & theValue,
128                    const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute)
129 {
130   theValue.fillAttribute(theAttribute);
131 }
132
133 //--------------------------------------------------------------------------------------
134 void fillAttribute(const std::list<ModelHighAPI_RefAttr> & theValue,
135                    const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute)
136 {
137   theAttribute->clear();
138   for (auto it = theValue.begin(); it != theValue.end(); ++it)
139     it->appendToList(theAttribute);
140 }
141
142 //--------------------------------------------------------------------------------------
143 void fillAttribute(const ModelHighAPI_Reference & theValue,
144                    const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute)
145 {
146   theValue.fillAttribute(theAttribute);
147 }
148
149 //--------------------------------------------------------------------------------------
150 void fillAttribute(const std::list<ModelHighAPI_Reference> & theValue,
151                    const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute)
152 {
153   theAttribute->clear();
154   for (auto it = theValue.begin(); it != theValue.end(); ++it)
155     it->appendToList(theAttribute);
156 }
157
158 //--------------------------------------------------------------------------------------
159 void fillAttribute(const std::shared_ptr<ModelAPI_Object> & theValue,
160                    const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute)
161 {
162   theAttribute->setValue(theValue);
163 }
164
165 //--------------------------------------------------------------------------------------
166 void fillAttribute(const std::list<std::shared_ptr<ModelAPI_Object> > & theValue,
167                    const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute)
168 {
169   theAttribute->clear();
170   for (auto it = theValue.begin(); it != theValue.end(); ++it)
171     theAttribute->append(*it);
172 }
173
174 MODELHIGHAPI_EXPORT
175 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
176                    const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute)
177 {
178   theAttribute->clear();
179   for (auto it = theValue.begin(); it != theValue.end(); ++it) {
180     if (it->resultSubShapePair().first)
181       theAttribute->append(it->resultSubShapePair().first); // use only context
182   }
183 }
184
185 //--------------------------------------------------------------------------------------
186 void fillAttribute(const ModelHighAPI_Selection & theValue,
187                    const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute)
188 {
189   theValue.fillAttribute(theAttribute);
190 }
191
192 //--------------------------------------------------------------------------------------
193 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
194                    const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute)
195 {
196   theAttribute->clear();
197
198   if(!theValue.empty() && theAttribute->selectionType().empty()) {
199     const ModelHighAPI_Selection& aSelection = theValue.front();
200     GeomAPI_Shape::ShapeType aSelectionType = getShapeType(aSelection);
201     theAttribute->setSelectionType(strByShapeType(aSelectionType));
202   }
203
204   for (auto it = theValue.begin(); it != theValue.end(); ++it)
205     it->appendToList(theAttribute);
206 }
207
208 //--------------------------------------------------------------------------------------
209 void fillAttribute(const std::string & theValue,
210                    const std::shared_ptr<ModelAPI_AttributeString> & theAttribute)
211 {
212   theAttribute->setValue(theValue);
213 }
214
215 //--------------------------------------------------------------------------------------
216 void fillAttribute(const char * theValue,
217                    const std::shared_ptr<ModelAPI_AttributeString> & theAttribute)
218 {
219   theAttribute->setValue(theValue);
220 }
221
222 //--------------------------------------------------------------------------------------
223 void fillAttribute(const std::list<std::string> & theValue,
224                    const std::shared_ptr<ModelAPI_AttributeStringArray> & theAttribute)
225 {
226   theAttribute->setSize(int(theValue.size()));
227
228   int anIndex = 0;
229   for (auto it = theValue.begin(); it != theValue.end(); ++it, ++anIndex)
230     theAttribute->setValue(anIndex, *it);
231 }
232
233 //--------------------------------------------------------------------------------------
234 void fillAttribute(const std::list<ModelHighAPI_Integer> & theValue,
235                    const std::shared_ptr<ModelAPI_AttributeIntArray> & theAttribute)
236 {
237   theAttribute->setSize(int(theValue.size()));
238
239   int anIndex = 0;
240   for (auto it = theValue.begin(); it != theValue.end(); ++it, ++anIndex)
241     theAttribute->setValue(anIndex, it->intValue()); // use only values, no text support in array
242 }
243
244 //--------------------------------------------------------------------------------------
245 void fillAttribute(const std::list<ModelHighAPI_Double> & theValue,
246                    const std::shared_ptr<ModelAPI_AttributeDoubleArray> & theAttribute)
247 {
248   theAttribute->setSize(int(theValue.size()));
249
250   int anIndex = 0;
251   for (auto it = theValue.begin(); it != theValue.end(); ++it, ++anIndex)
252     theAttribute->setValue(anIndex, it->value()); // use only values, no text support in array
253 }
254
255 //--------------------------------------------------------------------------------------
256 void fillAttribute(const std::list<std::shared_ptr<GeomAPI_Pnt2d> > & theValue,
257                    const std::shared_ptr<GeomDataAPI_Point2DArray> & theAttribute)
258 {
259   theAttribute->setSize(int(theValue.size()));
260
261   int anIndex = 0;
262   for (auto it = theValue.begin(); it != theValue.end(); ++it, ++anIndex)
263     theAttribute->setPnt(anIndex, *it);
264 }
265
266 //--------------------------------------------------------------------------------------
267 void fillAttribute(const ModelHighAPI_Double & theX,
268                    const ModelHighAPI_Double & theY,
269                    const ModelHighAPI_Double & theZ,
270                    const std::shared_ptr<GeomDataAPI_Point> & theAttribute)
271 {
272   theX.fillAttribute(theAttribute, theX, theY, theZ);
273 }
274
275 //==================================================================================================
276 GeomAPI_Shape::ShapeType shapeTypeByStr(std::string theShapeTypeStr)
277 {
278   GeomAPI_Shape::ShapeType aShapeType = GeomAPI_Shape::SHAPE;
279
280   std::transform(theShapeTypeStr.begin(), theShapeTypeStr.end(),
281                  theShapeTypeStr.begin(), ::tolower);
282
283   if(theShapeTypeStr == "compound") {
284     aShapeType = GeomAPI_Shape::COMPOUND;
285   } else if(theShapeTypeStr == "compsolid") {
286     aShapeType = GeomAPI_Shape::COMPSOLID;
287   } else if(theShapeTypeStr == "solid") {
288     aShapeType = GeomAPI_Shape::SOLID;
289   } else if(theShapeTypeStr == "shell") {
290     aShapeType = GeomAPI_Shape::SHELL;
291   } else if(theShapeTypeStr == "face") {
292     aShapeType = GeomAPI_Shape::FACE;
293   } else if(theShapeTypeStr == "wire") {
294     aShapeType = GeomAPI_Shape::WIRE;
295   } else if(theShapeTypeStr == "edge") {
296     aShapeType = GeomAPI_Shape::EDGE;
297   } else if(theShapeTypeStr == "vertex") {
298     aShapeType = GeomAPI_Shape::VERTEX;
299   } else if(theShapeTypeStr == "shape") {
300     aShapeType = GeomAPI_Shape::SHAPE;
301   }
302
303   return aShapeType;
304 }
305
306 std::string strByShapeType(GeomAPI_Shape::ShapeType theShapeType)
307 {
308   std::string aShapeTypeStr;
309   switch (theShapeType) {
310   case GeomAPI_Shape::COMPOUND:
311     aShapeTypeStr = "COMPOUND";
312     break;
313   case GeomAPI_Shape::COMPSOLID:
314     aShapeTypeStr = "COMPSOLID";
315     break;
316   case GeomAPI_Shape::SOLID:
317     aShapeTypeStr = "SOLID";
318     break;
319   case GeomAPI_Shape::SHELL:
320     aShapeTypeStr = "SHELL";
321     break;
322   case GeomAPI_Shape::FACE:
323     aShapeTypeStr = "FACE";
324     break;
325   case GeomAPI_Shape::WIRE:
326     aShapeTypeStr = "WIRE";
327     break;
328   case GeomAPI_Shape::EDGE:
329     aShapeTypeStr = "EDGE";
330     break;
331   case GeomAPI_Shape::VERTEX:
332     aShapeTypeStr = "VERTEX";
333     break;
334   default:
335     aShapeTypeStr = "SHAPE";
336     break;
337   }
338   return aShapeTypeStr;
339 }
340
341 //==================================================================================================
342 GeomAPI_Shape::ShapeType getShapeType(const ModelHighAPI_Selection& theSelection)
343 {
344   GeomAPI_Shape::ShapeType aShapeType = GeomAPI_Shape::SHAPE;
345
346   switch(theSelection.variantType()) {
347     case ModelHighAPI_Selection::VT_ResultSubShapePair: {
348       ResultSubShapePair aPair = theSelection.resultSubShapePair();
349       GeomShapePtr aShape = aPair.second;
350       if(!aShape.get()) {
351         aShape = aPair.first->shape();
352       }
353       if(!aShape.get()) {
354         return aShapeType;
355       }
356       aShapeType = aShape->shapeType();
357       break;
358     }
359     case ModelHighAPI_Selection::VT_TypeSubShapeNamePair: {
360       TypeSubShapeNamePair aPair = theSelection.typeSubShapeNamePair();
361       std::string aType = aPair.first;
362       aShapeType = shapeTypeByStr(aType);
363       break;
364     }
365     case ModelHighAPI_Selection::VT_TypeInnerPointPair: {
366       TypeInnerPointPair aPair = theSelection.typeInnerPointPair();
367       std::string aType = aPair.first;
368       aType = aType.substr(0, aType.find_first_of('_'));
369       aShapeType = shapeTypeByStr(aType);
370       break;
371     }
372     case ModelHighAPI_Selection::VT_WeakNamingPair: {
373       TypeWeakNamingPair aPair = theSelection.typeWeakNamingPair();
374       std::string aType = aPair.first;
375       aShapeType = shapeTypeByStr(aType);
376       break;
377     }
378     default:
379       break; // do nothing [to avoid compilation warning]
380   }
381
382   return aShapeType;
383 }
384
385 //--------------------------------------------------------------------------------------
386 ModelAPI_AttributeTables::ValueType valueTypeByStr(const std::string& theValueTypeStr)
387 {
388   std::string aType = theValueTypeStr;
389   std::transform(aType.begin(), aType.end(), aType.begin(), ::tolower);
390   if (aType == "boolean")
391     return ModelAPI_AttributeTables::BOOLEAN;
392   else if (aType == "integer")
393     return ModelAPI_AttributeTables::INTEGER;
394   else if (aType == "string")
395     return ModelAPI_AttributeTables::STRING;
396   return ModelAPI_AttributeTables::DOUBLE; // default
397 }
398
399 //--------------------------------------------------------------------------------------
400 std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType)
401 {
402   switch(theType) {
403   case ModelAPI_AttributeTables::BOOLEAN: return "BOOLEAN";
404   case ModelAPI_AttributeTables::INTEGER: return "INTEGER";
405   case ModelAPI_AttributeTables::DOUBLE: return "DOUBLE";
406   case ModelAPI_AttributeTables::STRING: return "STRING";
407   }
408   return ""; // bad case
409 }
410
411 /// stores the features information, recursively stores sub-documents features
412 std::string storeFeatures(const std::string& theDocName, DocumentPtr theDoc,
413   std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> >& theStore,
414   const bool theCompare) // if false => store
415 {
416   std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> >::iterator aDocFind;
417   if (theCompare) {
418      aDocFind = theStore.find(theDocName);
419      if (aDocFind == theStore.end()) {
420        return "Document '" + theDocName + "' not found";
421      }
422   }
423   // store the model features information: iterate all features
424   size_t anObjectsCount = 0; // stores the number of compared features for this document to compare
425   std::set<std::string> aProcessed; // processed features names (that are in the current document)
426
427   // process all objects (features and folders)
428   std::list<ObjectPtr> allObjects = theDoc->allObjects();
429   std::list<ObjectPtr>::iterator allIter = allObjects.begin();
430   for(; allIter != allObjects.end(); allIter++) {
431     ObjectPtr anObject = *allIter;
432     FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
433     if (aFeature && aFeature->getKind() == "SketchConstraintCoincidenceInternal")
434       continue; // no need to dump and check internal constraints
435
436     if (theCompare) {
437       std::map<std::string, ModelHighAPI_FeatureStore>::iterator
438         anObjFind = aDocFind->second.find(anObject->data()->name());
439       if (anObjFind == aDocFind->second.end()) {
440         return "Document '" + theDocName + "' feature '" + anObject->data()->name() + "' not found";
441       }
442       std::string anError = anObjFind->second.compare(anObject);
443       if (!anError.empty()) {
444         anError = "Document " + theDocName + " " + anError;
445         return anError;
446       }
447       anObjectsCount++;
448       aProcessed.insert(anObject->data()->name());
449     } else {
450       theStore[theDocName][anObject->data()->name()] = ModelHighAPI_FeatureStore(anObject);
451     }
452
453     if (aFeature) {
454       // iterate all results of this feature
455       std::list<ResultPtr> allResults;
456       ModelAPI_Tools::allResults(aFeature, allResults);
457       std::list<ResultPtr>::iterator aRes = allResults.begin();
458       for(; aRes != allResults.end(); aRes++) {
459         // recursively store features of sub-documents
460         if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) {
461           DocumentPtr aDoc = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aRes)->partDoc();
462           if (aDoc.get()) {
463             std::string anError =
464                 storeFeatures((*aRes)->data()->name(), aDoc, theStore, theCompare);
465             if (!anError.empty())
466               return anError;
467           }
468         }
469       }
470     }
471   }
472   // checks the number of compared features
473   if (theCompare) {
474     if (aDocFind->second.size() != anObjectsCount) {
475       // search for disappeared feature
476       std::string aLostName;
477       std::map<std::string, ModelHighAPI_FeatureStore>::iterator aLostIter;
478       for(aLostIter = aDocFind->second.begin(); aLostIter != aDocFind->second.end(); aLostIter++) {
479         if (aProcessed.find(aLostIter->first) == aProcessed.end()) {
480           aLostName = aLostIter->first;
481         }
482       }
483       return "For document '" + theDocName +
484         "' the number of features is decreased, there is no feature '" + aLostName + "'";
485     }
486   }
487   return ""; // ok
488 }
489
490 //==================================================================================================
491 typedef std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> > Storage;
492
493 static bool dumpToPython(SessionPtr theSession,
494                          const std::string& theFilename,
495                          const checkDumpType theSelectionType,
496                          const std::string& theErrorMsgContext)
497 {
498   // 2431: set PartSet as a current document
499   theSession->setActiveDocument(theSession->moduleDocument(), true);
500   // dump all to the python file
501   theSession->startOperation("Check python dump");
502   FeaturePtr aDump = theSession->moduleDocument()->addFeature("Dump");
503   if (aDump.get()) {
504     aDump->string("file_path")->setValue(theFilename);
505     aDump->string("file_format")->setValue("py");
506     aDump->boolean("topological_naming")->setValue((theSelectionType & CHECK_NAMING) != 0);
507     aDump->boolean("geometric_selection")->setValue((theSelectionType & CHECK_GEOMETRICAL) != 0);
508     aDump->boolean("weak_naming")->setValue((theSelectionType & CHECK_WEAK) != 0);
509   }
510   bool isProblem = !aDump.get() || !aDump->error().empty(); // after "finish" dump will be removed
511   if (isProblem && aDump.get()) {
512     std::cout << "Dump feature error " << aDump->error() << std::endl;
513     Events_InfoMessage anErrorMsg(theErrorMsgContext, aDump->error());
514     anErrorMsg.send();
515   }
516   theSession->finishOperation();
517   return !isProblem;
518 }
519
520 static bool checkDump(SessionPtr theSession,
521                       const char* theFilename,
522                       Storage& theStorage,
523                       const std::string& theErrorMsgContext)
524 {
525
526   // close all before importation of the script
527   theSession->closeAll();
528
529   // execute the dumped
530   PyGILState_STATE gstate = PyGILState_Ensure(); /* acquire python thread */
531   static char aReadMode[] = "r";
532   FILE* PyFileObject = _Py_fopen(theFilename, aReadMode);
533   PyRun_SimpleFileEx(PyFileObject, theFilename, 1);
534   PyGILState_Release(gstate); /* release python thread */
535
536   // compare with the stored data
537   std::string anError = storeFeatures(
538     theSession->moduleDocument()->kind(), theSession->moduleDocument(), theStorage, true);
539   if (!anError.empty()) {
540     std::cout << anError << std::endl;
541     Events_InfoMessage anErrorMsg(theErrorMsgContext, anError);
542     anErrorMsg.send();
543     return false;
544   }
545
546   return true;
547 }
548
549 bool checkPyDump(const std::string& theFilenameNaming,
550                  const std::string& theFilenameGeo,
551                  const std::string& theFilenameWeak,
552                  const checkDumpType theCheckType)
553 {
554   static const std::string anErrorByNaming("checkPythonDump by naming");
555   static const std::string anErrorByGeometry("checkPythonDump by geometry");
556   static const std::string anErrorByWeak("checkPythonDump by weak naming");
557
558 #ifdef _DEBUG
559   std::string aFileForNamingDump("./check_dump.py");
560   std::string aFileForGeometryDump("./check_dump_geo.py");
561   std::string aFileForWeakDump("./check_dump_weak.py");
562 #else
563   std::string aFileForNamingDump = theFilenameNaming;
564   std::string aFileForGeometryDump = theFilenameGeo;
565   std::string aFileForWeakDump = theFilenameWeak;
566 #endif
567
568   SessionPtr aSession = ModelAPI_Session::get();
569   // dump with the specified types
570   std::string aFileName = theCheckType == CHECK_GEOMETRICAL ? aFileForGeometryDump :
571                           (theCheckType == CHECK_WEAK ? aFileForWeakDump : aFileForNamingDump);
572   if (!dumpToPython(aSession, aFileName, theCheckType, anErrorByNaming))
573     return false;
574
575    // map from document name to feature name to feature data
576   std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> > aStore;
577   std::string anError = storeFeatures(
578     aSession->moduleDocument()->kind(), aSession->moduleDocument(), aStore, false);
579   if (!anError.empty()) {
580     Events_InfoMessage anErrorMsg(std::string("checkPythonDump"), anError);
581     anErrorMsg.send();
582     return false;
583   }
584
585   bool isOk = true;
586   if (theCheckType & CHECK_NAMING) {
587     // check dump with the selection by names
588     isOk = checkDump(aSession, aFileForNamingDump.c_str(), aStore, anErrorByNaming);
589   }
590   if (theCheckType & CHECK_GEOMETRICAL) {
591     // check dump with the selection by geometry
592     isOk = isOk && checkDump(aSession, aFileForGeometryDump.c_str(), aStore, anErrorByGeometry);
593   }
594   if (theCheckType & CHECK_WEAK) {
595     isOk = isOk && checkDump(aSession, aFileForWeakDump.c_str(), aStore, anErrorByWeak);
596   }
597
598   return isOk;
599 }
600
601 //--------------------------------------------------------------------------------------