Multi Tool - Tool Change - Lower bed by 5mm relative to current z posi



  • I am trying to find a way to lower the bed by an additional 5mm on each tool change so that the nozzle of the next tool is not dragged across the last layer.

    So lets say I am at Z4.0, The next tool need to move into position to start the next part of the same layer. I want the bed to drop by 5mm, the tool to move to the correct location, the bed to raise back 5mm and the print to continue.

    Currently I have no way of doing this. If in my tool change script (S3D) I put G1 Z5 F180 that is absolute. I cant put a G91 before it as I need the tool to move to the correct position defined in the G1 xxxxxx of the gcode which is not part of the tool change script so i cant issue a reversal of the 5mm (G1 Z-5 F180) then G90 to make absolute again.

    Is there a G1 Znnn that i can issue (or similar) that will lower the bed relative to the current Z position and not absolute?

    If not i am happy to move my tool change away from S3D and into RepRapFirmware as per https://forum.e3d-online.com/index.php?threads/dual-purge-prime-duetwifi.2503/#post-28253 if what i am looking for is possible that way? Just looking for any solution not to drag a nozzel over the last print layer of identical hight which in some cases has expanded so makes a nice crunch noise.



  • The easiest way would be to make use of the tool change macros. There are tfree, tpre and tpost and you can put pretty well any commands you like in them, including G1 Znnn.



  • So how would I achieve this then. I need to move Z by nnn relative to the current Z hight. If i put a G1 Z5 for example in S3D tool change script OR macro, it will move to G1 Z5 every tool change absolute not relative to the position of Z that it was at the end of the tool change.



  • Like I said, use the Duet tool change macros. So you'd have something like this:

    G91 ; Set relative positioning
    G1 Z4 Fnnn ; Lift Z 4mm (or drop the bed relative to the nozzle) - f is the feedrate
    G90 ; back to absolute positioning.

    I don't know if S3D will recognise G91 which is why I recommended using the duet tool change macros. S3D might recognise G91/G90 - try it and see.



  • Thanks for your help so far!

    But if i put a G90 at then end of the macro for absolute positioning, when the next part of the layer prints will it not be 4mm too high as we have now stated that the previous position is now 4mm lower (nozzle higher)?



  • I may have found something:

    "RepRapFirmware provides an additional 'R1' parameter to tell the machine to go back to the coordinates a print was previously paused at. If this parameter is used and the code contains axis letters, an offset will be added to the pause coordinates (e.g. G1 R1 Z5)."

    That looks like what i want to do. Just need to figure out what constitutes as a pause.



  • @andyvirus:

    Thanks for your help so far!

    But if i put a G90 at then end of the macro for absolute positioning, when the next part of the layer prints will it not be 4mm too high as we have now stated that the previous position is now 4mm lower (nozzle higher)?

    Yes, I was thinking along the lines that you would of course run two macros. The first would lift the nozzle, the second would drop it back down again. The code would be exactly the same except that you would have Z-4 (minus 4) in the second macro. You could put the whole thing in a single macro. i.e. lift the nozzle, do what you need to do, then drop the nozzle back to where it was. In which case, depending on what happens between the two sets of commands, you could set to relative mode at the beginning then only put it back to absolute at the end.

    Edit. If you use pause, you'll not likely be able to move the head while the machine is paused.



  • Thanks for your help.

    I just cant see how you run a command or a macro after a print has started for that layer. I know how as tool changes or even in scripts. i just don't know how you do it for constantly changing locations during a print not prior to it.

    Im just not getting it or im not explaining what i need.

    Thanks again


  • administrators

    There is partially-implemented code in firmware 1.18 to automatically set a restore position at the start of a tool change and then go to it when you execute G1 R2. So you could do G91/G1 Z4 in your tfree#.g and/or tpre#.g file, then use G1 R2 Z4/G1 R2 at the end of tpost#.g. However, this won't work on an IDEX machine because X axis mapping is not yet implemented in the save/restore position mechanism.



  • ok, thanks dc42.

    Its not that i want to return to the same point, I have no idea what the next point will be for the next tool (with out looking at the gcode). The next position for Tool 1 or 2 is determined by the object being printed.

    Short of editing the GCODE, finding where the start of each layer/tool is, finding the first absolut position and just before that adding G1 Z{what ever the next line Z position is + 5mm} i do not know what else i can do. I will have to just allow the nozel to drag o the last layer i guess as either i am too dense to understand the options, i cant explain myself or its not possible. All things i cant fix. Apologies if i that comes across badly, im just pulling my hair out trying to think of a way to explain this issue.

    Its so simple in a single colour print as you put it in the start script to lower the bed 5mm, then the absolute position of the object GCODE is sent the X and Y is moved THEN the Z to 0.18 or what ever the first layer is. Done. I would like/need the same behaviour for every layer for every tool for any position that the objects GCODE file determines as the first G1 for that layer/tool layer.

    Thankyou for all your help, im going to find beer this has stressed me out so much for some reason…



  • I'm not sure now that understand what your problem is. Tool change macros run whenever a new tool is selected or an old one is finished with, regardless of where or when you are in the print. So when the Duet sees a "T" command in the gcode file, a macro (if it exists) gets executed.


  • administrators

    Hi Andy, i absolutely get what you are saying. You effectively need a command to execute a move precisely before the next line of gcode after all the tool change macros have completed. This is because even if the G1 R2 command worked to return to the point where the tool change was triggered, that might not be the start point for the next tool, so the hotend would be dragged across the print to the new tool start point.

    At this stage such functionality does not exist in the firmware. I use the slicer to do this as on the BigBox IDEX i have. I am in two minds as to whether to recommend adding it because of the complexity of looking ahead to future moves and changing behaviour based on that.



  • Hi T3P3Tony, thats exactly right. What do you do in the slicer currently to avoid this?



  • OK so I think Deckingman had it spot on. I was making an assumption on what G90 did which was incorrect. I thought issuing a G91 them moving z by 5mm then G90 would effectively make Z1.0 (if that is what Z was prior to the G91) Z6.0… dont ask me why, stress can be a blessing and a curse... today a curse.

    I think
    G91
    G1 Z5 F180
    G90

    in the tool change script or macro will do the job. I think the movements of X, Y and Z are not all at the same time, i think Z is done last so that works. If they do move all at the same time then i need to make the G1 Znnn value large enough to ensure it reaches the correct spot (race) before Z comes up to the nozzle....

    Is this how your doing it T3P3Tony?


  • administrators

    Andy - It was how I was doing it, but as I wrote earlier the issue is that the tool change scripts are executed and then the next movement command for the new tool, which inevitably is some distance away.

    What I ended up doing was used "Z hop" in the slicer (0.2mm worked fine for me) which raised the ehozzle by just enough to clear everything whenever there is a travel move, and also happens on a tool change.

    Edited to add that all movement in a G1 command is executed to synchronise over the move. If you want XY, then Z, use two G1 commands.


Log in to reply