Refactor to reduce code size, should be no change in functionality.
Refactor to reduce code size, should be no change in functionality.

ROBO3D/CuraEngine,Ultimaker/CuraEngine,alephobjects/CuraEngine,alephobjects/CuraEngine,ROBO3D/CuraEngine,Ultimaker/CuraEngine,ROBO3D/CuraEngine,alephobjects/CuraEngine