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 from PyPI (Recommended for stable releases)

pip install ltspice-to-svg

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

ltspice_to_svg your_schematic.asc

Option 2: Install from GitHub (For latest development version)

If you want the latest features and changes that haven't been released to PyPI yet:

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

Option 3: 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.

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 3.0 --dot-size 2.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

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run the tests to ensure everything works (python -m pytest)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Please make sure your code follows the existing style and includes appropriate tests for new features.

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.2.0.tar.gz (53.3 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.2.0-py3-none-any.whl (43.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ltspice_to_svg-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2a1a08bce9597b63866d6d50c9f5a304628f9615d4d66ea0b3dac2802373b500
MD5 f17c8aca137d85ff07571dabe5b6b29d
BLAKE2b-256 999bb6f38eed610a577a3b14e83f589e66934a3e05328df53a67d7688f25a0be

See more details on using hashes here.

Provenance

The following attestation bundles were made for ltspice_to_svg-0.2.0.tar.gz:

Publisher: publish.yml on Jianxun/ltspice_to_svg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

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

File hashes

Hashes for ltspice_to_svg-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 002ed9727f55aab684bfde2bed8889c586f37021c5de1cae644656a452c4d91c
MD5 27d43bd5d8f460f3fffa810f90ac3f05
BLAKE2b-256 347c68b9539dbb178ce2b05fef151ab0527b2c35010642e36c43de638ddc3be4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ltspice_to_svg-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Jianxun/ltspice_to_svg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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