Package: ltspice2svg
ltspice2svg 2021.6Many 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 DeveloperThis 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.FeaturesThe following attributes of SVG drawing can be manipulated from defaults. With syntax written along with.Color of different parts of SchematicFunction called 'colour' can be used to manipulate the colors.Color variableDefault ValueDescriptionsymbColor#000000Color of stroke of basic shapes viz. Rectangle, Circle, Line and Arc used for making Symbols or ComponentssymbTextColor#42f5aaColor of text used for making Symbols or ComponentssymbAttrColor#f59e42Color of attributes of Symbols or ComponentssymbPinColor#8742f5Color of pin symbols of Symbols or Components, here circle is used to represent itsymbFillColor#fff9ebColor of rectangle fill color used to make Symbols or ComponentsflagColor#77fc03Color of Text flagsgndColor#fc0352Color of GROUND/GND symbolcomColor#03bafcColor of COMMON/COM symbolwireColor#524e63Color of wiresintsecColor#0000ffColor of junctions symbols, here square is used to represent ittextColor#eb3464Color of Text/CommentbusTapColor#ec03fcColor of bus tapsSyntax: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:VariableDefault ValueDescriptionisBWFalseIf 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 propertiesFunction called 'setFont' can be used to manipulate the font properties.VariableDefault ValueDescriptionfontSize12Font size of Text/Comments in ptfontWeight"bold"Font weight of Text/Comments/FlagsfontFamily"Tahoma"Font family of Text/Comments/FlagsflagFontSize10Font size of Flag texts in ptpinFontSize6Font size for pin text in ptpinFontWeight"normal"Font weight for pin textpinFontFamily"Arial"Font family for pin textSyntax: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:ArialBahnschriftCalibriCambriaCandaraComic Sans MSConsolasConstantiaCorbelCourier NewEbrimaFranklin Gothic MediumGabriolaGadugiImpactInk FreeJavanese TextLeelawadee UILucida ConsoleMalgun GothicMicrosoft HimalayaMongolian BaitiMS GothicMV BoliMyanmar TextNirmala UISegoe PrintSimSunSitka TextSylfaenTahomaTimes New RomanTrebuchet MSPen propertiesFunction called 'setPen' can be used to manipulate the pen.VariableDefault ValueDescriptionlineWidth0.3Width of stroke of basic shapesISside4Junction square side in ptPPradius2Pin circle radius in ptSyntax: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 SVGSVG 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')