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

    Saving and Using Machine Coordinates in a Macro

    Scheduled Pinned Locked Moved Solved
    Gcode meta commands
    3
    10
    542
    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.
    • kiyer5undefined
      kiyer5
      last edited by

      I am trying to put together a tool calibration macro where the user can see a live feed looking up at the tool while they baby step the tool until it is lined up with a specific point on the screen. The calibration itself works, the issue I’m having is I want my macro to automatically update the G10 tool offset in my config.g file.
      Right now, the coordinates are displayed, and the user is instructed on where to manually update the config file, which opens room for human error with typing in offsets. I was wondering if anyone knows a way to save current machine X and Y coordinates as separate variables for future use. I’ve experimented with using object model variables, but I haven’t had any luck. If anyone knows how to work with those or has another idea for getting machine coordinates from the macro to the config file, I’d love to hear it. Thank you!

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

        @kiyer5 you can read the current coordinates from the object model.

        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

        kiyer5undefined 1 Reply Last reply Reply Quote 0
        • kiyer5undefined
          kiyer5 @dc42
          last edited by

          @dc42 I'm pretty new to G-Code I didn't realize you could do that, thank you. Would I be able to save those coordinates as a variable that I could export from my macro to the G10 call in my config file?

          cosmowaveundefined dc42undefined 2 Replies Last reply Reply Quote 0
          • cosmowaveundefined
            cosmowave @kiyer5
            last edited by

            @kiyer5 The current (x) position in OM is: move.axes[0].userPosition
            But i don't know how to save it in your config.g...

            Mankati FSXT+, DeltaTowerV2, E3D MS/TC

            kiyer5undefined 1 Reply Last reply Reply Quote 0
            • kiyer5undefined
              kiyer5 @cosmowave
              last edited by

              @cosmowave That's still a big help thank you. I'm assuming that Y and Z coordinates are move.axes[1] and move.axes[2] respectively then? I was hoping to save these coordinates as variables in my macro and then assign them to blank object slots. And then in my config I think there is a way to have parameters in the G10 line that would access the object that I set the coordinates to in the macro. Still not sure if that is possible though.

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

                @kiyer5 said in Saving and Using Machine Coordinates in a Macro:

                @dc42 I'm pretty new to G-Code I didn't realize you could do that, thank you. Would I be able to save those coordinates as a variable that I could export from my macro to the G10 call in my config file?

                The object model and the use of variables in GCode is specific to RepRapFirmware. See https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands.

                You could use values from the object model to update the current G10 coordinates, then use M500 P10 to save various parameters including the G10 tool offsets to config-override.g.

                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

                kiyer5undefined 1 Reply Last reply Reply Quote 0
                • cosmowaveundefined
                  cosmowave @kiyer5
                  last edited by

                  @kiyer5 yes. the y and z axes are [1] and [2] respectively.

                  Mankati FSXT+, DeltaTowerV2, E3D MS/TC

                  1 Reply Last reply Reply Quote 0
                  • kiyer5undefined
                    kiyer5 @dc42
                    last edited by

                    @dc42 Ok that makes sense. And then have an M501 in my config file. More curious than anything at this point, is there a command to update or reassign object model instances? Like can I store a value to a specific object?

                    cosmowaveundefined 1 Reply Last reply Reply Quote 0
                    • cosmowaveundefined
                      cosmowave @kiyer5
                      last edited by

                      @kiyer5 No, you can only read from the object model.
                      Eventually in the future it will be possible.

                      Mankati FSXT+, DeltaTowerV2, E3D MS/TC

                      1 Reply Last reply Reply Quote 0
                      • kiyer5undefined
                        kiyer5
                        last edited by

                        Hey guys just a quick update I followed your suggestions and my macro is working as intended. Thank you for your input, it's much appreciated!

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