From 088b0dab90dcfa15253111175c7fface930e3f65 Mon Sep 17 00:00:00 2001
From: bubnikv <bubnikv@gmail.com>
Date: Mon, 26 Sep 2016 12:49:29 +0200
Subject: [PATCH] Bugfix: use Lift-z option for 2. extruder #3385 Thanks to
 https://github.com/platsch https://github.com/alexrj/Slic3r/pull/3392

---
 xs/src/libslic3r/GCodeWriter.cpp | 6 +++---
 xs/src/libslic3r/GCodeWriter.hpp | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/xs/src/libslic3r/GCodeWriter.cpp b/xs/src/libslic3r/GCodeWriter.cpp
index bb5221877..47c7038cc 100644
--- a/xs/src/libslic3r/GCodeWriter.cpp
+++ b/xs/src/libslic3r/GCodeWriter.cpp
@@ -500,10 +500,10 @@ GCodeWriter::lift()
     // check whether the above/below conditions are met
     double target_lift = 0;
     {
-        double above = this->config.retract_lift_above.get_at(0);
-        double below = this->config.retract_lift_below.get_at(0);
+        double above = this->config.retract_lift_above.get_at(this->_extruder->id);
+        double below = this->config.retract_lift_below.get_at(this->_extruder->id);
         if (this->_pos.z >= above && (below == 0 || this->_pos.z <= below))
-            target_lift = this->config.retract_lift.get_at(0);
+            target_lift = this->config.retract_lift.get_at(this->_extruder->id);
     }
     if (this->_lifted == 0 && target_lift > 0) {
         this->_lifted = target_lift;
diff --git a/xs/src/libslic3r/GCodeWriter.hpp b/xs/src/libslic3r/GCodeWriter.hpp
index 72d54215b..51dc0d6d6 100644
--- a/xs/src/libslic3r/GCodeWriter.hpp
+++ b/xs/src/libslic3r/GCodeWriter.hpp
@@ -10,7 +10,7 @@
 namespace Slic3r {
 
 class GCodeWriter {
-    public:
+public:
     GCodeConfig config;
     std::map<unsigned int,Extruder> extruders;
     bool multiple_extruders;
@@ -48,7 +48,7 @@ class GCodeWriter {
     std::string unlift();
     Pointf3 get_position() const;
     
-    private:
+private:
     std::string _extrusion_axis;
     Extruder* _extruder;
     unsigned int _last_acceleration;
@@ -60,6 +60,6 @@ class GCodeWriter {
     std::string _retract(double length, double restart_extra, const std::string &comment);
 };
 
-}
+} /* namespace Slic3r */
 
-#endif
+#endif /* slic3r_GCodeWriter_hpp_ */