From 28bc54e5b71d752c9ce56358a1847a538641a11e Mon Sep 17 00:00:00 2001
From: tamasmeszaros <meszaros.q@gmail.com>
Date: Tue, 3 Jul 2018 17:05:09 +0200
Subject: [PATCH] =?UTF-8?q?Patch=20from=20Lubom=C3=ADr=20for=20CLI=20param?=
 =?UTF-8?q?eters?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 xs/src/libslic3r/Print.cpp       | 10 +++++--
 xs/src/libslic3r/PrintConfig.cpp | 46 ++++++++++++++++++++++++++++++++
 xs/src/libslic3r/PrintConfig.hpp | 12 +++++++++
 xs/src/libslic3r/PrintExport.hpp |  2 +-
 xs/src/slic3r/AppController.hpp  |  1 -
 5 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp
index e57a022ae..b4fb523eb 100644
--- a/xs/src/libslic3r/Print.cpp
+++ b/xs/src/libslic3r/Print.cpp
@@ -1253,8 +1253,14 @@ void Print::set_status(int percent, const std::string &message)
 }
 
 void Print::print_to_png(std::string dirpath) {
-    print_to<FilePrinterFormat::PNG>(*this, dirpath, 68.0, 120.0, 1440, 2560,
-                                     8.0, 35.0);
+    print_to<FilePrinterFormat::PNG>(*this,
+        dirpath,
+        float(this->config.bed_size_x.value),
+        float(this->config.bed_size_y.value),
+        int(this->config.pixel_width.value),
+        int(this->config.pixel_height.value),
+        float(this->config.exp_time.value),
+        float(this->config.exp_time_first.value));
 }
 
 }
diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp
index b77a3a76e..a04965a27 100644
--- a/xs/src/libslic3r/PrintConfig.cpp
+++ b/xs/src/libslic3r/PrintConfig.cpp
@@ -1877,6 +1877,52 @@ PrintConfigDef::PrintConfigDef()
     def->sidetext = L("mm");
     def->cli = "z-offset=f";
     def->default_value = new ConfigOptionFloat(0);
+
+    def = this->add("bed_size_x", coFloat);
+    def->label = L("Bed size X");
+    def->category = L("Dwarf");
+    def->sidetext = L("mm");
+    def->cli = "bed-size-x=f";
+    def->default_value = new ConfigOptionFloat(68.);
+
+    def = this->add("bed_size_y", coFloat);
+    def->label = L("Bed size Y");
+    def->category = L("Dwarf");
+    def->sidetext = L("mm");
+    def->cli = "bed-size-y=f";
+    def->default_value = new ConfigOptionFloat(120.);
+
+    def = this->add("pixel_width", coInt);
+    def->label = L("Picture resolution X");
+    def->category = L("Dwarf");
+    def->sidetext = L("px");
+    def->cli = "pixel-width=i";
+    def->min = 1;
+    def->default_value = new ConfigOptionInt(1440);
+
+    def = this->add("pixel_height", coInt);
+    def->label = L("Picture resolution Y");
+    def->category = L("Dwarf");
+    def->sidetext = L("px");
+    def->cli = "pixel-height=i";
+    def->min = 1;
+    def->default_value = new ConfigOptionInt(2560);
+
+    def = this->add("exp_time", coFloat);
+    def->label = L("Exposure time");
+    def->category = L("Dwarf");
+    def->sidetext = L("s");
+    def->cli = "exp-time=f";
+    def->min = 1;
+    def->default_value = new ConfigOptionFloat(8.);
+
+    def = this->add("exp_time_first", coFloat);
+    def->label = L("Exposure time first layers");
+    def->category = L("Dwarf");
+    def->sidetext = L("s");
+    def->cli = "exp-time-first=f";
+    def->min = 1;
+    def->default_value = new ConfigOptionFloat(35.);
 }
 
 void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &value)
diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp
index 2e36ca665..f5d9bda9a 100644
--- a/xs/src/libslic3r/PrintConfig.hpp
+++ b/xs/src/libslic3r/PrintConfig.hpp
@@ -637,6 +637,12 @@ public:
     ConfigOptionFloats              wiping_volumes_matrix;
     ConfigOptionFloats              wiping_volumes_extruders;
     ConfigOptionFloat               z_offset;
+    ConfigOptionFloat               bed_size_x;
+    ConfigOptionFloat               bed_size_y;
+    ConfigOptionInt                 pixel_width;
+    ConfigOptionInt                 pixel_height;
+    ConfigOptionFloat               exp_time;
+    ConfigOptionFloat               exp_time_first;
     
 protected:
     PrintConfig(int) : GCodeConfig(1) {}
@@ -706,6 +712,12 @@ protected:
         OPT_PTR(wiping_volumes_matrix);
         OPT_PTR(wiping_volumes_extruders);
         OPT_PTR(z_offset);
+        OPT_PTR(bed_size_x);
+        OPT_PTR(bed_size_y);
+        OPT_PTR(pixel_width);
+        OPT_PTR(pixel_height);
+        OPT_PTR(exp_time);
+        OPT_PTR(exp_time_first);
     }
 };
 
diff --git a/xs/src/libslic3r/PrintExport.hpp b/xs/src/libslic3r/PrintExport.hpp
index e320373b5..0bc471e2d 100644
--- a/xs/src/libslic3r/PrintExport.hpp
+++ b/xs/src/libslic3r/PrintExport.hpp
@@ -125,7 +125,7 @@ template<> class FilePrinter<FilePrinterFormat::PNG> {
         "startdelay = 0\n"
         "layerHeight = " + layerh_str + "\n"
         "noteInfo = "
-        "expTime="+expt_str+"+resinType=FTD-IB-Black+layerHeight="
+        "expTime="+expt_str+"+resinType=generic+layerHeight="
                   +layerh_str+"+printer=DWARF3\n";
     }
 
diff --git a/xs/src/slic3r/AppController.hpp b/xs/src/slic3r/AppController.hpp
index 6af68eafa..4e50afd8e 100644
--- a/xs/src/slic3r/AppController.hpp
+++ b/xs/src/slic3r/AppController.hpp
@@ -261,7 +261,6 @@ public:
      */
     void set_print(Print *print) {
         printctl = PrintController::create(print);
-//        printctl->progress_indicator(progress_indicator());
     }
 
     /**