οκ, Ι saw these files. But, my last programming was in high school with Quick Basic. 22 years back

While I catch up, if i provide you with the logic can you help me translate it in python?
My 1st approach (but not-ideal) would be with post processor.
A big parenthesis here is that after some thinking I would like be able to add in the regular PATH workbench:
Something that converts the whole Workbench to 2D. Either for laser or plasma. The code is already there, actually is simpler imho!
With 2D somewhere we could add some constants like
a)Initial Height Probing Commands
b) Safe height
c) Plasma cut height
So before it even reach the post processor the PATH will generate useful code. It can use the b) to move in the starting point, run the a) function in the g-code, move into c) height, and run the regular command (like the Face Profile) only that now it adds the M3/M5 at any raise/depression of the tool.
Maybe later a parameter can be added of how often or what is the minimum distance the torch has to travel before it re-zeroes the Z, trying to avoid too many zeroings. Anyway thats just my super simplified thought, i guess there are a lot more to be considered.
The
www.sheetcam.com is a good program that someone can use a reference. I also checked the
https://github.com/OpenBuilds/cam . I can't make it work, but you can see what i mean. Its
https://cam.openbuilds.com/
Closing the parenthesis, and continuing to the quick n dirty post processor
Without understanding yet all these steps inside the post proc. I would add a new argument that just asks if it is for a plasma machine with TorchHeightControl. (its convenient just for me! hahaha). My thought is that with plasma and THC we need only 2D.
So when a user adds the --plasma-thc these happen:
Stores every Z detected value to a variable "Z_check"
Check every new Z and compares it with Z_check.
When its of smaller value and its of a G1,
It adds the zeroing() function to the post g-code
Raise the Z to 1.5mm
Starts the torch (M3).
Continue its normal flow
Else If its equal
Continue its normal flow
Else if it is bigger then
stop the torch (M5)
Raise to a safe height
Endif
Store the Z value to the Z-check.
What do you think about this simple way? Of course I must not create multi level passes etc. Would that work just for now?
The various Z values through the regular code are not important with the THC if the torch is on since it just ignores them (the THC has the final word on the Z)