from __future__ import print_function
fname = input("Please enter the file name to fix: ")
print("Opening file " + fname)
with open(fname) as f:
content = f.readlines()
content = [x.strip("\n") for x in content]
content = [x.split(" ") for x in content]
i = 0
for line in content:
if line[0] == "G0" or line[0] == "G1":
print(line)
content[i] = line[:3]
i += 1
for line in content:
print(line)
with open(fname + "_fixed", 'w+') as f:
for line in content:
f.write(" ".join(line) + '\n')
当我尝试旋转/镜像我的 gcode 文件时,bCNC 会生成一条输出线,该线两次具有相同的坐标集。然后在尝试运行该文件时抛出错误 25。我已经能够在两台不同的机器上重现这个错误,运行最新的 bCNC。在能够毫无问题地旋转/镜像我的 gcode 文件之后,这是随机开始的。实际上,我没有以任何方式更新或更改 bCNC,甚至没有重新启动它。如果你继续旋转/镜像,它会在你每次按下按钮时为每条线添加另一组坐标。如果您将它们全部选中,则任何一个块或所有块都会发生这种情况。
这是我的 gcode 文件,由 kicad/flatcam 生成。我没有以任何方式更改此文件和以前工作的文件之间的工作流程。