LinuxCNC:将时间、参数和文件名记录到 CSV 的自定义 M-100 G-Code
将此文件放在例如 linuxcnc/configs/myCNC/custom-mcode/M100 中
M100
#!/usr/bin/env python2.7
# M100:将时间戳、参数和 gcode 文件名写入 linuxcnc/logM100.txt
import sys
import linuxcnc
from datetime import datetime
dt = datetime.now()
stat = linuxcnc.stat() # 创建到状态通道的连接
stat.poll()
with open("/home/cnc/linuxcnc/logM100.txt", "a") as outfile:
outfile.write("{} | Args={} | Path={}\n".format(dt.isoformat(), ", ".join(sys.argv[1:]), stat.file))并使用以下命令使其可执行
make_m100_executable.sh
chmod a+x ./linuxcnc/configs/myCNC/custom-mcodes/M100If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow