This is probably an easy question for most of you. I use Slic3r and usually have pretty good luck with it and am used to it. I would like to know an easy way to identify what gcode corresponds to a specific layer in the print. For example if my model has 100 layers I would like to be able to insert a pause code at say layer 50 to change filament.
I am sorry if this has been asked and answered. I tried searching it in the forum but I couldn't find the answer.
How do I identify a layer in Gcode
-
- Printmaster!
- Posts: 695
- Joined: Fri Nov 07, 2014 9:38 am
Re: How do I identify a layer in Gcode
Well it depends on the slicer that you use I'm sure. I use MatterSlice and I see lines like this in the gcode:
; LAYER:5
G0 F12000 X-31.95 Y60.98 Z1.20
so that makes it super easy but really you would look for anything with a Z coordinate. For the line I posted, the Z was 1.20. I was printing with a 0.2 layer height, so the formula would be ((z coordinate - starting layer height) / layer height) = current layer.
Since my starting layer height is no different than my regular layer height, my math would work out to be (1.2 - 0.2) / 0.2 = 5th layer.
; LAYER:5
G0 F12000 X-31.95 Y60.98 Z1.20
so that makes it super easy but really you would look for anything with a Z coordinate. For the line I posted, the Z was 1.20. I was printing with a 0.2 layer height, so the formula would be ((z coordinate - starting layer height) / layer height) = current layer.
Since my starting layer height is no different than my regular layer height, my math would work out to be (1.2 - 0.2) / 0.2 = 5th layer.
nitewatchman wrote:it was much cleaner and easier than killing a chicken on top of the printer.
Re: How do I identify a layer in Gcode
That's what I figured. I was looking for an easier way to identify it directly in the code.
Thanks for your reply
Thanks for your reply