Skip to main content

Convert LTspice schematics to SVG format

Project description

LTspice to SVG Converter

Overview

This tool translates LTspice (https://www.analog.com/en/resources/design-tools-and-calculators/ltspice-simulator.html) circuit schematics (.asc files) into publication-grade SVG graphics. I created it because I was tired of redrawing circuits in Visio, Illustrator, or PowerPoint for documentation purposes. While these are powerful drawing tools, none of them are as fast or convenient as a dedicated schematic capture tool. This converter was born out of the necessity to generate clean, high-quality schematics that look better than screenshots.

The tool parses all the shapes, components, wires, and texts in an LTspice schematic and renders them into a structured SVG file. It automatically searches for the symbol definition files (.asy) and correctly renders them with proper orientation and mirroring.

This will convert a schematic like this:

LTspice Miller OTA Schematic

into an SVG file like this:

Miller OTA SVG Output

Note: the IO pins are rendered with text outside of the pin shapes, which is an intentional design decision.

The output SVG is perfect for:

  • Publication-quality documentation
  • Web integration with perfect scaling
  • Further editing in vector graphics software
  • Professional presentations and reports

You get full control over the rendering through comprehensive command-line options (see the Usage section below).

Installation

Option 1: Install directly from GitHub (Recommended)

pip install git+https://github.com/Jianxun/ltspice_to_svg.git

After installation, you can use the command-line tool from anywhere:

ltspice_to_svg your_schematic.asc

Option 2: Clone the repository and install

  1. Clone the repository:
git clone https://github.com/Jianxun/ltspice_to_svg.git
cd ltspice_to_svg
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install as a development package:
pip install -e .

Usage

Using the command-line tool (after pip installation)

ltspice_to_svg your_schematic.asc

This will generate your_schematic.svg in the same directory as your schematic file.

Alternative methods (if not installed with pip)

Using the shell script

./ltspice_to_svg.sh your_schematic.asc

Command Line Options

Basic Options

  • --stroke-width: Width of lines in the SVG (default: 2.0)
  • --dot-size: Size of junction dots relative to stroke width (default: 1.5)
  • --base-font-size: Base font size in pixels (default: 16.0)
  • --margin: Margin around schematic elements as percentage of viewbox (default: 10.0, can be set to 0 for tight fit)
  • --font-family: Font family for text elements (default: Arial)

Text Rendering Options

  • --no-text: Master switch to disable ALL text rendering
  • --no-schematic-comment: Skip rendering schematic comments
  • --no-spice-directive: Skip rendering SPICE directives
  • --no-nested-symbol-text: Skip rendering text inside symbols
  • --no-component-name: Skip rendering component names (R1, C1, etc.)
  • --no-component-value: Skip rendering component values (10k, 1uF, etc.)
  • --no-net-label: Skip rendering net label flags
  • --no-pin-name: Skip rendering I/O pin text while keeping the pin shapes

File Options

  • --export-json: Export intermediate JSON files for debugging
  • --ltspice-lib: Path to LTspice symbol library (overrides system default)

Post-Processing in Vector Graphics Editors

One of the advantages of generating SVG files is the ability to further refine them in vector graphics editors. The SVGs produced by this tool are structured logically with groups for different element types, making them easy to work with in editors like:

  • Adobe Illustrator: Professional industry standard
  • Inkscape: Powerful free and open-source alternative

Example Commands

# Basic conversion
ltspice_to_svg myschematic.asc

# Control visual style
ltspice_to_svg myschematic.asc --stroke-width 2.5 --base-font-size 14.0

# Adjust margins around schematic
ltspice_to_svg myschematic.asc --margin 5.0  # 5% margin for tighter fit
ltspice_to_svg myschematic.asc --margin 0.0  # No margin for exact bounds

# Change font family
ltspice_to_svg myschematic.asc --font-family "Helvetica"
ltspice_to_svg myschematic.asc --font-family "Courier New"  # For monospace text

# Disable certain text elements
ltspice_to_svg myschematic.asc --no-schematic-comment --no-net-label

# For documentation with just components and wires
ltspice_to_svg myschematic.asc --no-text

Contributing

See CONTRIBUTING.md for guidelines on contributing to this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ltspice_to_svg-0.1.0.tar.gz (47.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ltspice_to_svg-0.1.0-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

Details for the file ltspice_to_svg-0.1.0.tar.gz.

File metadata

  • Download URL: ltspice_to_svg-0.1.0.tar.gz
  • Upload date:
  • Size: 47.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ltspice_to_svg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 086fec55b76014a8e050b71ce9485fc180125040ff637a42d0930cde23afc861
MD5 e3433005e0c0a4b171342438edb6598b
BLAKE2b-256 a5e5507d5b1b3f36bf45d73cceb68ca60b4a046f35deea1cca467bb0cf153594

See more details on using hashes here.

File details

Details for the file ltspice_to_svg-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ltspice_to_svg-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ltspice_to_svg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 335d79545ee80f286dfa4db1cc13746059d068ca2ba83b50f6cdb8c1936cbfee
MD5 f09a1168a70a3fd02d1ba785357d1eea
BLAKE2b-256 04b75ef14263fa39758befd6e2fe8de3f901cc55d0afba7259d77ba533c75139

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page