Simple Snapmaker plugin for octoprint


#1

I’m starting a new plugin project for octoprint released under the ISC license. Any who would like to participate are welcome. I have never built an octoprint plugin, so I’m learning about it as I go.

I will be working towards getting at least the functionality of turning the laser on and off, turning the CNC tool on and off, and ultimately running boundaries and setting work origins via the octoprint UI.

Here is my starting code (does not much yet – kind of a “hello world” at this point), which I will be adding to often. If you’d like to contribute, feel free to add wishlist issues to the repo or reply here.


#2

I would try to help but I’ve never done programming with moving parts before.

I’ll try to learn about all the motors and stuff before I mess up the project haha!!!

This is going to be awesome!


#3

FYI, you can add custom controls to the Control tab by editing the config.yaml file. I’ve added “go to x,y origin” (for tool changes), “spindle on”, and “spindle off” buttons.


#4

Right. There is a programmatic way to do this from the plugin, which I intend to do also.


#5

@Rainie / @parachvte.

May I have permission to use the snapmaker svg logo from your website in the plugin? You can PM or email me if you like.


#6

If anyone who has octoprint is interested in beta testing, I have a functional (but NOT WELL TESTED) plugin with the following features:

Upon connection to the snapmaker, it detects the type of module and displays controls in the controls tab if it is a laser or CNC.

  • On and Off turn the tool on and off
  • A power slider can set the laser power (only changes when “on” is clicked right now)

See https://ron-linkertech.github.io/octoprint-snapmaker-control/

Ultimately, I’d like to be able to run a boundary for the loaded file, but I’m not there yet.

All comments welcome. I intend to fix the laser slider to send gcode as its being adjusted next, and will push an update when that is done.


#7

FYI, this plugin will now detect and turn the laser / cnc on and off.

However, beyond that there are issues.

I have started on boundary processing, and started a discussion thread here based on OctoPrint not really supporting CNC files yet. It currently won’t even allow uploads of “nc” files, and when I change this locally to test, there are other issues also. Here is the discussion. https://discourse.octoprint.org/t/non-3d-printer-cnc-discussion/2670

I intend to continue working this, but it is looking like it will be a lot more work than I initially thought, so It may move a little slower from here. I have limited time to dedicate to this, but would welcome any help.


#8

Aren’t nc files just gcode files, too? Does it work when you rename it .gcode?


#9

It will upload, yes, and you could even send it to the snapmaker, and it should work (in theory).

However, the tools in octoprint don’t know that a laser or cnc bit exists (M3 and M5 commands in gcode). The gcode analysis, which determines the size of the “print” does not work on these files since there is no “extruder” to tell it when to track the movement or not.

A CNC file seems to have a “tool on” command, a bunch of movements, and a “tool off”.

A laser file seems to have a “tool off” command, then a move, then a “tool on at %” command, then repeat… (laser pulse when the head is still, move with laser off)

I can probably make octoprint analysis figure out bounds for these things, or I can make my plugin do it, but it is a bunch more work than I thought it was going to be to just run a boundary
:slight_smile:


#10

Is this still working? I would love the features mentioned in Octopi, its a bit annoying to switch between USB and Octopi.