Skip to main content

Converting LTspice file to SVG

Project description

ltspice2svg 2021.6

Many times engineers need high resolution images of LTspice schematics. Specially in case of large schematics, the inbuilt option of 'Copy to Clipboard' picks up raster images which are uneasy to use. Also in case of using schematics in Documents, the raster images are not good to render.

This tool can be used to convert LTspice schematic .asc files to SVG files, which can then be fine tuned for beautiful schematics.

Words of Developer

This is the first version of this library, however being frank to users, this version is not able to detect the GND, COM, directional flag envelopes and flag directions. I would appreciate any developer from any community who wants to contribute to this project.

Being a graduation student, I am unable to work over it for long. I will try to release next version having the above features as soon as possible.

Features

The following attributes of SVG drawing can be manipulated from defaults. With syntax written along with.

Color of different parts of Schematic

Function called 'colour' can be used to manipulate the colors.

Color variable Default Value Description
symbColor #000000 Color of stroke of basic shapes viz. Rectangle, Circle, Line and Arc used for making Symbols or Components
symbTextColor #42f5aa Color of text used for making Symbols or Components
symbAttrColor #f59e42 Color of attributes of Symbols or Components
symbPinColor #8742f5 Color of pin symbols of Symbols or Components, here circle is used to represent it
symbFillColor #fff9eb Color of rectangle fill color used to make Symbols or Components
flagColor #77fc03 Color of Text flags
gndColor #fc0352 Color of GROUND/GND symbol
comColor #03bafc Color of COMMON/COM symbol
wireColor #524e63 Color of wires
intsecColor #0000ff Color of junctions symbols, here square is used to represent it
textColor #eb3464 Color of Text/Comment
busTapColor #ec03fc Color of bus taps

Syntax:

colour( isBW=False, symbColor="#000000", symbTextColor="#42f5aa", symbAttrColor="#f59e42", symbPinColor="#8742f5", symbFillColor="#fff9eb", flagColor="#77fc03", gndColor="#fc0352", comColor="#03bafc", wireColor="#524e63", intsecColor="#0000ff", textColor="#eb3464", busTapColor="#ec03fc")

Example:

from ltspice2svg import *
colour (gndColor ="#20fc03", comColor ="#00bbff")

There is a special variable in colour settings described as follows which holds a special importance:

Variable Default Value Description
isBW False If isBW is set to True then all colors are set to Black, hence generating Black and White SVGs.

For all color variables any valid hex-coded color value is acceptable, wheras for isBW only Boolean values are accepted.

Font properties

Function called 'setFont' can be used to manipulate the font properties.

Variable Default Value Description
fontSize 12 Font size of Text/Comments in pt
fontWeight "bold" Font weight of Text/Comments/Flags
fontFamily "Tahoma" Font family of Text/Comments/Flags
flagFontSize 10 Font size of Flag texts in pt
pinFontSize 6 Font size for pin text in pt
pinFontWeight "normal" Font weight for pin text
pinFontFamily "Arial" Font family for pin text

Syntax:

setFont (fontSize=12, fontWeight="bold", fontFamily="Tahoma", flagFontSize=10, pinFontSize=6, pinFontWeight="normal", pinFontFamily="Arial")

Example:

from ltspice2svg import *
setFont (fontSize =12, pinFontWeight ='Normal', fontFamily ="SimSun")

For all font sizes any integer value from 1 to 144 are acceptable. Font weight can be either 'Normal' or 'Bold'. Also font family can be any font from those mentioned below:

Arial Bahnschrift Calibri Cambria Candara
Comic Sans MS Consolas Constantia Corbel Courier New
Ebrima Franklin Gothic Medium Gabriola Gadugi Impact
Ink Free Javanese Text Leelawadee UI Lucida Console Malgun Gothic
Microsoft Himalaya Mongolian Baiti MS Gothic MV Boli Myanmar Text
Nirmala UI Segoe Print SimSun Sitka Text Sylfaen
Tahoma Times New Roman Trebuchet MS

Pen properties

Function called 'setPen' can be used to manipulate the pen.

Variable Default Value Description
lineWidth 0.3 Width of stroke of basic shapes
ISside 4 Junction square side in pt
PPradius 2 Pin circle radius in pt

Syntax:

setPen (lineWidth=0.3, ISside=4, PPradius=2)

Example:

from ltspice2svg import *
setPen (width =0.6)

All three parameters can be Float or Integer value with stroke width, junction square side, pin circle radius from 0 to 5, 1 to 20 and 1 to 20 respectively.

Drawing SVG

SVG can be drawn using 'draw' function with attributes set (as described above). If none attribute is set, then default values are used. Syntax:

draw (spiceFileAddress, saveAddress)

Example:

from ltspice2svg import *
draw (r'starter.asc', r'schematic.svg')

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

ltspice2svg-2021.6.tar.gz (1.8 MB view details)

Uploaded Source

File details

Details for the file ltspice2svg-2021.6.tar.gz.

File metadata

  • Download URL: ltspice2svg-2021.6.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for ltspice2svg-2021.6.tar.gz
Algorithm Hash digest
SHA256 786fb142bd5d976c13f753e721c5f3fa46baee9cdc07ee3cf8282af8abc78ae5
MD5 0afa128d8c5a830f804cf7eae7a8eac4
BLAKE2b-256 50b891135c52aa96e4c6ffcbc809174ac070887f56c218288bc21d655091e887

See more details on using hashes here.

Supported by

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