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

    Check tool existence

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    3
    3
    132
    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.
    • TCundefined
      TC
      last edited by

      Hi all,

      I want to test how many tools are configured in the start.g to set their temperatures.
      I tried:

      if tools[1].state != null
      ...

      but seams to be wrong. Any ideas?

      Thanks ahead!

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

        Try:

        if #tools > 1 && tools[1] != null

        The first condition tests whether the array is long enough so that tools[1] is within the bounds of the array, the second tests whether there is actually a tool in that position.

        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

        1 Reply Last reply Reply Quote 0
        • deckingmanundefined
          deckingman @TC
          last edited by

          @TC I want to do almost exactly the same thing but I haven't had time to look at conditional gcode. May I ask you to share your "script" once you get it working please? Thanks in advance.

          Ian
          https://somei3deas.wordpress.com/
          https://www.youtube.com/@deckingman

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