G-code programming optimization