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

    Best way to submit gcode from a program

    Scheduled Pinned Locked Moved
    Duet Web Control
    3
    4
    266
    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.
    • achrnundefined
      achrn
      last edited by

      If I want to submit gcode to a RRF printer from a program running on a PC elsewhere on the network, what is the best way to do that?

      That is, I'm generating gcode from a perl script and I want the script to immediately and automatically send the gcode to the printer and have the printer immediately run it. The printer is not running on a SBC (it is actually a sand table running on a fly e3 pro, but I think that's not terrifically relevant beyond that I can't run SBC mode, I think).

      I don't need to retain the generated gcode (on either the PC or the printer) though it's not a problem if it does remain and I clear out the gcodes directory manually periodically.

      Currently my perl generates the gcode into a file on disk (in this case called circles.g), then immediately e.g.:

      curl --data-binary @circles.g http://192.168.53.48/rr_upload?name=/gcodes/circles.g
      curl http://192.168.53.48/rr_gcode?gcode=M32/gcodes/circles.g
      curl http://192.168.53.48/rr_disconnect
      

      This works fine if I have recently connected a web browser to the DWC on the printer, but if I haven't, it doesn't work (for reasons I haven't worked out).

      1: Why does it not work if I haven't recently connected to the RRF printer?

      2: Is there a better way of doing this?

      chrishammundefined o_lampeundefined 2 Replies Last reply Reply Quote 0
      • chrishammundefined
        chrishamm administrators @achrn
        last edited by

        @achrn You may need to call rr_connect?password=XXX as well if you have a password set. If DWC is connected, your IP address is permitted to send upload/G-code requests already, so rr_connect is not needed then.

        Duet software engineer

        achrnundefined 1 Reply Last reply Reply Quote 0
        • o_lampeundefined
          o_lampe @achrn
          last edited by

          @achrn said in Best way to submit gcode from a program:

          2: Is there a better way of doing this?

          Without DWC you can send gcode line_by_line, I guess.

          1 Reply Last reply Reply Quote 0
          • achrnundefined
            achrn @chrishamm
            last edited by

            @chrishamm @o_lampe thanks both for the input, but it turns out it was actually user stupidity.

            I don't have a password and don't need a rr_connect but when I was connecting from a program and submitting the gcode file I was forgetting that axes aren't homed yet - so nothing (visibly) happens.

            When I connect a web browser I have been hitting the 'Home All' button immediately, and then (surprise!) uploaded gcode files run, but I have spent weeks not noticing that every time I connect with a web browser I immediately hit that button!

            The fix therefore was as simple as adding a G28:

            curl http://192.168.53.48/rr_gcode?gcode=G28
            curl --data-binary @circles.g http://192.168.53.48/rr_upload?name=/gcodes/circles.g
            curl http://192.168.53.48/rr_gcode?gcode=M32/gcodes/circles.g
            curl http://192.168.53.48/rr_disconnect
            

            Actually, I have now left in a http://192.168.53.48/rr_connect?password= (but with nothing specified as password) because it gives a potentially useful confirmation of the device - {"err":0,"sessionTimeout":8000,"boardType":"STM32F4","apiLevel":1}, but it isn't required.
            For posterity, I should note that without a password set on the printer a plain rr_connect without the password= appended doesn't work - it returns (in an html page) 'Your Duet rejected the HTTP request: Unknown request'.

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