Apologies, I didn't really consider the full consequences, but you make perfect sense!
Yes, it does work for negative values up to the layer height thickness but I'm currently running it much higher.
I think I should be able to edit the G code so it's negative -4.5 which will then allow me to use your script to bring it up to the correct positive level, so I can have different initial layer heights for different profiles.
Thanks for pointing me in the right direction, really appreciate it!