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

    Tool change behavior

    Scheduled Pinned Locked Moved Solved
    CNC
    3
    6
    254
    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.
    • KristianPundefined
      KristianP
      last edited by

      Hello

      ive setup tool change on my cnc , and was wondering if when tool is called , it would check if machine is homed before running the intire macro . I tryed this in the tpre.g but it just homes evry time it called.

      if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
      G28

      any able to help , so there no needles homing done when operating the machine .

      dc42undefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @KristianP
        last edited by

        @KristianP did you indent the G28 command with respect to the if-command? If you do, it should work. I use a similar sequence in my bed.g file to home the printer if I try to run delta calibration without homing first.

        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

        KristianPundefined 1 Reply Last reply Reply Quote 0
        • KristianPundefined
          KristianP @dc42
          last edited by

          @dc42 It was copy paste from a forum thread i cant find again , and not sure what you mean with " indent the G28 command with respect to the if-command" or how to implement suggestion .

          gloomyandyundefined 1 Reply Last reply Reply Quote 0
          • KristianPundefined
            KristianP
            last edited by

            Got it working , only have this in tpre.g now , if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed g28 , and rest of macro in tpost.g seems to work flawless now 🙂

            1 Reply Last reply Reply Quote 0
            • gloomyandyundefined
              gloomyandy @KristianP
              last edited by

              @KristianP See the docs on GCode meta commands to get a better idea of what is going on. In this case "indent" means the amount of whitespace before the G28 command, this is usually provided in the form of either one or more tabs, or one or more spaces. Best to select one (tabs) or the other (spaces) and not mix them. So for example your code above should really look like this:

              if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
                  G28
              

              Which is basically saying if any of the axes are not homed then execute G28. In this case I have indented the G28 with 4 spaces. Take care when copy/pasting code from places like the forum as leading tabs/spaces can easily become lost.

              KristianPundefined 1 Reply Last reply Reply Quote 2
              • KristianPundefined
                KristianP @gloomyandy
                last edited by

                @gloomyandy thanks for the clearyfication , i will have a look at meta commands . think i have more need in that direction might aswell learn the basics if im able 🙂

                1 Reply Last reply Reply Quote 0
                • dc42undefined dc42 marked this topic as a question
                • dc42undefined dc42 has marked this topic as solved
                • First post
                  Last post
                Unless otherwise noted, all forum content is licensed under CC-BY-SA