Plugin functionality

plugin logic

Since the plugin is finished, we will explain how it works. The plugin processes the cura generated g-code. The first thing it does, is read the line. If the line includes “LAYER”, a line containing “=====” is written, after which the layer line is written.

If the line contains a “X”, the value of x and e is read and stored in variables. If the x is lower than 0 or higher than 200, the bed moves 150mm, else the value of the bed position is reduced from the value of x, and the line with the new x value is written.

The sequence of moving the bed consists of first retracting the filament, switching to the second extruder (which controlls the external x-axis), moving 150mm while moving the internal x-axis to the other direction, switching back to the first extruder, and undoing the retraction. In order to reduce the amount of errors, the extruded values are zero’ed before retracting and moving, and restored at the end of the sequence (by using the earlier read value of e).

the limitation of this is that it is only possible to move to the left or right one step. If the x-coordinate increases more than 150 (because the model contains a long straight line), the generated code will not be correct.