Skip to content

Command Files

A command file (also called a session file) is an INI-format text file with a .lsn extension that sets any combination of LinkCAD options. Command files are used to share settings between machines, automate repetitive conversions, and restore saved sessions.

File Format

Command files use the standard INI format with a required [LinkCAD] section header:

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

Syntax Rules

  • The [LinkCAD] section header is required (case-insensitive)
  • Lines before the section header, and in other sections, are ignored
  • Each option is on its own line: OptionName=value; option names are not case-sensitive
  • Values may be quoted: LcImportFile="C:\path with spaces\file.gds"
  • Whitespace around = and around values is trimmed
  • Empty values are ignored
  • Booleans are true/false, yes/no or 1/0
  • An option given twice takes the later value
  • LcCommandFile=other.lsn reads another command file at that point; later lines override it
  • The core options may also use their command-line names (layer-map, quit) or LinkCAD 10 short names (i, o, q, c)
  • An option LinkCAD does not know is reported as a warning and skipped

ToolApply

Multiple ToolApply lines in a file are concatenated with ; separators, in order:

[LinkCAD]
ToolApply=Merge
ToolApply=SanitizePolygons

This is equivalent to:

[LinkCAD]
ToolApply=Merge;SanitizePolygons

Using Command Files

From the GUI

  • File → Load Session (Ctrl+O) loads a .lsn file and applies all its options
  • File → Save Session (Ctrl+S) writes the current options to a .lsn file

From the Command Line

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

Options passed on the command line take precedence over values in the command file; a flag such as --apply-layer-map is set if either sets it. This lets you use a command file for shared settings while overriding specific values per invocation:

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

A command file that names the input and output files and the output format converts unattended with --quit, or with LcExitWhenFinished=true in the file; see Unattended Conversion. A command file that cannot be read is an error.

Resetting to Defaults

LcLoadDefaults=true, the first line of every saved session, resets all conversion settings to their defaults before the rest of the file is applied, so the file reproduces the conversion it describes rather than one shaped by the settings left from earlier work. Application settings are kept: the license, window layout, language, recent files, viewer preferences. When the settings are saved on exit, the reset settings are saved at their defaults.

A file included part-way through with LcCommandFile that starts with LcLoadDefaults=true resets the settings given before it; lines after it, and the command line, still apply.

Common Options

Core Options

OptionTypeDescription
LcImportFilestringInput file path
LcExportFilestringOutput file path
LcImportFormatstringImport format name (e.g. GDSII, DXF)
LcExportFormatstringExport format name (e.g. DXF, CIF)
LcLayerMapstringLayer map file
LcApplyLayerMapbooleanApply layer map during conversion
LcTopCellPatternstringTop cell to convert
LcExitWhenFinishedbooleanExit when the conversion is done (--quit)
LcLoadDefaultsbooleanReset conversion settings to defaults; see Resetting to Defaults
LcSkipStepsstringWizard steps to skip: all, or step names separated by ;
LcConvertBatchbooleanEnable batch conversion mode
LcBatchCombineFilesbooleanCombine multiple files into single output
ToolApplystringTools to apply (semicolon-separated)

DXF Options (examples)

OptionTypeDescription
DxfOutScalingrealOutput scaling factor
DxfOutBinarybooleanWrite binary DXF
DxfOutFormatVersionstringDXF version (e.g. 2000)
DxfInScalingrealImport scaling factor
DxfInExplodeSplinesbooleanConvert splines to polylines
DxfInKeepClosedZeroWidthPolylinesAsPolylinesbooleanKeep valid closed zero-width DXF polylines as polylines

Tool Options (examples)

OptionTypeDescription
ToolArcPrecValueintegerArc/curve approximation precision value
ToolArcPrecUnitsintegerPrecision mode: -1 = segments/360°, otherwise a unit enum
ToolConvertZeroWidthClosedPolylinesbooleanConvert closed zero-width polylines to polygons in Convert to Outline / Explode to Polygons
ToolDontExplodebooleanMerge Shapes option Only merge polygons; legacy label: Don’t explode complex shapes
ToolHolesModeOmitLinkbooleanHole mode Extract holes as polygons; legacy label: Omit cut-lines in re-entrant polygons. See Merge Hole Output Modes

GDSII Options (examples)

OptionTypeDescription
GdsOutDbScalingUnitsintegerDatabase units
GdsOutDbScalingValuerealDatabase scaling value
GdsInIgnoreTextbooleanSkip text elements on import

Gerber Options (examples)

OptionTypeDescription
GbrInUnitsintegerImport units
GbrOutDecimalsintegerOutput decimal places
GbrOutAbsCoordinatebooleanUse absolute coordinates

Example: GDS to DXF Conversion

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

Example: Gerber Import with Tools

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

How Sessions Relate to Command Files

Session files and command files use the same .lsn format, and LinkCAD 10 session files work unchanged. When you save a session in the GUI, LinkCAD writes all currently recorded options to the file. Loading a session in the GUI and passing it with --config apply it the same way. See Sessions for more about session management.