Hello there!
I'm transforming a Graber i3 gtmax 3D (using Marlin, Repetier, Slic3r) into a chocolate printer. I'm working now on the layer changing, which is a critical point for the chocolate, because the previous layer have to be solid before receiving another layer over it, and the chocolate needs more time than plastic to get solid.
Then I wrote a customized code in Slic3r, which is placed between the end of one layer and the beggining of the next. The instructions take the extruder out of the prototype print area and wait for the chocolate solidification for a minute. The extruder needs to leave the print area, otherwise the continuous chocolate flow may mess up the piece. The problem is that I always send the extruder back to X axis home, independently of its final position on the layer, and the movement of the extruder makes a frustrating straight line through my prototype.
I thing the solution is detect the best way for taking the extruder away of the piece (home X axis, Home Y axis, move X axis to the maximium position or move the Y axis to Its maximium), minimizing the damage on it.
To implement it, I need to define the central position of the piece, and then compare this point to the end of the layer point on G-Code. If the biggest distance between these positions is on the horizontal plan, then the extruder should move itself or to the X axis home (if its closer to this point), or to the X maximium (if its closer to this point). The same thing has to be done with the Y axis.
I have no idea of how do this on G-Code. Have you?