Hi @Greg Valliant.
I agreee that gcodeis not a programming language, however CURA is a g-code generator and has access to all this at the time it slices and generates the g-code. I was hinting at a macro in CURa not g-code.
On point 2. The Z move just prior to the G28 is in fact the layer change .... there is no further Z axix move till the end of the layer being started.
My issue is with the Z layer change move being performed within the previous block and before the inserted G28 which is ssupposed to be BEFORE the layer change so that the layer change Z move will restore the machine to the correct Z level.
The CURA option supposedly lets me put commands in either before or after a layer change. This is clearly not happening.
Recommended Posts
GregValiant 989
You have run into the problem that many have. Gcode is a machine movement language, not a programming language. You can use M114 to get the current location of all 4 axis (example response = X:95.52 Y:102.69 Z:1.40 E:489.90 Count X:7890 Y:8753 Z:566) but it would need to be parsed outside the Gcode to pull the E value out.
In your first code example, the G28 is at the end of layer 0. The Z move just prior could be a Z hop, but the next two moves are non-extrusion moves. You want the plug-in to notice that and put the G28 ahead of the non-extruding moves. That would fix your problem, but for the next person it may not be true that the moves are non-extruding.
From the G28 Home position, the next Gcode line (in your file) must be an extrusion line. You would need to pull out the XY position and return the head there before allowing that extrusion line to run. Right now, it is being told to extrude from Home to whatever the next defined position is in the Gcode. What it expects, is to be at the previous XY of 234.25, 18.25.
Some machines support G60 (save position) and G61 (return to saved position). You might be able to incorporate them into your code. Something like...
G60 S0
G28
G61 S0
The Marlin firmware in my machine doesn't support G60 or G61. I have no intention of fooling with it even though from time to time it would be useful.
Edited by GregValiantLink to post
Share on other sites