When I began to work on PostProcessingPlugIns, it was a pain as there is no way to debug the script
No message, even sometimes my plug in not appearing in the list.
So I tried to install a standalone Python with debugger and work on it. This is what this post is about ...
I Have windows 7 64 bit, Cura 4.0 and Python 3.7 with IDLE
I build two configuration, one for the Cura script folder (for me in \AppData\Roaming\cura\4.0\scripts) and one in the script folder for Cura in Python (for me in \AppData\Local\Programs\Python\Python37-32\Scripts\Cura)
The basic logic is I create a superClass MyScript derived from tje script class of Cura, in which I put all the stuff to manage the scrip, leaving only in the script the variables and settings definition, and the formulas working to modify the GCode
It gives a feel & look for all the scripts, gives more information to the user in the GCode, and also manage the way to debug a script in Python
To debug in Python, you have the same superclass, a DEBUG_SCRIPT script to prepare the GCode for debugging, a tKinter Window class to run the script in python, and a mini script class having only the functions necessary to do like the one in Cura (but only for debugging purpose)
In the file below you'll find the two configuration you have only t extract them in the corresponding folders and then restart Cura and deiscover ...
As PostProcessingplugIns you'll find
1 DEBUG_SCRIPT : to prepare the GCode for debugging a new script
2 Comment : a script only to add a comment a the begining of the Gcode (you can use it several times in one slicing process)
3 Remaining printing Time : to send to the printer LCD at each layer the time remaining up to the end
4 Lower Tiny holes printinting speed on 1st layer : to hav a better printing without filament dragging effect
5 LiftHead without annoying too large Z movement : to have a better quality for small layers
Now look at this scenario :
I insert all these scripts (number 1 to 8 to follow the result below), a few of them which will give an error that is handled
Here are the resulting pieces of GCode
1) Start of GCode
GCode during the 1st layer within a tiny Hole, speed reduced from 1800 to 600
end of a layer with information from several scripts
Now if I want to debug a script on the resulting Gcode file i have a the end of the slicing in Cura to save it in the IDLE scripts for Cura folder.
Then I go in Python's IDLE and run a script I want to debug
It appears a window to select the GCode file
Then the next window is to enter the settings for the script
if I close the window, result in IDLE
Or if I enter the correct params
If there were errors the IDLE debugger will give you a lot of information to modify your script