跳转到内容

命令文件

命令文件(也称为会话文件)是带 .lsn 扩展名的 INI 格式文本文件,用于设置任意组合的 LinkCAD 选项。命令文件用于在计算机之间共享设置、自动化重复转换,以及恢复已保存的会话。

文件格式

命令文件使用标准 INI 格式,并且需要 [LinkCAD] 节头:

[LinkCAD]
LcImportFormat=GDSII
LcExportFormat=DXF
LcImportFile=C:\designs\chip.gds
LcExportFile=C:\output\chip.dxf

语法规则

  • 必须包含 [LinkCAD] 节头(不区分大小写)
  • 节头之前的行会被忽略
  • 每个选项独占一行:OptionName=value
  • 值可以加引号:LcImportFile="C:\path with spaces\file.gds"
  • = 周围和值周围的空白会被修剪
  • 空值会被忽略

ToolApply

允许多个 ToolApply 行,并会使用 ; 分隔符连接:

[LinkCAD]
ToolApply=Merge
ToolApply=SanitizePolygons

这等同于:

[LinkCAD]
ToolApply=Merge;SanitizePolygons

使用命令文件

从 GUI

  • File → Load Session (Ctrl+O) 会加载 .lsn 文件并应用其所有选项
  • File → Save Session (Ctrl+S) 会将当前选项写入 .lsn 文件

从命令行

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

命令行上传入的选项优先于命令文件中的值。这样可以使用命令文件保存共享设置,同时在每次调用时覆盖特定值:

Terminal window
linkcad.exe --config gds_to_dxf.lsn `
--import chip_a.gds --export chip_a.dxf --quit

常用选项

核心选项

选项类型描述
LcImportFilestring输入文件路径
LcExportFilestring输出文件路径
LcImportFormatstring导入格式名称(例如 GDSIIDXF
LcExportFormatstring导出格式名称(例如 DXFCIF
LcConvertBatchboolean启用批量转换模式
LcBatchCombineFilesboolean将多个文件合并为单个输出
LcApplyLayerMapboolean在转换期间应用图层映射
ToolApplystring要应用的工具(以分号分隔)

DXF 选项(示例)

选项类型描述
DxfOutScalingreal输出缩放比例
DxfOutBinaryboolean写入二进制 DXF
DxfOutFormatVersionstringDXF 版本(例如 2000
DxfInScalingreal导入缩放比例
DxfInExplodeSplinesboolean将样条曲线转换为折线

GDSII 选项(示例)

选项类型描述
GdsOutDbScalingUnitsinteger数据库单位
GdsOutDbScalingValuereal数据库缩放值
GdsInIgnoreTextboolean导入时跳过文本元素

Gerber 选项(示例)

选项类型描述
GbrInUnitsinteger导入单位
GbrOutDecimalsinteger输出小数位数
GbrOutAbsCoordinateboolean使用绝对坐标

示例:GDS 到 DXF 转换

[LinkCAD]
LcLoadDefaults=true
LcImportFormat=GDSII
LcExportFormat=DXF
LcImportFile=C:\designs\chip.gds
LcExportFile=C:\output\chip.dxf
DxfOutScaling=1000
DxfOutFormatVersion=2000
ToolApply=SanitizePolygons

示例:带工具的 Gerber 导入

[LinkCAD]
LcLoadDefaults=true
LcImportFormat=Gerber RS-274X
LcExportFormat=GDSII
GbrInUnits=4
ToolApply=Merge
ToolApply=Deembed

会话与命令文件的关系

会话文件和命令文件使用相同的 .lsn 格式。在 GUI 中保存会话时,LinkCAD 会将所有当前记录的选项写入文件。加载会话或使用 --config 时,LinkCAD 使用同一个 INI 解析器读取文件。有关会话管理的更多信息,请参见会话