Advancing climate change, tense world markets, and political pressure steadily increase the demand for resourceoptimized production solutions. Herby, the positioning of the raw material in the machine tool is an important factor that has received little attention. Traditionally, this is done centrally on the machine table, which leads to locally increased wear of the feed axis. Furthermore, positioning directly influences energy consumption during machining. Consequently, the longest possible component utilization through optimum wear and energy optimization creates a direct conflict of objectives. To solve this conflict, this paper presents an automated approach for software-defined workpiece positioning and NC-Code optimization regarding the axis-specific energy consumption and the spindle condition of ball screws. An approach for mapping the energy consumption and the directly measured spindle condition is presented. Both represent input variables of the cost function. Approaches for the optimization of the position as well as for the practical implementation are proposed.