Reference guide for adding LTspice symbols to the converter.

Quick Start

  1. Open converter.html in your browser
  2. Drag and drop your .asy file(s) into the converter
  3. Copy the JSON output
  4. Paste it into symbols.json
  5. Add aliases if needed

Method 1: Browser-Based Converter (Recommended)

1 Open the Converter

Open converter.html in any modern web browser. No installation or server needed!

2 Load Your Symbol File

Option A: Drag & Drop — Drag one or more .asy files directly onto the converter page.

Option B: Paste Content — Open your .asy file in a text editor, copy the entire contents, and paste into the left panel.

3 Convert to JSON

Click "Convert to JSON". The right panel will show the generated JSON definition and statistics (shapes, pins, symbol name).

Example output (paste-ready for symbols.json):

"opamp": {
  "shapes": [
    {"type": "line", "x1": -32, "y1": -32, "x2": 32, "y2": 0},
    {"type": "line", "x1": -32, "y1": 32, "x2": 32, "y2": 0},
    {"type": "line", "x1": -32, "y1": -32, "x2": -32, "y2": 32}
  ],
  "pins": [{"x": -32, "y": -16}, {"x": -32, "y": 16}, {"x": 32, "y": 0}],
  "nameOffset": {"x": 16, "y": -16},
  "valueOffset": {"x": 16, "y": 16}
}

4 Copy the JSON

Click "Copy JSON" to copy the output to your clipboard.

5 Add to symbols.json

The converter outputs paste-ready JSON, pre-indented to match the symbols.json format:

  1. Open symbols.json in your text editor
  2. Find the "symbols" section
  3. Add a comma after the last symbol entry's closing }
  4. Paste the converter output directly
  5. Save the file

6 Add Aliases (Optional)

Add common name variations to the "aliases" section so the symbol can be found by different names:

"aliases": {
  "opamp": "opamp",
  "OpAmp": "opamp",
  "OPAMP": "opamp",
  "opamp2": "opamp"
}

7 Test Your Symbol

  1. Open index.html in your browser
  2. Load a schematic that uses your new symbol
  3. Check that it renders correctly

Method 2: Command-Line Converter (Node.js)

If you have Node.js installed, you can use the CLI converter for batch processing.

Convert a Single File

node asy-to-json.js sym/opamp.asy > opamp.json

Convert Multiple Files

node asy-to-json.js sym/opamp.asy sym/opamp2.asy > opamps.json

Convert All Files in a Directory

Windows PowerShell:

node asy-to-json.js (Get-ChildItem sym\*.asy).FullName > all-symbols.json

Linux/Mac:

node asy-to-json.js sym/*.asy > all-symbols.json

Then manually copy the relevant symbols from the output file into symbols.json.

Method 3: Manual Conversion

For learning or fine-tuning, you can manually convert .asy files.

Understanding .asy File Format

A typical .asy file looks like this:

Version 4
SymbolType CELL
LINE Normal x1 y1 x2 y2
CIRCLE Normal x1 y1 x2 y2
ARC Normal x1 y1 x2 y2 xStart yStart xEnd yEnd
RECTANGLE Normal x1 y1 x2 y2
PIN x y orientation pinLength
WINDOW 0 x y alignment fontSize
WINDOW 3 x y alignment fontSize
SYMATTR Value R
SYMATTR Prefix R
SYMATTR Description A resistor

Convert Shapes

LINE Normal → line:

LINE Normal 0 16 32 16
↓
{"type": "line", "x1": 0, "y1": 16, "x2": 32, "y2": 16}

CIRCLE Normal → circle:

CIRCLE Normal 16 16 48 48
↓
Center: cx = (16+48)/2 = 32, cy = (16+48)/2 = 32
Radius: r = (48-16)/2 = 16
{"type": "circle", "cx": 32, "cy": 32, "r": 16}

RECTANGLE Normal → rect:

RECTANGLE Normal 0 0 32 64
↓
{"type": "rect", "x1": 0, "y1": 0, "x2": 32, "y2": 64}

ARC Normal → arcPoints:

ARC Normal 0 16 32 48 4 44 16 16
↓
{"type": "arcPoints",
 "x1": 0, "y1": 16, "x2": 32, "y2": 48,
 "xStart": 4, "yStart": 44, "xEnd": 16, "yEnd": 16,
 "forceLargeArc": false}
Important for arcs: You may need to manually adjust forceLargeArc to true for inductor-style coils or arcs that should take the longer path around the ellipse.

Extract Pins

PIN 16 0 NONE 0
PIN 16 96 NONE 0
↓
"pins": [{"x": 16, "y": 0}, {"x": 16, "y": 96}]

Extract Text Offsets

WINDOW 0 24 16 Left 2    ← InstName position
WINDOW 3 24 104 Left 2   ← Value position
↓
"nameOffset": {"x": 24, "y": 16},
"valueOffset": {"x": 24, "y": 104}

Shape Types Reference

Type Description Properties
line Straight line x1, y1, x2, y2
circle Circle cx, cy, r
rect Rectangle x1, y1, x2, y2
arcPoints Elliptical arc x1, y1, x2, y2, xStart, yStart, xEnd, yEnd, forceLargeArc

Troubleshooting

Arcs Look Wrong

Symptom: Arcs appear as small segments or face the wrong direction.

Solution: Adjust the forceLargeArc flag:

{"type": "arcPoints", ..., "forceLargeArc": true}

For inductor coils, ALL arcs typically need forceLargeArc: true.

Symbol is Offset from Wires

Symptom: Symbol doesn't align with wires at connection points.

Solution: Double-check pin coordinates match the .asy file exactly. Pins are the electrical connection points and must be precise.

Text in Wrong Position for Rotated Symbols

Symptom: Text overlaps symbol or appears on wrong side after rotation.

Solution: This should be handled automatically. If issues persist, verify the nameOffset and valueOffset match the WINDOW commands in the .asy file.

Symbol Not Found

Symptom: Schematic shows "Unknown symbol: xyz".

Solution: Add an alias entry in symbols.json:

"aliases": {
  "xyz": "my_symbol_name",
  "XYZ": "my_symbol_name"
}

Tips for Success

Always test with real schematics. Load a schematic that uses your new symbol to verify rendering.
Check all rotations. Test symbols in different orientations (R0, R90, R180, R270, M0, M90, M180, M270).
Use exact coordinates. Don't round or approximate values from the .asy file.
Add aliases. Include common variations of the symbol name (case variations, alternate names).