Hi Mari,
Thank you for your reply. What I am wanting to do, is have my gcode execute an Octoprint macro just before starting the last layer of any print that I slice. And I want the insertion of that macro command to be automatic so that I dont have to do a manual search and replace every time I slice a print.
The idea seemed fairly simple to me ... using regex, do a findAll on a simple string pattern
;LAYER:\d+
... the last one found would be the start of the final layer, then simply replace that string with the macro call and it's all good.
But it doesn't seem to be working out. I did learn through trying to make this work, that Prusa slicer can call any program that you desire for post processing and it will pass it the absolute file path of the gcode file that it generates as an argument to the program, where you can then further process the gcode, save it then the slicer drops it in to the folder that you chose when you export the gcode.
Using a Java program that I threw together, I was able to successfully do what I want in post processing with Prusa, but I'm otherwise not familiar with Prusa slicer so im not sure how that is going to work out.
Also, if this is the place to make suggestions for Cura, I think it would be great to have a post processing option that allows us to insert gcode at specific layers ... in similar fashion to how we can pause a print at any layer - which Ive used many times to print objects into parts etc. Being able to insert gcode at a given layer might be a function that others would find useful as well ... though that's just a presumption on my part of course ☺
Edited by EasyGoing1
Recommended Posts
MariMakes 208
Hey @EasyGoing1
I'm really curious, what problem are you trying to solve by changing the gcode?
There might be a different approach that involves less coding 😉
If it comes to changing Gcode I usually use the Post Processing Script
Did you try that one yet?
Link to post
Share on other sites