跳转到内容

命令行界面

LinkCAD 可以完全通过命令行驱动,用于脚本化和自动化转换。

基本语法

linkcad.exe [options]

核心参数

文件 I/O

参数短参数描述
--import <path>-i输入文件路径
--export <path>-o输出文件路径
--input-format <fmt>强制输入格式(默认从扩展名自动检测)
--output-format <fmt>强制输出格式(默认从扩展名自动检测)

图层映射

参数描述
--layer-map <path>加载图层映射文件
--apply-layer-map在转换期间应用已加载的图层映射

处理

参数短参数描述
--config <path>-c加载命令文件.lsn 格式)
--top-cell <pattern>为分层格式选择顶层单元
--apply-tool <tools>导入后应用工具(以分号分隔)
--batch-combine将多个输入文件合并为单个输出
--units <value>-u设置显示单位(1–1 000 000)

控制

参数短参数描述
--quit-q处理后退出(无人值守操作必需)
--console启用控制台输出以便记录日志
--trace启用详细 TRACE 级别日志记录
--save-settings退出时保存设置(默认行为)
--no-save-settings退出时不保存设置
--load-defaults处理前重置为默认设置

Python

参数描述
--python-script <path>运行 Python 脚本并退出(无头模式)
--python-cmd <code>执行 Python 代码字符串并退出
--python-interactive打开交互式 Python 控制台(带 GUI)

信息

参数描述
--help显示帮助文本
--help-all显示所有选项,包括格式特定的动态选项

有效格式名称

将这些名称与 --input-format--output-format 一起使用:

名称导入导出
DXFYesYes
DWGYesYes
GDSIIYesYes
GDS-TXTYes
CIFYesYes
OASISYesYes
Gerber RS-274XYesYes
ODB++YesYes
SVGYesYes
PostScript/EPSYesYes
PDFYes
ACIS SATYesYes
Parasolid XTYes
STEPYes
IGESYes
IE3DYesYes
ANFYes
TETINYes
SonnetYesYes
LASI TLCYesYes
Compass LayoutYes
ModlaYes
Binary Die FormatYes
ASCII DataYes
Raster Image (Bitmap)YesYes

OASIS 和 ODB++ 的导入/导出需要 LinkCAD 11 或更高版本。DWG 在 LinkCAD 11 中同时支持导入和导出,而 LinkCAD 10 仅支持 DWG 导入。

示例

简单转换

Terminal window
linkcad.exe --import chip.gds --export chip.dxf --quit

带控制台输出的转换

Terminal window
linkcad.exe -i chip.gds -o chip.dxf --console -q

使用图层映射转换

Terminal window
linkcad.exe -i chip.gds -o chip.dxf `
--layer-map mapping.lmap --apply-layer-map -q

选择特定顶层单元

Terminal window
linkcad.exe -i chip.gds --top-cell "TOPCELL" -o chip.dxf -q

转换期间应用工具

Terminal window
linkcad.exe -i input.gds -o output.gds `
--apply-tool "Merge;SanitizePolygons" -q

无头运行 Python 脚本

Terminal window
linkcad.exe --python-script process.py --console

使用命令文件

Terminal window
linkcad.exe --config my_settings.lsn --console -q

覆盖格式特定选项

Terminal window
linkcad.exe -i chip.gds -o chip.dxf --DxfOutScaling 1000 -q

使用 --help-all 查看所有可用的格式特定选项。

自动化选项

这些选项控制无人值守操作,可在命令行或命令文件中设置。它们对应 Lc* 内部键名。

参数命令文件键描述
--load-defaultsLcLoadDefaults处理前重置为默认设置
(command file only)LcSkipImportOptions跳过导入选项对话框
(command file only)LcSkipExportOptions跳过导出选项对话框
(command file only)LcSkipSteps要跳过的向导步骤(逗号分隔)
(command file only)LcSelectTopCell不提示而自动选择顶层单元
(command file only)LcConvertBatch启用批量转换模式
--batch-combineLcBatchCombineFiles将多个文件合并为单个输出
--apply-layer-mapLcApplyLayerMap在处理期间应用图层映射
(command file only)LcNoRestart禁用崩溃后自动重启
(command file only)LcDeleteEmtpyCells导入后删除空单元
(command file only)LcDeleteUnresolvedRefs删除未解析的单元引用
(command file only)LcAutoAlternatePolarity多图层导入时自动交替极性
(command file only)LcAutoNumberMaterialValues自动为材料值编号
(command file only)LcAutoNumberZValues自动为 Z 值编号
(command file only)LcHideUnusedLayers导入后隐藏未使用图层
(command file only)LcInResolveLayers导入期间解析图层引用

动态选项

格式特定选项(例如 DxfOutScalingGbrInUnitsGdsOutDbScalingUnits)可以使用其内部键名直接在命令行传递。运行 linkcad.exe --help-all 可查看按格式组织的完整列表。

每个格式页面都会在“CLI / Command-File Options”部分列出可用的选项键。

旧版参数

LinkCAD 还接受旧版 -Lc* 样式参数以保持向后兼容性。完整映射请参见 CLI 参数参考

提示

  • 无人值守/脚本化操作始终使用 --quit(或 -q)— 否则 GUI 会保持打开
  • 使用 --console 在 stdout 上查看进度和错误消息
  • 格式会从文件扩展名自动检测;使用 --input-format / --output-format 覆盖
  • 在脚本中使用 --no-save-settings,避免修改用户默认值
  • 命令文件可以设置任何选项;显式 CLI 参数优先于命令文件中的值