A method for machining a workpiece to obtain a part having a desired geometry by a laser beam emitted by a laser head integrated in a machine tool, comprising wherein the machine tool includes a laser source for emitting a laser beam, and the laser head includes an optical system for directing the laser beam onto the workpiece, wherein the optical system includes a plurality of mirrors for reflecting the laser beam emitted by the laser source, and a focal lens for passing through the reflected laser beam and focusing the laser beam to an ablation position on the workpiece to ablate the material at this position wherein:
- a. defining a machining focal range for the focal lens applied for machining, wherein the machining focal range is a partial area of the focal lens center and within which the laser beam passes through the focal lens to reach the ablation position;
- b. calculating a plurality of machining layers based on the desired geometry of the part by a processing unit, each of the machining layer defines a layer of the workpiece having a defined thickness, wherein the machining layers are machined in succession;
- c. calculating for each machining layer a plurality of patches by the processing unit, each of which defines an area on one layer of the workpiece, wherein the area within the patch is machined from a single position of the laser head while the laser beam is directed to different ablation positions within this area, wherein the patches are defined in a manner such that the laser beam passes through the focal lens only within the machining focal range to reach all the ablation positions of the patches, and wherein a machining direction is determined for at least one of the patches, wherein the machining direction defines the direction of the laser beam emitted on the surface for ablating the patch;
- and
- d. ablating the material of the workpiece based on the defined machining layers and patches.