It happens every time I run longer code. It doesn't matter if the code is 300,000 lines or 500,000 lines. It always happens on the very few last lines (less then a millimeter of final carving work). Mach runs through the rest of the code, and goes on the first line as everything was done, but the machine will go left-right few centimeters forever. Sometimes it even gets stuck. But always losses XY position after this (Z is fine).
Here is the bottom part of the code:
Y285.562Z-3.050
Y285.714Z-3.185
X1.700Z-3.188
Y285.497Z-3.013
Y285.103Z-2.805
Y284.743Z-2.687
Y284.370Z-2.618
Y283.793Z-2.582
Y2.187Z-2.582
Y1.800Z-2.602
Y1.419Z-2.655
Y1.050Z-2.747
Y0.700Z-2.884
Y0.371Z-3.076
Y0.000Z-3.381
X1.500Z-3.382
Y0.436Z-3.037
Y0.724Z-2.886
Y1.246Z-2.701
Y1.609Z-2.640
Y2.379Z-2.610
Y284.050Z-2.617
Y284.436Z-2.653
Y284.815Z-2.730
Y285.180Z-2.856
Y285.525Z-3.038
Y285.714Z-3.188
X1.300Z-3.199
Y285.446Z-3.008
Y285.120Z-2.851
Y284.764Z-2.742
Y284.393Z-2.681
Y283.818Z-2.653
Y2.001Z-2.656
Y1.673Z-2.670
Y1.287Z-2.720
Y0.907Z-2.825
Y0.542Z-2.993
Y0.195Z-3.228
Y0.000Z-3.393
X1.100Y-0.000Z-3.412
Y0.218Z-3.231
Y0.436Z-3.082
Y0.666Z-2.970
Y1.033Z-2.833
Y1.412Z-2.755
Y2.178Z-2.708
Y283.985Z-2.711
Y284.315Z-2.726
Y284.701Z-2.777
Y285.078Z-2.876
Y285.440Z-3.032
Y285.714Z-3.216
X0.900Z-3.254
Y285.497Z-3.117
Y285.279Z-3.013
Y284.912Z-2.881
Y284.339Z-2.794
Y281.300Z-2.779
Y1.995Z-2.782
Y1.489Z-2.811
Y1.103Z-2.872
Y0.719Z-3.001
Y0.348Z-3.202
Y0.000Z-3.451
X0.700Z-3.503
Y0.218Z-3.318
Y0.602Z-3.105
Y0.957Z-2.985
Y1.327Z-2.913
Y1.902Z-2.877
Y284.002Z-2.875
Y284.342Z-2.887
Y284.726Z-2.933
Y285.099Z-3.020
Y285.455Z-3.154
Y285.714Z-3.301
X0.500Z-3.386
Y285.279Z-3.164
Y284.916Z-3.053
Y284.538Z-3.001
Y282.305Z-2.984
Y1.728Z-2.988
Y1.396Z-3.003
Y1.011Z-3.061
Y0.636Z-3.181
Y0.281Z-3.364
Y0.000Z-3.550
X0.300Y-0.000Z-3.615
Y0.086Z-3.583
Y0.436Z-3.384
Y0.800Z-3.248
Y1.371Z-3.146
Y2.891Z-3.127
Y284.236Z-3.129
Y284.566Z-3.143
Y284.951Z-3.197
Y285.324Z-3.301
Y285.714Z-3.479
X0.141Z-3.594
X0.138Z-3.596
X0.100Z-3.601
Y285.677Z-3.601
Y285.674Z-3.600
Y285.279Z-3.423
Y284.923Z-3.337
Y284.548Z-3.297
Y1.384Z-3.300
Y1.000Z-3.347
Y0.631Z-3.446
Y0.292Z-3.595
Y0.286Z-3.595
Y0.000Z-3.625
G0Z5.000
G0X0.000
G0Z5.000
G0X0Y0
M30