jneilliii / OctoPrint-TerminalCommandsExtended

9 stars 1 forks source link

[FR] auto magical command parameters #15

Open Andrei-Pozolotin opened 4 years ago

Andrei-Pozolotin commented 4 years ago
  1. is it feasible to expose to buttons auto magical command parameters?

  2. use case: there is an attachment which in response to a button command auto paints hotbed with a glue stick, but glue application area position and size need to be provided manually, despite model gcode is loaded in octoprint and, first layer bounding box information is apparently available via some api

  3. here are some plugins which can access loaded model gcode data:

  4. parameters to extract from gcode:

    • hotbed temp
    • hotend temp
    • chamber temp
    • first layer bounding box
    • total model height
jneilliii commented 4 years ago

Not sure if this is feasible for a generic plugin like this one, assuming I'm understanding your correctly. The plugins that you are referring to are actually reading the gcode file directly and reacting to those, which again is not feasible for this plugin because this isn't a gcode file plugin but a generic gcode commands plugin.

Andrei-Pozolotin commented 4 years ago
  1. in this case, can you expose an api to subscribe to externally provided parameters?

  2. that is so I can write a plugin which will publish these parameters for your plugin

jneilliii commented 4 years ago

I still don't understand the use case here. Can you describe your end goal please?

Andrei-Pozolotin commented 4 years ago
  1. the use case is to extract command parameters from the g-code in addition to having to provide them manually with user UI

  2. utility: this can be used to make commands model-aware, for example:

  1. how about a PR? will you accept a PR which would basically be a copy-paste of g-code context extract as it is done in some other plugins, and said context will then be injected into this plugin as automatically discovered command parameters?

say, auto magic parameters will appear with prefix GCODE

  1. temperature extract seems rather straightforward: https://github.com/marian42/octoprint-preheat/blob/master/octoprint_preheat/__init__.py#L84

  2. bounding box is already exposed as "dimensions" after "file load / model view" action in UI: https://github.com/OctoPrint/OctoPrint/blob/master/src/octoprint/util/gcodeInterpreter.py#L506

jneilliii commented 4 years ago

I would accept a PR for this, always open for that.

Andrei-Pozolotin commented 4 years ago

ok, great. please re-open.

Andrei-Pozolotin commented 4 years ago

@jneilliii Jim: do you have a recommended setup for plugin development / testing? any good tutorials / walkthroughs? please share links if any? thank you.

jneilliii commented 4 years ago

The plugin tutorial here is a good start. There's also a YouTube video in the code and chat series where Gina writes a plugin.