Starting Print From Custom Plugin
Hi, I made a custom plugin for Repetier-Host that edits the "composition.gcode " according to some user definitions. I'd like to add a "start" button to this plugin, so when clicked it runs the editted gcode. I tried using "RepetierHostExtender.basic.Printjob.BeginJob();", but it doesn't work. Is there a way of doing it?
Comments
But I'm not sure your solution is correct at all. Changing composition.gcode has no effect on the host. You can make such a modification if you enable the postprocessor in host so it is run directly after slicing. But after slicing that file gets loaded and from there on ignored. So if you modify it afterwards you need to reload the gcode to include it in host and from there on the regular print button also will work.
The host function
void LoadGCodeOrSTL(string file);
would load a new gcode named in file to editor and switch to preview tab.
But it gets even easier. Host function
IGCodeEditor GCodeEditor { get; }
gives you direct access to the editor content. That way you can also modify the code without reloading. See editor interface:
For reload all you need is
editor.setContent(System.IO.File.ReadAllText(file));
but with getContent and setContent you can also postprocess the result internally.