Jump to content

Communicate directly with printer from a plugin


bradk3

Recommended Posts

Posted · Communicate directly with printer from a plugin

Is it possible for a plugin to communicate directly with a connected printer without worrying about the underlying communication method?  By this, I mean send gcode directly and read the printer's response whether the printer is connected directly using USB or through something like Octoprint?  

 

I'm combing through the source code but am having trouble figuring out how to do this.  I've found UM's OutputDevice, for instance, which provides a "requestWrite" function, that looks promising, but doesn't give me much hope to be able to read the printer's response.

 

Is there a plugin that already does this sort of thing I could look at?

 

Cheers and thanks!

  • Link to post
    Share on other sites

    Posted · Communicate directly with printer from a plugin
    1 hour ago, bradk3 said:

    Is it possible for a plugin to communicate directly with a connected printer without worrying about the underlying communication method? 

    In a word: no.

     

    Every PrinterOutputDevice has a PrinterOutputController, and some PrinterOutputControllers implement a sendRawCommand method (the PrinterOutputController will have its can_send_raw_gcode property set to true). But there is no generic way to retreive the response.

     

    The requestWrite method is for sending and queueing whole gcode files and is not suitable for individual commands.

  • Link to post
    Share on other sites

    Posted · Communicate directly with printer from a plugin

    I've written a Windows app that I think does what you want.  It isn't for printing via USB but rather for controlling SD card printing from a connected PC.  Gcode commands can be sent and the responses received and are displayed in a text box.  It has other functionality (tuning a print on the fly, bed leveling, macros) as well as some odd post-processing ("cooling profile" is one) that I added because I could.  It is more an alternative to PrintRun (which interface I don't care for) than anything else.

    The full version begat a smaller version which just functions as a print utility with leveling commands but you can send one command at a time and receive and display the printer response.

    Greg's Toolbox is the full monte and includes instructions (such as they are) and a readme for installation.

    Greg's SD Print Tool is the Cliff's Notes version.  This one has just a readme as the program itself is pretty self-explanatory.

     

    They are un-signed Windows apps (VB doesn't port to Linux or Mac) so you would need to fool your anti-virus/firewall in order to install either.

     

    The opening dialog looks like this.  In this case I have a print running.  The gcode for it was post-processed with both a M117 to message the display and an M118 to bounce the same info back to the textbox in the app.

    image.thumb.png.720c43d0d6fe29562304361407420178.png

  • Link to post
    Share on other sites

    Posted · Communicate directly with printer from a plugin
    2 hours ago, GregValiant said:

    I've written a Windows app that I think does what you want.  It isn't for printing via USB but rather for controlling SD card printing from a connected PC.  Gcode commands can be sent and the responses received and are displayed in a text box.  It has other functionality (tuning a print on the fly, bed leveling, macros) as well as some odd post-processing ("cooling profile" is one) that I added because I could.  It is more an alternative to PrintRun (which interface I don't care for) than anything else.

    The full version begat a smaller version which just functions as a print utility with leveling commands but you can send one command at a time and receive and display the printer response.

    Greg's Toolbox is the full monte and includes instructions (such as they are) and a readme for installation.

    Greg's SD Print Tool is the Cliff's Notes version.  This one has just a readme as the program itself is pretty self-explanatory.

    That looks interesting.  I'll check it out.  

     

    Thank you!

  • Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • UltiMaker Cura 5.8 Stable released 🎉
        In the Cura 5.8 stable release, everyone can now tune their Z seams to look better than ever. Method series users get access to new material profiles, and the base Method model now has a printer profile, meaning the whole Method series is now supported in Cura!
        • 5 replies
      • Introducing the UltiMaker Factor 4
        We are happy to announce the next evolution in the UltiMaker 3D printer lineup: the UltiMaker Factor 4 industrial-grade 3D printer, designed to take manufacturing to new levels of efficiency and reliability. Factor 4 is an end-to-end 3D printing solution for light industrial applications
          • Thanks
          • Like
        • 3 replies
    ×
    ×
    • Create New...