Wrong layer count



  • Hi

    I see wrong layer count in DWC - 99 instead of 100.
    Guess it's a zero index bug or is it the slicer doing it wrong?

    Using FW 3.1.1 on Duet2.

    f394c6bd-7f5a-4500-b4b6-c271b07ef3e8-image.png


  • administrators

    Are you using a different height for the first layer? It's an option in the slicer.



  • Nope, .2 all the way.

    Last layer is saying 100/99

    There is just one object and no support or anything else.


  • administrators

    Please provide the GCode file.



  • Snip showing 100/99:
    27fe29f8-b819-4c61-a172-66deafb2013f-image.png

    G-code:
    wrong_layer_count.txt



  • Seems to be my start code purge part:
    G1 X2 Y130.0 Z0.4 F800.0 E15 ; draw 1st line
    G1 X2.5 Y130.0 Z0.4 F5000.0 ; move to side a little
    G1 X2.5 Y50 Z0.4 F800.0 E20 ; draw 2nd line
    G1 X17 Y55 F5000.0 ; quick wipe

    As soon as it sees Z0.4 with a layer height of 0.2 it says layer 2/X

    Can I tell it to "reset" counting in the start script?
    I have not done test without purge part, to see if the total layer count is correct.



  • if you always do it in the same place, you could move your start gcode out from the slicer and put it in start.g
    Or try putting an "E" at the beginning of the comment where each Z move occurs


  • Moderator

    @hmortensen @jay_s_uk said in Wrong layer count:

    Or try putting an "E" at the beginning of the comment where each Z move occurs

    FYI putting an 'E' at the beginning of the comment causes the gcode parser to ignore the line and any movements in it, eg:

    G1 X2 Y130.0 Z0.4 F800.0 E15 ; E draw 1st line
    G1 X2.5 Y130.0 Z0.4 F5000.0 ; E move to side a little
    G1 X2.5 Y50 Z0.4 F800.0 E20 ; E draw 2nd line
    

    Ian



  • Tried with the E infront of the comments, but no change. Still jumps directly to layer 2 when doing the purge, and total layer count is still one too low.


  • administrators

    @droftarts The ; End comment work-around can be used only for the object height detection. The first layer height is determined by looking for the first absolute G0/G1 ... Z code in the G-code file. @hmortensen if you need to print a line before the first layer, put the corresponding section into start.g and remove it from your start G-code. Or move it to a macro file and invoke it using M98.



  • @chrishamm Thank you, that did fix both problems.
    Didn't work in first try, as when I created a macro file it had no extension and I tried calling it with '.g'.
    Is it possible to force it into error state instead of just yielding a warning if the macro doesn't exist?

    I went with the custom macro approach, as I guess the start.g macro would be called before the actual print file and then I would miss the option of setting temperature in the slicer.

    I made a new directory prefixed with a dot and it had the expected effect of hidding it from the dashboard 🙂


Log in to reply