From 3571ed90c84ccd7e51abf0898867e47d56bee53e Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Thu, 19 Nov 2020 22:52:29 +0100
Subject: [PATCH] Export to Py: if no file arg is given, then plot

---
 Core/Export/SimulationToPython.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Core/Export/SimulationToPython.cpp b/Core/Export/SimulationToPython.cpp
index 430dae269b9..f91189d6730 100644
--- a/Core/Export/SimulationToPython.cpp
+++ b/Core/Export/SimulationToPython.cpp
@@ -435,9 +435,10 @@ std::string SimulationToPython::defineMain(SimulationToPython::EMainType mainTyp
         result = "if __name__ == '__main__': \n"
                  "    result = run_simulation()\n"
                  "    import sys\n"
-                 "    if len(sys.argv)<2:\n"
-                 "        exit(\"File name is required\")\n"
-                 "    ba.IntensityDataIOFactory.writeSimulationResult(result, sys.argv[1])\n";
+                 "    if len(sys.argv)>=2:\n"
+                 "        ba.IntensityDataIOFactory.writeSimulationResult(result, sys.argv[1])\n"
+                 "    else:\n"
+            "        ba.plot_simulation_result(result, cmap='jet', aspect='auto')\n";
     } else {
         throw std::runtime_error("SimulationToPython::defineMain() -> Error. Unknown main type.");
     }
-- 
GitLab