paukstelis / Octoprint-Cancelobject

104 stars 11 forks source link

Canceling objects ignores filament change #77

Open puterboy opened 1 year ago

puterboy commented 1 year ago

I had a color change set for a specific height. When I canceled several of the objects in the print, the subsequent filament change was ignored. Presumably it was deleted from the G-code. This presumably also affects other pre-programmed pauses in the G-code.

I imagine it could be hard to determine which 'filament changes' (or more generally pause) is associated with non-canceled objects. However, perhaps as a rule, any pause or filament change at the beginning of a layer change could be kept.

paukstelis commented 1 year ago

This is the exact kind of thing the "Allowed gcode" section is for. Check the plugin settings. You can put yourM600 or equivalent section in to make sure it won't get skipped.

puterboy commented 1 year ago

Ahhh that's great. I would like to add a context so it only allows M600 that occur right after a Level Change but (appropriately) deletes any M600 commands that may occur within an object (e.g., mid level pause within an object) If I add a regexp to capture this, can the regexp match across GCODE lines? (I would need to do that to capture the context)

paukstelis commented 1 year ago

No, I don't think that will work, as each command is parsed independently. That is getting beyond the scope of the plugin and into a very specific use case.

puterboy commented 1 year ago

I get that. I suppose I could use a post-processing script to add a label to M600 lines that follow a layer change. Then I could use a regexp to match that label and allow.