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

    RRF bracket notation in mathematical equation - syntax question

    Scheduled Pinned Locked Moved
    Gcode meta commands
    3
    6
    214
    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.
    • Wurkeundefined
      Wurke
      last edited by

      Id like to run a few calculations.

      for example (1 + 2) * 3 = 9 is not he same as 1+2*3 = 7 because of the bracket notation. But how do you implement this in RRF? Round brackets don't work and curly brackets don't work either. Is the only way to separate the sum in to multiple parts?

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

        @Wurke
        You do it pretty much exactly as you've written it.
        calc.png
        Screenshot 2023-01-12 at 21-57-54 (4.7%) 3Dprinter.png
        If you're trying to use it inside a parameter, you may need to use curly brackets {} around the entire equation

        M291 R{"The value is" ^ (1=2)*3} S1 T2

        You do have to be running RRF 3.1 or later

        Wurkeundefined 1 Reply Last reply Reply Quote 1
        • Wurkeundefined
          Wurke @OwenD
          last edited by

          @OwenD Thanks. I must have been getting errors from another section of code.

          OwenDundefined dc42undefined 2 Replies Last reply Reply Quote 0
          • OwenDundefined
            OwenD @Wurke
            last edited by

            @Wurke
            If you're doing your code in a text editor, make sure it uses Unix style line ends. LF only, not CRLF
            Otherwise the line numbers reported in errors will be out.

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

              @Wurke if you are running your machine in CNC mode then characters inside round brackets are normally treated as comments as per the NIST standard. You can get around this by enclosing the entire expression in { }, for example:

              echo {(1+2)*3}

              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
              • dc42undefined
                dc42 administrators @OwenD
                last edited by

                @OwenD said in RRF bracket notation in mathematical equation - syntax question:

                @Wurke
                If you're doing your code in a text editor, make sure it uses Unix style line ends. LF only, not CRLF
                Otherwise the line numbers reported in errors will be out.

                This will be fixed in RRF 3.5beta2.

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