Salome HOME
Avoid crash while placing the presentation of constraint attached to the closed curve...
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Dumper.cpp
index 1e676ade40220e093d7799c3c3cc75d0e8c0866c..7956062dde22d6a48501f3f005e8fc43cb29412e 100644 (file)
@@ -417,7 +417,8 @@ static int possibleSelectionsByPoint(const GeomPointPtr& thePoint,
           }
         }
       }
-      // passed till the appropriate shape, check the center of circle or a focus of ellipse is selected
+      // passed till the appropriate shape, check the center of circle
+      // or a focus of ellipse is selected
       if (isContinue && !aCenters.empty())
         aNbPossibleSelections = aCenters.front().second;
     }
@@ -686,7 +687,6 @@ bool ModelHighAPI_Dumper::process(const std::shared_ptr<ModelAPI_Document>& theD
 
   // dump subfeatures and store result to file
   bool isOk = process(theDoc) && myDumpStorage->exportTo(theFileName, myModules);
-  clearCustomStorage();
   return isOk;
 }
 
@@ -1589,3 +1589,24 @@ ModelHighAPI_Dumper& operator<<(ModelHighAPI_Dumper& theDumper,
 
   return theDumper;
 }
+
+
+void ModelHighAPI_Dumper::exportVariables() const
+{
+  DocumentPtr aRoot = ModelAPI_Session::get()->moduleDocument();
+  EntityNameMap::const_iterator aNameIter = myNames.cbegin();
+  for(; aNameIter != myNames.end(); aNameIter++) {
+    FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aNameIter->first);
+    if (aFeature.get() && aFeature->document() != aRoot) {
+      FeaturePtr aPartFeat = ModelAPI_Tools::findPartFeature(aRoot, aFeature->document());
+      if (aPartFeat.get()) {
+        int aFeatureId = aFeature->data()->featureId();
+        int aPartId = aPartFeat->data()->featureId();
+        std::ostringstream anEntryStr;
+        anEntryStr<<aPartId<<":"<<aFeatureId;
+        std::string anEntry = anEntryStr.str();
+        exportVariable(anEntry, aNameIter->second.myCurrentName);
+      }
+    }
+  }
+}