Loading and editing gcode in custom plugin
Hi!
I'm writting a plugin to make repetier host more easily usable with bioprinters. For that, I would need to edit the gcode file generated within repetier host when the user sends it to the connected printer. This is an operation that the end user should have no control over, so the included gcode editor cannot be used. How can I access the generated gcode in order to process it? I've read both https://rhplugins.repetier.com/ and https://forum.repetier.com/discussion/5000/way-to-load-gcode-file-for-plugin, but I couldn't figure out how to access or use the function LoadGCodeOrSTL(string file) nor editor.setContent(System.IO.File.ReadAllText(file)).
Can I use any of these functions to load the gcode generated by repetier (but not saved to a file) and edit it? If so, how do I do it? If not, is there a way I would be able to do it?
Thanks in advance!
I'm writting a plugin to make repetier host more easily usable with bioprinters. For that, I would need to edit the gcode file generated within repetier host when the user sends it to the connected printer. This is an operation that the end user should have no control over, so the included gcode editor cannot be used. How can I access the generated gcode in order to process it? I've read both https://rhplugins.repetier.com/ and https://forum.repetier.com/discussion/5000/way-to-load-gcode-file-for-plugin, but I couldn't figure out how to access or use the function LoadGCodeOrSTL(string file) nor editor.setContent(System.IO.File.ReadAllText(file)).
Can I use any of these functions to load the gcode generated by repetier (but not saved to a file) and edit it? If so, how do I do it? If not, is there a way I would be able to do it?
Thanks in advance!
Comments
I'm not really sure what your work flow is supposed to be. If you slice it the file gets loaded after being sliced. If you use LoadGCodeOrSTL on a .gcode file it also gets loaded into editor and shown.
With setContent and getContent you can modify the loaded file.
From what you write it sounds that you just want to run a postprocessor over the sliced output. Therefore you can add a postprocessor script in host printer configuration in the advanced tab. That gets run when the slicer is finished before loading the sliced file. It does not get called when you open a gcode directly. For this add a menu entry/tab and process the loaded gcode instead.