Cura work-around
-
@jens55 I think you may be assuming that the "Extruder Start G-code" is what is used every time the tool is called. This is not the case. It is only called once at the beginning of the print file, just like normal start g-code, but it is specific to the extruder specified. So, if the extruder is not used, the code won't be in the file. If it is, it will be at the start.
This is my assumption but I'm fairly confident that's how it is.
I'm just trying to clear up all this confusion, because this should be pretty straight forward once we remove that first errant Tn command.
-
I have what appears to be a working solution. It does need to be tweaked still but the overall concept works. The user does not need to worry about anything special to modify the g code, the purge works properly with the tool warmed up and there is only a single un-neccessary tool move due to Cura's insistence of sending a T command as the very first line of code even before it sends out the Cura start.g code block.
Details as follows:
Duet start.g:
; This file is called before any print job file is started
T-1
if !move.axes[0].homed || !move.axes[1].homed|| !move.axes[2].homed ; If the printer hasn't been homed, home it
G28 ; home the printer before Cura has a chance to mess it up with loading a toolDuet tpost0.g:
; tpost0.g
; called after firmware thinks Tool 0 is selected
; Note: tool offsets are applied at this point!
; Note that commands preempted with G53 will NOT apply the tool offset.M116 P0 ; Wait for set temperatures to be reached
M302 P0 ; Prevent Cold Extrudes, just in case temp setpoints are at 0
G91 ; use relative extrusion
G1 E50 F300 ; purge
G4 T10 ; wait
G90 ; Ensure the machine is in absolute mode before issuing movements.G53 G1 X-3 Y339 F6000 ; Move to the pickup position with tool-0.
M98 P"/macros/tool_lock.g" ; Lock the toolG1 R2 Z0 ; Restore prior Z position before tool change was initiated.
; Note: tool tip position is automatically saved to slot 2 upon the start of a tool change.
; Restore Z first so we don't crash the tool on retraction.
G1 R0 Y0 ; Retract tool by restoring Y position next now accounting for new tool offset.
; Restoring Y next ensures the tool is fully removed from parking post.
G1 R0 X0 ; Restore X position now accounting for new tool offset.
M106 R2 ; restore print cooling fan speedNote that there are several tool changer commands in there that are specific to my setup. All tpost(n).g files are basically the same with only the tool changing and the tool position changing.
Cura post processing, search and replace search string:
T[0-9]\n
Regular expression check box checked
Note: this only works for tools T0 thru T9. If more tools are defined then you need to change this.Cura startg:
G10 P{initial_extruder_nr} S{material_print_temperature} R{material_print_temperature}
T-1
M190 S{material_bed_temperature} ;Start heating bed and wait to bed reach temp before proceeding
G1 Z15.0 F6000 ;Move the platform down 15mmNote: the T-1 deselects the initial tool that Cura insists on selecting
Cura tool start.g, same for all tools:
G10 P{extruder_nr} S{material_print_temperature} R{material_print_temperature}
T{extruder_nr};Note: the ";" at the end of the last line is critical!
What is happening is that all instances of T(n) (only those on their own line, not those as part of another command) are located and a G10 plus a T(n); command is added. Later on, in the post processing search and replace, the original T(n) command is deleted. The T(n); command only remains because of the semicolon so if that is missing no tools will ever get selected.I think that covers all points.
I hope somebody can make use of this ... it certainly caused me lots of grief to sort this out. -
@bot said in Cura work-around:
@jens55 I think you may be assuming that the "Extruder Start G-code" is what is used every time the tool is called. This is not the case. It is only called once at the beginning of the print file, just like normal start g-code, but it is specific to the extruder specified. So, if the extruder is not used, the code won't be in the file. If it is, it will be at the start.
Cura has a normal start.g block that is called whenever Cura runs. It also has the extruder start.g blocks and they seem to be called every time that particular exruder is called for.
This is my assumption but I'm fairly confident that's how it is.
NOt according to what I am seeing ... but then I have been wrong once or twice before
I'm just trying to clear up all this confusion, because this should be pretty straight forward once we remove that first errant Tn command.
The first errant command is removed in the Cura start.g block with the T-1 which deselects and unmounts the tool that was mounted in the errant T command that Cura insists on.
gain, I would like to thank you for all your help. I would have never got this working by myself! THANKS !
-
@jens55 Wow, I just checked and you're right. The extruder start gcode is called every time the tool is selected.
I understand now your desire to remove every Tn command, and proceed the way you have.
Sorry for adding some confusion, but I'm glad you've got it sorted. I think you'll be able to make a hands-off profile now!
Wow, cure really is messed up, too. For T0, the Tn command preceeds the extruder start gcode, but for T1, the Tn command proceeds it! WTF!
Cura needs to sort themselves out lol.
Hmm. I just checked the behaviour, and it appears that it is very particular. For your own tool selection commands, ensure you have a comment after it. Then, for the search and replace command, ensure you have the two invisible newline characters both before and after the search string. So confusing, but it's possible to get a working configuration.
-
Upate: in the tpost file the following section
G91 ; use relative extrusion
G1 E50 F300 ; purgeshould be changed to :
M83 ; use relative extrusion
G0 E10 F300 ; purge -
Another few changes:
Cura post processing, search and replace search string:
T[0-9]\n
Regular expression check box checked
Note: this only works for tools T0 thru T9. If more tools are defined then you need to change this.Edit : The replacement string box should be empty
I suspect that the T-1 commands are no longer needed but have not tested that