After-layer-change gcode causing print to fail?
So, my printer automatically takes pictures for a time-lapse after layer change, which works well in vase mode but jumps all over the place doing normal prints. Easy fix, just stabilize the Y axis and it should work, right? Wrong. For some reason I can't seem to grasp, when I slice the file the end result is a file that is buried several layers underneath the build plate.
Heres the gcode:
{if spiral_vase == false} G1 E-1 F1800 G0 Z{layer_z + 1} G0 Y110 F1800 {endif} ;AFTER_LAYER_CHANGE ;LAYER:{layer_num + 1} Z:{layer_z} {if spiral_vase == false} G1 E1 F1800 G0 Z{layer_z - 1} {endif}
If any kind soul can tell me what the hell I'm doing wrong, I would be very grateful. I've also tried another version of this using G90/G91 to move relationally and it actually fails even worse? So I'm at something of a loss as to what to do.
RE: After-layer-change gcode causing print to fail?
Without seeing all your settings its going to be hard to tell. For example if looks like its behaving as absolute coordinates. So moves to z-1 rather than moves z down 1mm from the current position. If there's something elsewhere that's setting absolute for the first layer (quite possibly in your start up gcode) which then switches to relative positioning afterwards then its going to lower the start to -1 relative to home (z=0) and then start building up all the layers from that relative position.
This code is in the after layer change so that means its going off and doing code from elsewhere first. I don't know what that code is doing from just a snippet. This is why we ask people to attach zipped up 3mf project files saved from slicer (File>Save project as) . A PS 3mf contains all the settings as well as the model so we can slice and debug much easier. We can look at generated gcode etc too.
RE: After-layer-change gcode causing print to fail?
Woops! I did mean to attach that, my bad, here you go:
RE: After-layer-change gcode causing print to fail?
Can I ask why you are increasing and then lowering Z immediately afterwards in the first place ? What's the purpose of it. How is that stabilising the Y ?
Also you have 2 sets of instructions inside the same conditional so they are both always run.
Looking at the gcode output from the project its moving to the first layer at 0.25 (as configured) but then its moving up to 1.25, which your G0 Z{layer_z + 1} command is doing and then its going to Z -0.75, caused by your second G0 Z{layer_z - 1}. As layer_z is always 0.25 at this layer. Going to layer_z +1mm makes the height 1.25 but it doesn't make layer_z the new height, its still 0.25. Basically you have height changes that do nothing except to make the end position 1mm lower than where it was previously.
What exactly are you trying to achieve with this after layer gcode ? I get that you have some form of time lapse photography going on but how is it triggered ?