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

    Array Max Length

    Scheduled Pinned Locked Moved Solved
    Gcode meta commands
    2
    4
    195
    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.
    • timothyzundefined
      timothyz
      last edited by

      Hi,
      I am trying to implement additional tool management capabilities for a CNC router and I am curious how long the new arrays can be? I am trying and I can't seem to declare an array that is longer than 10 or so values. Is this a limitation of the gcode parser max line length? Is there any way to multi-line this?

      Thanks,
      Tim

      OwenDundefined 1 Reply Last reply Reply Quote 0
      • OwenDundefined
        OwenD @timothyz
        last edited by

        @timothyz
        How are you trying to do it?
        I don't know the limit or how you're trying to use the array, but as an example

        global bigArray = vector(30,0)
        echo global.bigArray
        while iterations < #global.bigArray
        	set global.bigArray[iterations]=random(100)
        echo global.bigArray
        G4 S1
        echo max(global.bigArray)
        

        0B6CB77A-838B-42BE-B9F4-E03EF3DF7B57.jpeg

        timothyzundefined 1 Reply Last reply Reply Quote 0
        • timothyzundefined
          timothyz @OwenD
          last edited by

          @OwenD I didn't know you could declare an array that way! It won't work if I do it as one line, but this is perfect. I must have missed this in the documentation.

          Thanks again.
          I will make a new post once I have created something useful.

          OwenDundefined 1 Reply Last reply Reply Quote 0
          • OwenDundefined
            OwenD @timothyz
            last edited by

            @timothyz
            Ensure you have the latest binaries
            vector() is a recent addition

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