ltspice-to-svg


Nameltspice-to-svg JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/Jianxun/ltspice_to_svg
SummaryConvert LTspice schematics to SVG format
upload_time2025-08-06 01:21:05
maintainerNone
docs_urlNone
authorJianxun Zhu
requires_python>=3.6
licenseNone
keywords ltspice svg schematic circuit eda electronics
VCS
bugtrack_url
requirements svgwrite pytest sphinx sphinx_rtd_theme sphinx-markdown-tables sphinx-autodoc-typehints myst-parser
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](https://raw.githubusercontent.com/Jianxun/ltspice_to_svg/main/schematics/miller_ota_schematic.png)

into an SVG file like this:

![Miller OTA SVG Output](https://raw.githubusercontent.com/Jianxun/ltspice_to_svg/main/schematics/miller_ota.svg)

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)

```bash
pip install ltspice-to-svg
```

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

```bash
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:

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

### Option 3: Clone the repository and install

1. Clone the repository:
```bash
git clone https://github.com/Jianxun/ltspice_to_svg.git
cd ltspice_to_svg
```

2. Create and activate a virtual environment:
```bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
```

3. Install as a development package:
```bash
pip install -e .
```

## Usage

### Using the command-line tool (after pip installation)

```bash
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

```bash
# 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](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Jianxun/ltspice_to_svg",
    "name": "ltspice-to-svg",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "ltspice, svg, schematic, circuit, eda, electronics",
    "author": "Jianxun Zhu",
    "author_email": "zhujianxun.bupt@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/99/9b/b6f38eed610a577a3b14e83f589e66934a3e05328df53a67d7688f25a0be/ltspice_to_svg-0.2.0.tar.gz",
    "platform": null,
    "description": "# LTspice to SVG Converter\n\n## Overview\n\nThis 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.\n\nThe 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.\n\nThis will convert a schematic like this:\n\n![LTspice Miller OTA Schematic](https://raw.githubusercontent.com/Jianxun/ltspice_to_svg/main/schematics/miller_ota_schematic.png)\n\ninto an SVG file like this:\n\n![Miller OTA SVG Output](https://raw.githubusercontent.com/Jianxun/ltspice_to_svg/main/schematics/miller_ota.svg)\n\nNote: the IO pins are rendered with text outside of the pin shapes, which is an intentional design decision.\n\nThe output SVG is perfect for:\n- Publication-quality documentation\n- Web integration with perfect scaling\n- Further editing in vector graphics software\n- Professional presentations and reports\n\nYou get full control over the rendering through comprehensive command-line options (see the Usage section below).\n\n## Installation\n\n### Option 1: Install from PyPI (Recommended for stable releases)\n\n```bash\npip install ltspice-to-svg\n```\n\nAfter installation, you can use the command-line tool from anywhere:\n\n```bash\nltspice_to_svg your_schematic.asc\n```\n\n### Option 2: Install from GitHub (For latest development version)\n\nIf you want the latest features and changes that haven't been released to PyPI yet:\n\n```bash\npip install git+https://github.com/Jianxun/ltspice_to_svg.git\n```\n\n### Option 3: Clone the repository and install\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/Jianxun/ltspice_to_svg.git\ncd ltspice_to_svg\n```\n\n2. Create and activate a virtual environment:\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n```\n\n3. Install as a development package:\n```bash\npip install -e .\n```\n\n## Usage\n\n### Using the command-line tool (after pip installation)\n\n```bash\nltspice_to_svg your_schematic.asc\n```\n\nThis will generate `your_schematic.svg` in the same directory as your schematic file.\n\n\n### Command Line Options\n\n#### Basic Options\n- `--stroke-width`: Width of lines in the SVG (default: 2.0)\n- `--dot-size`: Size of junction dots relative to stroke width (default: 1.5)\n- `--base-font-size`: Base font size in pixels (default: 16.0)\n- `--margin`: Margin around schematic elements as percentage of viewbox (default: 10.0, can be set to 0 for tight fit)\n- `--font-family`: Font family for text elements (default: Arial)\n\n#### Text Rendering Options\n- `--no-text`: Master switch to disable ALL text rendering\n- `--no-schematic-comment`: Skip rendering schematic comments\n- `--no-spice-directive`: Skip rendering SPICE directives\n- `--no-nested-symbol-text`: Skip rendering text inside symbols\n- `--no-component-name`: Skip rendering component names (R1, C1, etc.)\n- `--no-component-value`: Skip rendering component values (10k, 1uF, etc.)\n- `--no-net-label`: Skip rendering net label flags\n- `--no-pin-name`: Skip rendering I/O pin text while keeping the pin shapes\n\n#### File Options\n- `--export-json`: Export intermediate JSON files for debugging\n- `--ltspice-lib`: Path to LTspice symbol library (overrides system default)\n\n## Post-Processing in Vector Graphics Editors\n\nOne 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:\n\n- **Adobe Illustrator**: Professional industry standard\n- **Inkscape**: Powerful free and open-source alternative\n\n### Example Commands\n\n```bash\n# Basic conversion\nltspice_to_svg myschematic.asc\n\n# Control visual style\nltspice_to_svg myschematic.asc --stroke-width 3.0 --dot-size 2.0\n\n# Adjust margins around schematic\nltspice_to_svg myschematic.asc --margin 5.0  # 5% margin for tighter fit\nltspice_to_svg myschematic.asc --margin 0.0  # No margin for exact bounds\n\n# Change font family\nltspice_to_svg myschematic.asc --font-family \"Helvetica\"\nltspice_to_svg myschematic.asc --font-family \"Courier New\"  # For monospace text\n\n# Disable certain text elements\nltspice_to_svg myschematic.asc --no-schematic-comment --no-net-label\n\n# For documentation with just components and wires\nltspice_to_svg myschematic.asc --no-text\n```\n\n## Contributing\n\nContributions are welcome! Here's how you can help:\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Make your changes\n4. Run the tests to ensure everything works (`python -m pytest`)\n5. Commit your changes (`git commit -m 'Add amazing feature'`)\n6. Push to the branch (`git push origin feature/amazing-feature`)\n7. Open a Pull Request\n\nPlease make sure your code follows the existing style and includes appropriate tests for new features.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Convert LTspice schematics to SVG format",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/Jianxun/ltspice_to_svg"
    },
    "split_keywords": [
        "ltspice",
        " svg",
        " schematic",
        " circuit",
        " eda",
        " electronics"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "347c68b9539dbb178ce2b05fef151ab0527b2c35010642e36c43de638ddc3be4",
                "md5": "27d43bd5d8f460f3fffa810f90ac3f05",
                "sha256": "002ed9727f55aab684bfde2bed8889c586f37021c5de1cae644656a452c4d91c"
            },
            "downloads": -1,
            "filename": "ltspice_to_svg-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "27d43bd5d8f460f3fffa810f90ac3f05",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 43615,
            "upload_time": "2025-08-06T01:21:03",
            "upload_time_iso_8601": "2025-08-06T01:21:03.998060Z",
            "url": "https://files.pythonhosted.org/packages/34/7c/68b9539dbb178ce2b05fef151ab0527b2c35010642e36c43de638ddc3be4/ltspice_to_svg-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "999bb6f38eed610a577a3b14e83f589e66934a3e05328df53a67d7688f25a0be",
                "md5": "f17c8aca137d85ff07571dabe5b6b29d",
                "sha256": "2a1a08bce9597b63866d6d50c9f5a304628f9615d4d66ea0b3dac2802373b500"
            },
            "downloads": -1,
            "filename": "ltspice_to_svg-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f17c8aca137d85ff07571dabe5b6b29d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 53288,
            "upload_time": "2025-08-06T01:21:05",
            "upload_time_iso_8601": "2025-08-06T01:21:05.871775Z",
            "url": "https://files.pythonhosted.org/packages/99/9b/b6f38eed610a577a3b14e83f589e66934a3e05328df53a67d7688f25a0be/ltspice_to_svg-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-06 01:21:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Jianxun",
    "github_project": "ltspice_to_svg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "svgwrite",
            "specs": [
                [
                    ">=",
                    "1.4.3"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "7.3.1"
                ]
            ]
        },
        {
            "name": "sphinx",
            "specs": [
                [
                    ">=",
                    "7.1.0"
                ]
            ]
        },
        {
            "name": "sphinx_rtd_theme",
            "specs": [
                [
                    ">=",
                    "1.3.0"
                ]
            ]
        },
        {
            "name": "sphinx-markdown-tables",
            "specs": [
                [
                    ">=",
                    "0.0.17"
                ]
            ]
        },
        {
            "name": "sphinx-autodoc-typehints",
            "specs": [
                [
                    ">=",
                    "1.23.0"
                ]
            ]
        },
        {
            "name": "myst-parser",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        }
    ],
    "lcname": "ltspice-to-svg"
}
        
Elapsed time: 1.69074s