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

    DRO half function with a 1 line macro

    Scheduled Pinned Locked Moved
    CNC
    2
    3
    271
    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.
    • CthulhuLabsundefined
      CthulhuLabs
      last edited by CthulhuLabs

      So I recently got an edge finder for my CNC and wanted to replicate the half function found on many DROs I have worked with in the past to easily find the center of a part. After scratching my head for a bit and playing around I realized it could be done with one Meta Gcode line in a Macro file. Here is the X version of it:

      ; Half X
      G10 L2 P1 X{move.axes[0].workplaceOffsets[0] + (move.axes[0].userPosition / 2) }
      

      To use this I touch off on one side of the part and set that as zero for that axis. Next I go to the other side of the part and touch off. Then I run the above macro. This sets the new work offset half way between the old zero and the current position.

      For completeness here is the Y version:

      ; Half Y
      G10 L2 P1 Y{move.axes[1].workplaceOffsets[0] + (move.axes[1].userPosition / 2) }
      

      I figured I would share as this has proved to be super useful.

      dc42undefined 1 Reply Last reply Reply Quote 5
      • dc42undefined
        dc42 administrators @CthulhuLabs
        last edited by

        @cthulhulabs thanks for sharing!

        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

        CthulhuLabsundefined 1 Reply Last reply Reply Quote 1
        • CthulhuLabsundefined
          CthulhuLabs @dc42
          last edited by

          @dc42 You are welcome 🙂

          Honestly this might be a good addition to the actual DWC interface when in CNC mode. Just a thought.

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