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

    random number

    Scheduled Pinned Locked Moved
    Gcode meta commands
    5
    7
    451
    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.
    • appjawsundefined
      appjaws
      last edited by

      Is rnd implemented?
      If so what would be the correct syntax to generate a random X move between X30 to X100?

      appjaws - Core XYUV Duet Ethernet Duex5
      firmware 3.5.0-rc.4 Web Interface 3.5.0-rc.4
      Ormerod 1-converted to laser engraver, Duet wifi
      OpenSCAD version 2024.03.18
      Simplify3D 5.1.2

      1 Reply Last reply Reply Quote 0
      • Phaedruxundefined
        Phaedrux Moderator
        last edited by Phaedrux

        Yes it is, but I don't think it's been updated in the meta command documentation

        https://forum.duet3d.com/topic/17954/random-number-generation-with-meta-commands?_=1614626263724

        It's now been added to the functions list.

        https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands#Section_Functions

        Z-Bot CoreXY Build | Thingiverse Profile

        sinned6915undefined 1 Reply Last reply Reply Quote 0
        • appjawsundefined
          appjaws
          last edited by

          Thanks, I'm trying to move X to a random place between X30 and X130.
          I'm really not sure of the correct syntax, have tried
          G1 X30+random(100) Y228 F3000
          but all that happened was a move to X30
          Any ideas on how to achieve this?

          appjaws - Core XYUV Duet Ethernet Duex5
          firmware 3.5.0-rc.4 Web Interface 3.5.0-rc.4
          Ormerod 1-converted to laser engraver, Duet wifi
          OpenSCAD version 2024.03.18
          Simplify3D 5.1.2

          1 Reply Last reply Reply Quote 0
          • tekkydaveundefined
            tekkydave
            last edited by tekkydave

            Try:

            G1 X{random(101) + 30} F3600
            

            or for your exact example above use:

            G1 X{30+random(100)} Y228 F3000
            

            that will actually move to X between 30 & 129 actually - if you need 30 to 130 put 101 as the parameter to random().

            ~ tekkydave ~
            D-Bot: 300x300mm | Duet WiFi + Duex2 | 3 independent z motors | X,Y & Z linear rails | E3D Titan Aero + V6 | Precision Piezo z-probe
            FreeCAD, PrusaSlicer

            1 Reply Last reply Reply Quote 1
            • appjawsundefined
              appjaws
              last edited by

              thank you so much

              appjaws - Core XYUV Duet Ethernet Duex5
              firmware 3.5.0-rc.4 Web Interface 3.5.0-rc.4
              Ormerod 1-converted to laser engraver, Duet wifi
              OpenSCAD version 2024.03.18
              Simplify3D 5.1.2

              1 Reply Last reply Reply Quote 0
              • sinned6915undefined
                sinned6915 @Phaedrux
                last edited by

                @phaedrux What version RRF does this apply to?

                I am on 3.1.1 and I get 'unknown function' errors when I try to use it or any of the above suggestions.

                I have tried checking the Changelog file and the only thing I see referenced are the new gcode meta functions for version 3.1.0 and the redirect to the 'GCode_Meta_Commands' page where all this is listed.

                jay_s_ukundefined 1 Reply Last reply Reply Quote 0
                • jay_s_ukundefined
                  jay_s_uk @sinned6915
                  last edited by

                  @sinned6915 3.2 I believe

                  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 1
                  • First post
                    Last post
                  Unless otherwise noted, all forum content is licensed under CC-BY-SA