• Tags
  • Documentation
  • Order
  • Register
  • Login
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.
  • undefined
    KristianP
    last edited by 14 Apr 2023, 15:43

    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 .

    undefined 1 Reply Last reply 14 Apr 2023, 15:45 Reply Quote 0
    • undefined
      dc42 administrators @KristianP
      last edited by 14 Apr 2023, 15:45

      @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

      undefined 1 Reply Last reply 14 Apr 2023, 15:53 Reply Quote 0
      • undefined
        KristianP @dc42
        last edited by 14 Apr 2023, 15:53

        @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 .

        undefined 1 Reply Last reply 14 Apr 2023, 16:23 Reply Quote 0
        • undefined
          KristianP
          last edited by 14 Apr 2023, 16:19

          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
          • undefined
            gloomyandy @KristianP
            last edited by 14 Apr 2023, 16:23

            @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.

            undefined 1 Reply Last reply 29 Apr 2023, 22:10 Reply Quote 2
            • undefined
              KristianP @gloomyandy
              last edited by 29 Apr 2023, 22:10

              @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
              • undefined dc42 marked this topic as a question 30 Apr 2023, 06:02
              • undefined dc42 has marked this topic as solved 30 Apr 2023, 06:02
              • First post
                Last post
              Unless otherwise noted, all forum content is licensed under CC-BY-SA