Consider skipping GCode entirely and generating KRL directly. I had some promising early results using the postprocessor provided by Autodesk in Fusion 360. You can get it here: https://cam.autodesk.com/hsmposts
It's written in JavaScript and fully editable. I had to tweak it a little bit to get the output to work on a KRC1, but with a KRC4 you should be fine without any compatibility issues. So far I've used it with the laser cutting CAM mode in F360 and I'd expect it to work with the 3D printing mode as well, as long as you add handlers for 3D printer-specific operations.
May I Ask what did you tweak?
I got a KR150 with KRC1 want to use it for milling, but don't know much about the KRC1 controller.