Salome HOME
Make naming name works on bodies with additional prefixes (extrusion solid in the...
[modules/shaper.git] / src / SketchAPI / SketchAPI_Line.cpp
index d6be6744de7bd96ae6d6bbc202520c2f5949a114..2b868adb6f28e053f103cfd5afdf715f63c2f346 100644 (file)
@@ -9,6 +9,7 @@
 //--------------------------------------------------------------------------------------
 #include <GeomAPI_Pnt2d.h>
 //--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Selection.h>
 #include <ModelHighAPI_Tools.h>
 //--------------------------------------------------------------------------------------
@@ -127,3 +128,20 @@ void SketchAPI_Line::setEndPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint
 
 //--------------------------------------------------------------------------------------
 
+void SketchAPI_Line::dump(ModelHighAPI_Dumper& theDumper) const
+{
+  FeaturePtr aBase = feature();
+  const std::string& aSketchName = theDumper.parentName(aBase);
+
+  AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID());
+  if (anExternal->value()) {
+    // line is external
+    theDumper << aBase << " = " << aSketchName << ".addLine(" << anExternal << ")" << std::endl;
+  } else {
+    // segment given by its points
+    theDumper << aBase << " = " << aSketchName << ".addLine("
+              << startPoint() << ", " << endPoint() << ")" << std::endl;
+  }
+  // dump "auxiliary" flag if necessary
+  SketchAPI_SketchEntity::dump(theDumper);
+}