LES

LayoutEditor Schematic

LES (.les) is the native schematic file format of the SchematicEditor. One LES file can hold an entire design: multiple sheets, their placements, wires, ports, annotation graphics, and—when hierarchy is used—embedded component definitions (symbols, parameters, netlist/model templates, layout recipes) via sheetComponent / SubComponent.

Reusable shared libraries remain in LEL. LES stores sheet content plus, for hierarchy, self-contained copies of internal components.

LES looks like XML but is a custom tag format: many tags are opening-only (no closing tag), attribute order is fixed, and parsing is done by string search—not by a general XML parser. Prefer files written by File → Save; when editing by hand, keep a backup and reopen in the SchematicEditor to validate.

Open and Save

Open (File → Open)
  • The file is read as UTF-8.
  • Every <LayoutEditorSchematic></LayoutEditorSchematic> block is scanned; inside it, every <Sheet …> is loaded.
  • Sheets are loaded in file order. Embedded SubComponent definitions must therefore appear before any placement that references them (Save enforces this).
  • If a sheet name already exists in the editor and is non-empty, that sheet is removed/replaced and the file content is loaded under the same name.
  • The first sheet of the file fills the current empty sheet when possible; further sheets are added to the sheet list.
  • External library components referenced by placements must already be loaded (or resolvable); missing components are kept via a fallback with injected name / lib parameters. Internal components (-internal-) are created from preceding SubComponent blocks in the same file.
Save (File → Save / Save As)
  • Writes a single UTF-8 LES file with one root <LayoutEditorSchematic> containing all sheets of the current schematic.
  • Sheets are written in dependency order: a sheet that defines an internal sheetComponent is saved before any sheet that places that component. Parent sheets that still need an unsaved internal dependency are deferred until the dependency is written.
  • If an internal component is still referenced but its original sheet no longer exists, Save synthesizes a minimal <Sheet componentName> that contains only the embedded <SubComponent> definition so the hierarchy remains loadable.
  • Shared library components are not duplicated into LES; placements store componentName + libraryBase. Only internal hierarchy (-internal-) or a Link to an external sheet component is embedded.

What a LES file can contain

Content How it appears
Multiple sheets Multiple <Sheet name> blocks in one file
Placements <Component>, <Instance>, <VectorInst>
Connectivity <Wire>, <Bus>, <Port>, <Busport>, <LabelWire>, <Ground>
Drawing (non-electrical) <Line>, <Polygon>, <Circle>, <Rect>, <Arc>, <Text>
Hierarchy / sheet as component Sheet owns a sheetComponent; saved as <SubComponent> inside that sheet; parents place it with library -internal-
Symbols inside the schematic Inside <SubComponent><Symbol index> (same graphics tags as LEL symbols)
Link to external library component as sheet interface <SubComponent> containing only <Link comp …>

Encoding

Field values that are encoded with putString / decoded with getString use these replacements (same idea as LEL):

Character / value Stored form
space &sp;
< &lt;
> &gt;
" &quote;
' &rsquo;
newline &newline;
empty string &nbsp;

Applies to names, library names, port/text/label strings, instance parameter names/values, link fields, and similar single-token fields.

Not entity-encoded (written as raw multi-line text): bodies of Description, Layout, Label, Netlist, Model, ExtractionParameter, ExtractionDeviceParameter.

Colors on graphic tags: the special name wire means the current schematic wire color; otherwise a Qt named color is used (typically #rrggbb).

Coordinates are integers in schematic units. Point lists are space-separated x y pairs.


Description of the LES File Format

Root structure

<LayoutEditorSchematic>
<Sheet sheetName>
  … sheet elements …
  … optional SubComponent …
</Sheet>
<Sheet otherSheet>
  …
</Sheet>
</LayoutEditorSchematic>

<LayoutEditorSchematic>

Root container of a LES file.

  • Fields after the tag name: none.
  • Body: one or more <Sheet> blocks (and only those are used on open).
  • Open / Save: both. Save always emits exactly one root wrapper around all sheets of the design.
  • Extra text outside sheets inside the root is ignored for sheet loading.

<Sheet sheetName>

One circuit sheet.

  • Fields: sheetName — text between Sheet and > (trimmed). This is the sheet title shown in the SchematicEditor. Save writes it without entity encoding; avoid ambiguous special characters in hand-edited names.
  • Body: zero or more sheet elements (see below), then optionally exactly one logical SubComponent association for this sheet’s sheetComponent.
  • Open / Save: both.
  • Behavior: On open, if a sheet with the same name already exists and is non-empty, it is removed and replaced. Sheet order in the file matters for resolving -internal- components.

Sheet elements — connectivity and placements

<Wire x1 y1 [x2 y2 …]>

Electrical wire polyline.

  • Fields: even-length list of integer coordinates forming the path.
  • Body: none (opening-only tag).
  • Open / Save: both.
  • Example: <Wire 0 136 18 136>

<Bus x1 y1 [x2 y2 …]>

Bus polyline (multi-bit connection).

  • Fields: same as Wire — point list.
  • Body: none.
  • Open / Save: both.
  • Note: the reader’s Bus search also matches the prefix of Busport; tags whose remaining field text starts with port are skipped here and handled by Busport.

<Port x y name [global|local] [type] [symbolName]>

Sheet hierarchy pin (scalar port).

  • Fields (in order):
    1. x, y — position
    2. name — encoded port name
    3. optional global — marks a global port; if type/symbol follow and the port is not global, Save writes the placeholder local
    4. optional type — encoded port type
    5. optional symbolName — encoded alternate symbol name for the port graphic
  • Body: none.
  • Open / Save: both.
  • Examples: <Port 142 -6 out>, <Port 0 -22 VDD global>

<Busport x y name [type] [symbolName]>

Sheet bus port.

  • Fields: x, y, encoded name, then optional encoded type and symbolName.
  • Body: none.
  • Open / Save: both.
  • Bus names may use bus expansion syntax (ranges / comma-separated names); names like A[3:0] style conventions follow the SchematicEditor bus rules.

<Ground x y>

Ground marker / ground connection helper at a point.

  • Fields: x, y.
  • Body: none.
  • Open / Save: both.

<LabelWire x y [labelOffsetX labelOffsetY] [fontSize] name>

Named net label (Label Node) at a position.

  • Fields:
    1. x, y — attachment / base position
    2. optional labelOffsetX labelOffsetY — written when the offset is non-zero or a non-zero font size is used
    3. optional fontSize — written only when non-zero
    4. name — encoded net name (always last)
  • Body: none.
  • Open / Save: both.
  • Example: <LabelWire 337 -28 out>

<Component x y labelOffX labelOffY angle mirror componentName libraryName […more placements…]></Component>

Placement of a library or internal component.

  • Fields for the first (or only) symbol placement:
    1. x, y — position
    2. labelOffX, labelOffY — instance label offset
    3. angle — rotation in degrees (as written by Save)
    4. mirror0 or 1 (mirror about X as used by the writer)
    5. componentName — encoded component type name
    6. libraryName — encoded library base name; use -internal- for hierarchical components defined in this LES file
  • Additional symbols: if the component has multiple symbols, Save appends further groups of six numbers (x y labelOffX labelOffY angle mirror) without repeating name/library.
  • Body: lines of parameter=value (encoded). Save always writes devicename=… first, then other instance parameters.
  • Open / Save: both.
  • Unresolved components load as a fallback device with parameters name and lib set to the missing identity.

Example:

<Component 48 136 -15 7 0 0 INV openCellLibrary>
devicename=L4
output=X1
</Component>

Hierarchical use of a sheet component:

<Component -119 140 -16 6 0 0 delay -internal->
devicename=sub1
</Component>

<Instance></Instance>

Alternate placement form used when a placement has a non-empty port vector map (bus-port remapping).

  • Fields on <Instance>: none.
  • Body:
    • <InstComponent …> — same field list and name=value body as <Component>, closing </InstComponent>
    • zero or more <InstPort portName connectionName> — opening-only; encoded port name and mapped connection name (written for bus ports)
  • Open / Save: both (Save uses this instead of bare <Component> when port vectors exist).

<InstComponent …> / <InstPort …>

See <Instance>. Same placement grammar as <Component>; InstPort is opening-only.

<VectorInst startIndex endIndex></VectorInst>

Vector / array instance of a component over an inclusive index range.

  • Fields: startIndex, endIndex (integers).
  • Body:
    • <VectorComponent …> — same as <Component> placement + parameter body
    • zero or more <VectorPort portName connectionName> — opening-only bus/port mapping for the vector
  • Open / Save: both.

<VectorComponent …> / <VectorPort …>

See <VectorInst>.


Sheet elements — non-electrical graphics

These draw on the sheet but are not wires/buses. Field patterns match the same primitives inside symbols.

<Line x1 y1 [x2 y2 …] color>

Polyline graphic.

  • Fields: point list, then color (wire or #rrggbb / named color).
  • Body: none.
  • Open / Save: both.

<Polygon x1 y1 [x2 y2 …] color>

Filled polygon. New polygons are normally closed by repeating the first point at the end.

  • Fields: point list, then color.
  • Body: none.
  • Open / Save: both.

<Circle x1 y1 x2 y2 color>

Circle defined by opposing corners of its bounding box.

  • Fields: two corners, then color.
  • Body: none.
  • Open / Save: both.

<Rect x1 y1 x2 y2 color>

Axis-aligned rectangle by two opposing corners.

  • Fields: two corners, then color.
  • Body: none.
  • Open / Save: both.

<Arc x1 y1 x2 y2 x3 y3 [more pairs…] color>

Arc. Geometry is defined by points (center / start / end style as used by the schematic arc element); Save writes the point array plus color.

  • Fields: point list (at least three points in practice), then color.
  • Body: none.
  • Open / Save: both.

<Text x y size [rotation] color text>

Annotation text.

  • Fields:
    1. x, y
    2. size — always written (may be 0)
    3. optional rotation — degrees; written only if non-zero
    4. color
    5. text — encoded string
  • Body: none.
  • Open / Save: both.

Hierarchy: sheetComponent and <SubComponent>

A sheet may be turned into a reusable hierarchical component (Use As Component). That association is the sheet’s sheetComponent:

  • On Save, if the sheet component is internal (-internal-), the full component definition is written inside the sheet as <SubComponent name>…</SubComponent> (same content as a LEL <Component>, with the outer tag renamed).
  • Parent sheets place it with <Component … name -internal->.
  • If the sheet is linked to a library component (not internal), Save writes a short form:
<SubComponent sheetComponentName>
<Link comp componentName libraryBase>
</SubComponent>

On open, Link resolves sheetComponent to the existing library component instead of embedding a full definition.

Save ordering guarantees that the sheet (or synthetic sheet) that defines an internal SubComponent appears in the file before placements that use it.

<SubComponent name></SubComponent>

Embedded component definition or link, stored inside a <Sheet>.

  • Fields: encoded component name (the internal/hierarchical type name).
  • Body: either a full component definition (tags below) or a Link (and optionally reduced linked content).
  • Open / Save: both.
  • On open, the definition is registered as an internal component (or linked); the sheet’s sheetComponent pointer is set accordingly.

Tags inside <SubComponent> (embedded component)

These tags are the same family used in LEL component definitions. In LES they appear when hierarchy embeds a full symbol/netlist definition.

<Description></Description>

Free-text description of the component (raw text, not entity-encoded).

  • Open / Save: both.

<Parameter></Parameter>

Parameter declarations for the component type.

  • Body: one or more declaration lines (pseudo-tags), each optionally followed by option lines until the next <…> declaration:
Declaration Meaning
<string name [default]> String parameter; optional encoded default
<int name [default]> Integer parameter (reader also accepts legacy integer; writer uses int)
<double name [default]> Floating-point parameter
<list name value1 value2 …> Choice list; values encoded. With pcbPackage=true, list contents come from the PCB catalog at runtime

Option lines (plain text, not XML tags), attached to the preceding declaration:

Option Meaning
callback=… Callback identifier/script hook
unit=… Unit label
info=… Help / info text
edit=… Edit policy / UI hint
display=… Display hint
parse=true Value is a formula/expression to parse (true / True / TRUE / t)
parseAsNum=false Do not force numeric parse (false / False / FALSE / f)
multiplier=true Multiplier-style parameter
pcbPackage=true Parameter selects a PCB package from the catalog
  • Open / Save: both.

<Layout></Layout>

Layout recipe text for schematic-driven layout (raw multi-line recipe: cell/OA/ignore rules, etc.).

  • Open / Save: both.
  • Binary layout geometry is not stored in LES; only this recipe text (and later cell references as configured by the recipe).

<Prefix prefix>

Device-name prefix used when generating instance names / netlists.

  • Fields: encoded prefix. Linked components may use _ when the prefix is empty.
  • Body: none (opening-only).
  • Open / Save: both.

<Label></Label>

Label template shown next to placements (raw text; may contain $devicename, $value, other $parameters).

  • Open / Save: both.

<Symbol [index]></Symbol>

One symbol graphic for the component.

  • Fields: optional integer index (symbol slot; writer uses 0, 1, …). Empty field is treated as index 0.
  • Body: symbol primitives, one opening tag per line (see next section).
  • Open / Save: both. Multiple Symbol blocks are allowed for multi-symbol components.
  • If a component has no symbols, Save may emit an empty <Symbol> pair.

<Offsetlabel angle offsetX offsetY>

Default label offset for a given placement angle.

  • Fields: angle (degrees key), offsetX, offsetY.
  • Body: none. Save omits zero offsets.
  • Open / Save: both.

<netlistFromSchematic/>

Self-closing marker. When present, netlist/model data for hierarchy are generated from the schematic content of the defining sheet.

  • Open / Save: both (Save emits it when the flag is set on the sheet component).

<Netlist formatName></Netlist>

Netlist template for a named format (e.g. spice, hspice, spectre).

  • Fields: formatName (not entity-encoded as a whole token in the usual writer path; keep simple identifiers).
  • Body: raw template text ($devicename, $node(port), …).
  • Open / Save: both. Repeated once per format.

<Model formatName></Model>

Model / subcircuit template for a named format.

  • Fields / body: same idea as Netlist.
  • Open / Save: both.

<Extraction method></Extraction>

Device extraction configuration.

  • Fields: method name.
  • Body: nested parameter blocks (below).
  • Open / Save: both (only written if a method is set).

<ExtractionParameter></ExtractionParameter>

Raw extraction parameter text inside Extraction.

<ExtractionDeviceParameter></ExtractionDeviceParameter>

Raw device-parameter text inside Extraction.

<Proc formInitProc doneProc>

Optional macros/procedures: form-init and done handlers.

  • Fields: two encoded names/paths.
  • Body: none. Written only if at least one is non-empty.
  • Open / Save: both.

<OaStoreLayoutOnly true|false>

OpenAccess option: store layout only.

  • Fields: true or false.
  • Body: none.
  • Open: supported. Save in LES: not normally emitted by the standard schematic Save path (used on the OA-specific component write path); still documented because the reader accepts it inside embedded definitions.

<Link comp componentName libraryBase>

Links the sheet’s sheetComponent to an existing library component instead of embedding a full definition.

  • Fields: literal type token comp, then encoded componentName, then encoded libraryBase.
  • Body: none (opening-only inside SubComponent).
  • Open / Save: both (Save uses this for non-internal sheet components).

In full LEL-style linked components, Link may appear together with Parameter / Prefix; the LES sheet association form typically writes the short SubComponent+Link variant shown above.


Symbol primitives inside <Symbol>

Parsed line-by-line. Supported tags (same field rules as the sheet graphics / ports of the same name):

Tag Role inside a symbol
<Line …> Graphic polyline
<Polygon …> Filled polygon
<Circle …> Circle
<Rect …> Rectangle
<Arc …> Arc
<Text …> Text
<Port …> Symbol pin (supports global / type / symbolName)
<Busport …> Symbol bus pin

Not loaded inside Symbol: Wire, Bus, Ground, LabelWire, placements, SubComponent.

Example fragment:

<Symbol>
<Rect -40 -7 40 7 wire>
<Port -50 0 in>
<Line -50 0 -40 0 wire>
<Text -50 0 wire in>
<Port 50 0 out>
</Symbol>

Minimal examples

Flat schematic
<LayoutEditorSchematic>
<Sheet main>
<Component 0 0 0 0 0 0 INV openCellLibrary>
devicename=I1
</Component>
<Port -40 0 in>
<Port 40 0 out>
<Wire -40 0 -20 0>
<Wire 20 0 40 0>
</Sheet>
</LayoutEditorSchematic>
Two sheets with hierarchy (sketch)
<LayoutEditorSchematic>
<Sheet delay>
… child schematic graphics / ports …
<SubComponent delay>
<Description>
created from sheet 'delay'
</Description>
<Parameter>
</Parameter>
<Layout>
[ignore]
*
</Layout>
<Prefix sub>
<Label>
delay
$devicename
</Label>
<Symbol>
… pins and drawing …
</Symbol>
<netlistFromSchematic/>
… optional Netlist / Model …
</SubComponent>
</Sheet>
<Sheet main>
<Component 0 0 0 0 0 0 delay -internal->
devicename=sub1
</Component>
…
</Sheet>
</LayoutEditorSchematic>

Child/SubComponent sheets are saved before parents that instantiate them.


Relation to other formats

Format Role vs LES
LEL Shared reusable component libraries (symbols + recipes). LES references them by name/library.
LTspice / xschem / Qucs / KiCad / Eagle / EDIF Imported or opened via converters; everyday native Save for SchematicEditor work is LES.

Hand-editing tips

  • Round-trip a Save from the SchematicEditor before inventing new field orders.
  • Do not reorder Component numeric fields; angle/mirror semantics follow the writer/reader pair.
  • Keep one logical sheet change per edit when merging.
  • Prefer putting shared cells in LEL so LES files stay small; use SubComponent for design-local hierarchy.