Gcode for moving hotend to XY position to heat 2nd extruder?



  • As per: https://forum.duet3d.com/topic/10786/firmware-2-03rc5-1-24rc5-released/19

    This recent change has meant pure XY moves no longer work. All I want to do is have the hotend move (at the same Z height as print) to a distant XY position so it doesnt dribble a horrid blob of molten plastic directly on the printed piece while it switches from one filament to another.

    This used to be achievable easily with any of the dual filament scripts online but no longer works as of firmware 2.03.

    I'm using S3D as slicer and either an E3D Chimera or Cyclops (own both, the Cyclops is a complete pain to use) on a Rostock Max.



  • Answer to my own question:
    In your system files there are files called:

    tpre0.g
    tpre1.g

    These are actions to run before a tool change (before T0 or T1 respectivefully). Just edit these to include such things as:

    G91
    G1 Z10 X0 Y-130 F9000
    G90

    For whatever reason Duet doesnt have a shitfit about pure XY moves ("G1/G0: target position not reachable from current position") which it does if you put the very same lines in your slicer as a tool change script.

    EDIT:
    LOL, with any move (/anything) in Tpre0.g, it applies them when NOT printing too, which means when home'd you get.. guess what, "G0/G1: target position not reachable from current position" when you try select the tool. It also applies to retract settings etc, so just selecting tools now becomes super annoying.


  • administrators

    @kodachrome said in Gcode for moving hotend to XY position to heat 2nd extruder?:

    Answer to my own question:
    In your system files there are files called:

    tpre0.g
    tpre1.g

    These are actions to run before a tool change (before T0 or T1 respectivefully). Just edit these to include such things as:

    G91
    G1 Z10 X0 Y-130 F9000
    G90

    For whatever reason Duet doesnt have a shitfit about pure XY moves ("G1/G0: target position not reachable from current position") which it does if you put the very same lines in your slicer as a tool change script.

    EDIT:
    LOL, with any move (/anything) in Tpre0.g, it applies them when NOT printing too, which means when home'd you get.. guess what, "G0/G1: target position not reachable from current position" when you try select the tool. It also applies to retract settings etc, so just selecting tools now becomes super annoying.

    Please can you provide details on how to provoke that error message when using firmware 2.03 release or 2.04RC1.

    Please note, tool offsets are never applied during tpre#.g files. So the target position must be within the M208 limits you have set.



  • I posted a few times to the existing thread about that error here, you may have missed it:
    https://forum.duet3d.com/topic/10786/firmware-2-03rc5-1-24rc5-released/61

    On the "tool offsets", this is what is in my tpre0.g file:

    G91
    G1 Z3 X0 Y-130 F3000
    G90

    And tfree0.g:

    G1 E-0.5 F3600

    When I select the either toolhead in the interface it now runs these, when of course I only want them to be utilised during print. This may not be the correct method of approaching this problem:

    Rostock Max + S3D + E3D Chimera + need to cool down/heat up a toolhead away from print so it doesnt make a blob as it sits there. Usually this is achieve with a Toolchange script in S3D, none of which work any longer in the new Firmware for reasons in that other thread.

    What is the solution?



  • @dc42
    Any comment or suggestion on best practice for a presumably common setup (dual extruders, diff temps, switch from one to the other without pausing for temp change on the print, drooling filament everywhere?



  • @dc42 Any feedback?

    "Any comment or suggestion on best practice for a presumably common setup (dual extruders, diff temps, switch from one to the other without pausing for temp change on the print, drooling filament everywhere?"



  • I am not owning a multiple toolhead printer, but should you not be able to just move the contents of that toolchange script into tpreN.g/tpostN.g and then tell the Slicer that the way to choose a tool is Tn and duet will handle the rest?


  • administrators

    @Kodachrome said in Gcode for moving hotend to XY position to heat 2nd extruder?:

    @dc42 Any feedback?

    "Any comment or suggestion on best practice for a presumably common setup (dual extruders, diff temps, switch from one to the other without pausing for temp change on the print, drooling filament everywhere?"

    RepRapFirmware will only pause for heating or cooling on a tool change if you command it to, using M116 in the tpost file.



  • @oliof
    Well thats what Im doing (as posted, that is preN.g) and that's precisely what's not working, as it still wont do a XY move without an absolute Z position too and also putting things in tpre/tpost etc get triggered even when not printing (and therefore error out on a delta), such as selecting a toolhead in the dashboard view to set temps etc before printing.

    @dc42
    You still seem to be answering a different question. The tpost file content I posted have no problem pausing and heating. The goal/objective is I need to do the following:

    • Move to XY position on current Z level (or +offset)
    • Only do this when printing, not when selecting tool (which putting things in tpost, tpre etc do)
    • Pause and heat, which is doable in various manners and not the question, this works fine as is.
    • resume printing

    Please answer the actual objective statement. I am not asking how to implement a heat and pause. I dont think tpre/tpost are the solution as they are trigger even selecting tools in the dashboard view and even tries to do so when at Z-max, triggering another "invalid move requested" response (which it would be at Z-Max).

    As noted multiple times, this was working fine with scripting before the later firmwares which stop pure XY moves.



  • Anyway.. talking to myself here. @dc42

    Tried reusing the Pause.g file contents as the Toolchange script as its basically doing the same thing:

    M83 ; relative extruder moves
    G1 E-1 F3600 ; retract 2mm of filament
    G91 ; relative positioning
    G1 Z15 F1000 ; lift Z by 15mm
    G90 ; absolute positioning
    G1 X0 Y100 F6000 ; go to X=0 Y=0

    That works fine as a Pause.g file but again shits itself when put in as a Toolchange script.
    Instant "G1/G0: target position not reachable from current position" when print tries to start, Autocancels everything and resets all temps to 0.

    Why is this so difficult!?


  • administrators

    @Kodachrome said in Gcode for moving hotend to XY position to heat 2nd extruder?:

    All I want to do is have the hotend move (at the same Z height as print) to a distant XY position so it doesnt dribble a horrid blob of molten plastic directly on the printed piece while it switches from one filament to another.

    That's why I suggested using the tool change files. It's normal to use a separate tool for each material. Are you trying to use a single tool and switching filaments going into it?

    The message "G1/G0: target position not reachable from current position" means what it says. The most common cause is a combination of two things:

    1. You are using a segmented kinematics, e.g. rotary delta, polar, or SCARA; and

    2. You have managed to put the print head outside the limits defined by your kinematics or defined by M208. So the current position is "not reachable", and neither is the next position close by that is on the way to where you want to go.



  • @dc42
    Im using an E3D Chimera, which is 2 individual tools. But thats beside the point as the problem here is the implementation of the tool change files and incompatibility with a Delta based printer workflow.

    I already replied illustrating with the showstopper when trying to use the tool change files:

    • when (not during print) selecting tools to manually pre-heat (or load filament etc) it applies whats in the tool change files, which is super annoying if you put in Extrude/Retract steps as it just does them when stationary, at the wrong temps and messed things up.
    • it also tries to move of course if you have a move to XY command, again when you dont want it to do that, when selecting manually and this leads to (sensing the loop here?):
    • even more contradictory, if you have a move command in those files, and they get invoked when at home, it will still generate the error ""G1/G0: target position not reachable.." and then zero the temps you were trying to set!

    The tool change files are non-functional as a solution on a delta printer as it will always be outside the limit when in the Z-max part position (ie home, before a print).

    The elegant way of doing this was with Toolchange scripts in S3D, but for reasons that have not been answered, when starting Gcode with these scripts in it, it errors out Immediately as is if its trying to invoke the command from the home position, not actually when it needs to do so.

    As noted, a way of just suppressing/removing this safety feature would mitigate this.


Log in to reply