命令文件
命令文件(也称为会话文件)是带 .lsn 扩展名的 INI 格式文本文件,用于设置任意组合的 LinkCAD 选项。命令文件用于在计算机之间共享设置、自动化重复转换,以及恢复已保存的会话。
文件格式
命令文件使用标准 INI 格式,并且需要 [LinkCAD] 节头:
[LinkCAD]LcImportFormat=GDSIILcExportFormat=DXFLcImportFile=C:\designs\chip.gdsLcExportFile=C:\output\chip.dxf语法规则
- 必须包含
[LinkCAD]节头(不区分大小写) - 节头之前的行会被忽略
- 每个选项独占一行:
OptionName=value - 值可以加引号:
LcImportFile="C:\path with spaces\file.gds" =周围和值周围的空白会被修剪- 空值会被忽略
ToolApply
允许多个 ToolApply 行,并会使用 ; 分隔符连接:
[LinkCAD]ToolApply=MergeToolApply=SanitizePolygons这等同于:
[LinkCAD]ToolApply=Merge;SanitizePolygons使用命令文件
从 GUI
- File → Load Session (Ctrl+O) 会加载
.lsn文件并应用其所有选项 - File → Save Session (Ctrl+S) 会将当前选项写入
.lsn文件
从命令行
linkcad.exe --config my_settings.lsn --console --quit命令行上传入的选项优先于命令文件中的值。这样可以使用命令文件保存共享设置,同时在每次调用时覆盖特定值:
linkcad.exe --config gds_to_dxf.lsn ` --import chip_a.gds --export chip_a.dxf --quit常用选项
核心选项
| 选项 | 类型 | 描述 |
|---|---|---|
LcImportFile | string | 输入文件路径 |
LcExportFile | string | 输出文件路径 |
LcImportFormat | string | 导入格式名称(例如 GDSII、DXF) |
LcExportFormat | string | 导出格式名称(例如 DXF、CIF) |
LcConvertBatch | boolean | 启用批量转换模式 |
LcBatchCombineFiles | boolean | 将多个文件合并为单个输出 |
LcApplyLayerMap | boolean | 在转换期间应用图层映射 |
ToolApply | string | 要应用的工具(以分号分隔) |
DXF 选项(示例)
| 选项 | 类型 | 描述 |
|---|---|---|
DxfOutScaling | real | 输出缩放比例 |
DxfOutBinary | boolean | 写入二进制 DXF |
DxfOutFormatVersion | string | DXF 版本(例如 2000) |
DxfInScaling | real | 导入缩放比例 |
DxfInExplodeSplines | boolean | 将样条曲线转换为折线 |
GDSII 选项(示例)
| 选项 | 类型 | 描述 |
|---|---|---|
GdsOutDbScalingUnits | integer | 数据库单位 |
GdsOutDbScalingValue | real | 数据库缩放值 |
GdsInIgnoreText | boolean | 导入时跳过文本元素 |
Gerber 选项(示例)
| 选项 | 类型 | 描述 |
|---|---|---|
GbrInUnits | integer | 导入单位 |
GbrOutDecimals | integer | 输出小数位数 |
GbrOutAbsCoordinate | boolean | 使用绝对坐标 |
示例:GDS 到 DXF 转换
[LinkCAD]LcLoadDefaults=trueLcImportFormat=GDSIILcExportFormat=DXFLcImportFile=C:\designs\chip.gdsLcExportFile=C:\output\chip.dxfDxfOutScaling=1000DxfOutFormatVersion=2000ToolApply=SanitizePolygons示例:带工具的 Gerber 导入
[LinkCAD]LcLoadDefaults=trueLcImportFormat=Gerber RS-274XLcExportFormat=GDSIIGbrInUnits=4ToolApply=MergeToolApply=Deembed会话与命令文件的关系
会话文件和命令文件使用相同的 .lsn 格式。在 GUI 中保存会话时,LinkCAD 会将所有当前记录的选项写入文件。加载会话或使用 --config 时,LinkCAD 使用同一个 INI 解析器读取文件。有关会话管理的更多信息,请参见会话。