• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

Tool change offset execution order

Scheduled Pinned Locked Moved Solved
General Discussion
4
19
562
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    Piet
    last edited by Piet 18 Nov 2020, 12:20

    Hi everyone,

    I'm struggling implementing a mechanism i thought of. It uses two extruders one of which is fixed (T0) while the other one (T1) is able to move 15mm, 7.5mm above T0 to 7.5mm below T0. They both use an FSR so probing with both extruders is possible.
    ![0_1605702106518_Z and U axis.jpg](Uploading 100%)

    At the moment i got it to work like this. T0 probes the bed, T1 moves down 15mm and probes the bed. The offset is set with G10 by reading the current position. This is the bed.g script:
    M561 ; clear any bed transform

    M98 P"homexyu.g" ; home the x, y and u axis

    T0 P0 ; select tool 0
    G1 X51.3 Y75 ; move to first probe coordinates
    G91 ; relative positioning
    G30 K0 Z-9999 ; probe bed with tool 0 and set Z=0

    G90 ; absolute positioning
    T1 P0 ; select tool 1
    G1 X51.3 Y75 Z12.5 U-7.5 F2000; ; move the bed 7.5mm, and the U axis 15mm down
    G91 ; relative positioning
    G38.2 Z0 P1 ; probe bed with tool 1 and stay at Z=0
    M400
    G10 L1 P1 Z{move.axes[2].machinePosition} ; set Z-offset
    M500 P10 ; save offset
    M400
    G1 Z5 ; move the bed 5mm down
    G90 ; absolute positioning
    M400
    M117 "Z offset for tool 1 is set and saved"

    T0 ; select tool 0

    G30 P0 K0 X51.3 Y75 Z-9999 ; probe above leadscrew
    G30 P1 K0 X400 Y448.7 Z-9999 ; probe above leadscrew
    G30 P2 K0 X748.7 Y75 Z-9999 S3 ; probe above leadscrew and run compensation

    This all works correctly. If i change the tool the bed lowers or goes up depending on what tool i select.

    However the U axis needs to change too with a toolchange. I tried doing this with the toolchange scripts however it will always run the tool offsets after the toolchange scripts. This means that if i change the tool from T0 to T1 the bed should lower and then the extruder should lower however with the current setup it will lower the extruder before the bed because it runs the script before applying the offset. I havent figured out a way to do this correctly.

    The best option IMO is if both axis move simultaneously however any info is appreciated.

    Kind regards,
    Piet!![0_1605702196555_Z and U axis.png](Uploading 100%)

    1 Reply Last reply Reply Quote 0
    • undefined
      dc42 administrators
      last edited by 19 Nov 2020, 14:26

      The Z height will be restored automatically at the end of the tool change.

      Duet WiFi hardware designer and firmware engineer
      Please do not ask me for Duet support via PM or email, use the forum
      http://www.escher3d.com, https://miscsolutions.wordpress.com

      undefined 2 Replies Last reply 20 Nov 2020, 09:32 Reply Quote 1
      • undefined
        Piet
        last edited by 18 Nov 2020, 12:41

        @dc42 @Phaedrux Sorry for the tag but i figured you guys would be the best of help. I also tried to upload a schematic however it doesn't show.

        1 Reply Last reply Reply Quote 0
        • undefined
          Phaedrux Moderator
          last edited by 19 Nov 2020, 00:29

          Your photos didn't upload correctly. Would help to see what you're talking about.

          Z-Bot CoreXY Build | Thingiverse Profile

          undefined 1 Reply Last reply 19 Nov 2020, 08:11 Reply Quote 0
          • undefined
            Piet @Phaedrux
            last edited by 19 Nov 2020, 08:11

            @Phaedrux Z and U axis.jpg
            It works now.

            1 Reply Last reply Reply Quote 0
            • undefined
              dc42 administrators
              last edited by 19 Nov 2020, 13:04

              @Piet, can't you just lower the bed by a sufficient amount in the tpre1.g file?

              Duet WiFi hardware designer and firmware engineer
              Please do not ask me for Duet support via PM or email, use the forum
              http://www.escher3d.com, https://miscsolutions.wordpress.com

              undefined 1 Reply Last reply 19 Nov 2020, 13:15 Reply Quote 0
              • undefined
                Piet @dc42
                last edited by Piet 19 Nov 2020, 13:15

                @dc42 At the moment because I set the Z offset it will lower the bed automatically with a toolchange because of the G10. However it only applies the offset after the tool change scripts meaning if i send the U axis down it will run into the bed.

                If i lower the bed in the tpre1.g file how can i get it to the right height after the offset is applied.

                Say i use the following in my tpre1.g:

                G91
                G1 Z20 ;move bed 20mm down
                G1 U-15 ;move t1 15mm down
                G90

                Using this it will resume 20mm down after a toolchange correct?

                If I we're to add a G1 Z-20 to move it up again it would again run into the t1 because the offset is applied after the toolchange script if I'm correct.

                1 Reply Last reply Reply Quote 0
                • undefined
                  dc42 administrators
                  last edited by 19 Nov 2020, 14:26

                  The Z height will be restored automatically at the end of the tool change.

                  Duet WiFi hardware designer and firmware engineer
                  Please do not ask me for Duet support via PM or email, use the forum
                  http://www.escher3d.com, https://miscsolutions.wordpress.com

                  undefined 2 Replies Last reply 20 Nov 2020, 09:32 Reply Quote 1
                  • undefined
                    Piet @dc42
                    last edited by 20 Nov 2020, 09:32

                    @dc42 I wasn't aware of that. Thanks for the input, helped a ton!

                    1 Reply Last reply Reply Quote 0
                    • undefined
                      Piet @dc42
                      last edited by Piet 20 Nov 2020, 09:47

                      @dc42 I was wondering, is there a way to save the offset or read it out of a variable somewhere? So instead of lowering the bed say 20mm i could lower it to the right offset immediately. Might be a more elegant solution.

                      A bit relevant to this; i've seen people working with the meta gcode commands but couldn't really find any information on what variables there are and what they do. Is there somewhere i can find that information or do i need to go through the reprapfirmware code?

                      1 Reply Last reply Reply Quote 0
                      • undefined
                        jay_s_uk
                        last edited by 20 Nov 2020, 09:50

                        use the R value of G0/G1
                        https://duet3d.dozuki.com/Wiki/Gcode#Section_G0_G1_Move

                        Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                        undefined 1 Reply Last reply 20 Nov 2020, 09:59 Reply Quote 0
                        • undefined
                          Piet @jay_s_uk
                          last edited by 20 Nov 2020, 09:59

                          @jay_s_uk I'm not sure which question you are answering. If it is the last question i asked, could you eleborate?

                          If i save my position using G60 S0 and call it later using the G1 R0 it won't apply my offset correct? It needs to change the tool offset first before it has any effect. However I'm not sure if that is what you mean.

                          undefined 1 Reply Last reply 20 Nov 2020, 10:08 Reply Quote 0
                          • undefined
                            jay_s_uk @Piet
                            last edited by 20 Nov 2020, 10:08

                            @Piet you use G10 to set tool offsets
                            When you call a tool, the G10 offset gets applied to the recalled value.

                            Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                            undefined 1 Reply Last reply 20 Nov 2020, 10:10 Reply Quote 0
                            • undefined
                              jay_s_uk @jay_s_uk
                              last edited by 20 Nov 2020, 10:10

                              using https://duet3d.dozuki.com/Wiki/Gcode#Section_G10_Set_workplace_coordinate_offset_or_tool_offset
                              you set the offsets on a per tool basis.
                              e.g. tool one is G10 T0 X0 Y0 Z0
                              tool two might be G10 T1 X5 Y0 Z5
                              these get taken into account during a tool change.

                              I have mine set as a macro that gets called from config so they are applied but also easy for me to adapt

                              Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                              undefined 1 Reply Last reply 20 Nov 2020, 10:42 Reply Quote 0
                              • undefined
                                Piet @jay_s_uk
                                last edited by 20 Nov 2020, 10:42

                                @jay_s_uk Right! I got that working. I'm already using that in the script i posted. I thought you were replying to my question to DC42 how i could lower it to the right offset immediately. Thanks anyways.

                                undefined 1 Reply Last reply 20 Nov 2020, 10:46 Reply Quote 0
                                • undefined
                                  jay_s_uk @Piet
                                  last edited by jay_s_uk 20 Nov 2020, 10:46

                                  @Piet well you can lower it to that offset immediately by using G1 R2 Z0 you don't need to wait until the end of the script for it to be done automatically.

                                  edit: I did have G1 R0 Z0 but that is the wrong slot for a tool change

                                  Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                                  undefined 1 Reply Last reply 20 Nov 2020, 10:59 Reply Quote 0
                                  • undefined
                                    Piet @jay_s_uk
                                    last edited by 20 Nov 2020, 10:59

                                    @jay_s_uk So if i understand correctly you say i can use the tool offset with the R parameter in the G1 command.

                                    Does it get saved automatically to that variable? Is there anyway i can check what the variable currently is? I'm assuming i need to use relative positioning for this?

                                    1 Reply Last reply Reply Quote 0
                                    • undefined
                                      jay_s_uk
                                      last edited by 20 Nov 2020, 11:24

                                      the location of the nozzle gets automatically saved at the beginning of the tool change to R2. There is nothing stopping you recalling those locations earlier in the tool change than waiting till the end.
                                      On my tool change, I recover the locations from R2 in specific order as I've found that works better for me that waiting for the tool change to for it for me.
                                      You can check the variables using the object model under state.restorePoints

                                      Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                                      undefined 1 Reply Last reply 20 Nov 2020, 11:57 Reply Quote 1
                                      • undefined
                                        Piet @jay_s_uk
                                        last edited by 20 Nov 2020, 11:57

                                        @jay_s_uk Thank you, that was very helpful. Im assuming you meant G1 R2 Z0, that worked for me.

                                        1 Reply Last reply Reply Quote 1
                                        • undefined
                                          jay_s_uk
                                          last edited by 20 Nov 2020, 12:01

                                          Yep.
                                          I got the position wrong where it stores a tool change position.
                                          I will edit the above post

                                          Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                                          1 Reply Last reply Reply Quote 0
                                          5 out of 19
                                          • First post
                                            5/19
                                            Last post
                                          Unless otherwise noted, all forum content is licensed under CC-BY-SA