tjhorner / makerbot-rpc

πŸ”Œ Go client library for MakerBot 3D printers

Home Page:https://godoc.org/github.com/tjhorner/makerbot-rpc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

makerbot-rpc

GoDoc Build Status

Go Gopher by lclemente

A Go client library to interact with your MakerBot printer via the network.

Documentation, examples and more at GoDoc.

Since this is currently mid-development, things will probably change very, very often. No stable API is guaranteed until the first stable version of this project.

Example

go get github.com/tjhorner/makerbot-rpc
// WARNING: This example may fail to work at any time.
// This library is still in development. This example
// is only provided to give a sense of what the library can do.
// Errors are ignored for brevity.

client := makerbot.Client{}
defer client.Close()

// React when the printer's state changes
client.HandleStateChange(func(old, new *makerbot.PrinterMetadata) {
  if new.CurrentProcess == nil {
    return
  }

  // Log the thing the printer is currently doing
  log.Printf("Current process: %s, %v%% done\n", new.CurrentProcess.Name, new.CurrentProcess.Progress)
})

// Make initial TCP connection w/ printer
client.ConnectLocal("192.168.1.2", "9999") // most MakerBot printers listen on 9999

log.Printf("Connected to MakerBot printer: %s\n", client.Printer.MachineName)

// Authenticate with Thingiverse
client.AuthenticateWithThingiverse("my_access_token", "my_username")

log.Println("Queuing file for printing...")

// Print a file named `print.makerbot` in the same directory
client.PrintFileVerify("print.makerbot")

log.Println("Done! Bye bye.")

Features and TODO

  • Connecting to printers (ConnectLocal(), ConnectRemote())
  • Printer discovery via mDNS (DiscoverPrinters())
  • Authenticating with local printers via Thingiverse (AuthenticateWithThingiverse())
  • Authenticating with local printers via local authentication (pushing the knob)
  • Authenticating with remote printers via MakerBot Reflector (ConnectRemote())
  • Printer state updates (HandleStateUpdate())
  • Load filament method (LoadFilament())
  • Unload filament method (UnloadFilament())
  • Cancel method (Cancel())
  • Change machine name (ChangeMachineName())
  • Send print files (Print(), PrintFile())
  • Camera stream/snapshots (HandleCameraFrame(), GetCameraFrame())
  • Parse .makerbot print files along with their metadata, thumbnails, and toolpath (see printfile package)
  • Get machine config (low priority; isn't very useful)
  • Write tests
    • makerbot package (will need to make a mock MakerBot RPC server)
    • jsonrpc package
    • printfile package
    • reflector package
  • Write examples
  • Better errors
  • Fuzz the shizz out of thizz

License

TBD, but probably MIT later.

About

πŸ”Œ Go client library for MakerBot 3D printers

https://godoc.org/github.com/tjhorner/makerbot-rpc


Languages

Language:Go 100.0%