style: 换料G-code改为换盘G-code,弹射后等待改为换盘后等待

This commit is contained in:
2026-07-28 10:47:08 +08:00
parent 8e2797dde6
commit 6b9fd8a93c
4 changed files with 39 additions and 39 deletions
+10 -10
View File
@@ -1,6 +1,6 @@
"""命令行接口模块:定义参数解析器和命令处理函数。
提供 `build`(构建打包 3MF)和 `list-swap-gcode`(列出换 G-code 文件)
提供 `build`(构建打包 3MF)和 `list-swap-gcode`(列出换 G-code 文件)
两个子命令,以及 `main` 入口函数。
"""
@@ -94,7 +94,7 @@ def build_command(args: argparse.Namespace) -> int:
def list_swap_gcode_command(args: argparse.Namespace) -> int:
"""执行 'list-swap-gcode' 子命令:列出可用的换 G-code 文件。
"""执行 'list-swap-gcode' 子命令:列出可用的换 G-code 文件。
Args:
args: 解析后的命令行命名空间
@@ -107,7 +107,7 @@ def list_swap_gcode_command(args: argparse.Namespace) -> int:
files = list_swap_gcode_files(directory)
# 目录为空时给出提示
if not files:
print(f"{directory} 中未找到换 G-code 文件")
print(f"{directory} 中未找到换 G-code 文件")
return 0
for path in files:
print(path.name)
@@ -119,7 +119,7 @@ def create_parser() -> argparse.ArgumentParser:
包含两个子命令:
- build: 构建打包的 3MF 文件
- list-swap-gcode: 列出换 G-code 文件
- list-swap-gcode: 列出换 G-code 文件
Returns:
argparse.ArgumentParser: 配置完成的参数解析器
@@ -138,19 +138,19 @@ def create_parser() -> argparse.ArgumentParser:
# --item 参数:每个文件可独立指定份数
build.add_argument("--item", nargs=2, action="append", metavar=("PATH", "COPIES"), help="添加一个带有独立份数的输入 3MF 文件。可重复使用。")
build.add_argument("-o", "--output", required=True, help="输出 3MF 路径。")
# 换 G-code 相关
build.add_argument("--swap-gcode", required=True, help=" G-code 文件名,位于 swap_gcode 中,或显式文件路径。")
# 换 G-code 相关
build.add_argument("--swap-gcode", required=True, help=" G-code 文件名,位于 swap_gcode 中,或显式文件路径。")
build.add_argument("--swap-gcode-dir", default=None, help=f"模板目录。默认值:{default_swap_gcode_dir()}")
# 份数与温度
build.add_argument("--copies", type=int, default=1, help="位置参数输入文件的复制份数。")
build.add_argument("--cool-bed", type=int, default=45, help="执行换 G-code 前等待的床温。")
build.add_argument("--cool-bed", type=int, default=45, help="执行换 G-code 前等待的床温。")
build.add_argument("--no-bed-cooldown", action="store_true", help="不在换料代码前插入 M190。")
# 时间与编号
build.add_argument("--wait", type=int, default=45, help="弹射后等待的秒数。")
build.add_argument("--no-eject-wait", action="store_true", help="不插入弹射后等待指令 G4。")
build.add_argument("--wait", type=int, default=45, help="换盘后等待的秒数。")
build.add_argument("--no-eject-wait", action="store_true", help="不插入换盘后等待指令 G4。")
build.add_argument("--show-plate-number", action="store_true", help="每板号向 M73 R 值增加 100 小时。")
# 行为开关
build.add_argument("--no-swap-after-final", action="store_true", help="最后一块板后不执行换 G-code。")
build.add_argument("--no-swap-after-final", action="store_true", help="最后一块板后不执行换 G-code。")
build.add_argument("--metadata-mode", choices=("source", "sum"), default="sum", help="如何写入 slice_info 的 prediction 和 weight。")
build.add_argument("--line-ending", choices=("lf", "crlf"), default="crlf", help="生成 G-code 的换行符。")
build.add_argument("--zip-level", type=int, choices=range(1, 10), default=DEFAULT_ZIP_COMPRESS_LEVEL, metavar="1-9", help="输出 3MF 的 zlib-ng Deflate 压缩级别。默认值:7。")