OctoPrint-BedLevelVisualizer icon indicating copy to clipboard operation
OctoPrint-BedLevelVisualizer copied to clipboard

[FR]: Add scripting support to commands

Open git-rz opened this issue 1 year ago • 1 comments

While using the bed visualizer commands / macros, I wish to press a button and see terminal output in a popup. (M92, M420, many more..)

I should be able to extract info from the output, either for display, or for reuse in subsequent commands.

Command syntax should allow for calculations.

Estep calibration, for instance, would be one use case that combines these ideas:

M92 T%(tool_param)s E{{ multiplier_param * ( $( M92 ).split(/ E[0-9.]+/)[ tool_param +1]) }}
{{ popup("Set new esteps for T$tool _param: $( M92 ).split(/ E[0-9.]+/)[ tool_param +1]) ") }}

Apologies for the syntax of the example above. I've mashed together the %.(...)s from this plugin, {{ from mustache, $() from shell, .split() from any number of modern languages.. I'm not asking for this exact syntax.

If there were an API to create a new button, then we can have buttons to add buttons. Use cases include:

  • Create a new button to restore a mesh (already logged as another issue here)
  • Create a button to restore nozzle offsets for dual extruders.
  • probably more

This is at least five feature requests in one, so I can split this out if there is interest.

  • simple calculations using params as inputs (probably super simple) (I'd be happy just to have this)
  • display outputs
  • parse outputs
  • generalized scripting
  • api (within the generalized scripting system) for adding more command buttons

git-rz avatar Apr 25 '23 20:04 git-rz