windows – Tool to programmatically draw logic circuits into PDF


I would suggest taking a look at SchemDraw which is a python package which:

  • can output results in svg, eps, or pdf,
  • allows you to define your own components,
  • is cross platform, (including windows),
  • is free, gratis & FOSS
  • source code repository available
  • Examples gallery
  • Supports the use of Fritzing parts as here.
  • Runs on Windows, Linux, Mac & just about anywhere Python runs
  • Can be run in a Jupyter Notebook
  • Can output to any of the formats svg, eps, png, pdf, and jpg providing matplotlib supports all of them on your platform.

You can either create the diagrams directly from python or you can define your own format for storing the information and parse it in.

Some examples from the gallery:

Two different ways of representing an NE555 LED Blinker curcuit.

import schemdraw

with schemdraw.Drawing() as d:
    d.config(fontsize=12)
    T = (elm.Ic()
         .side('L', spacing=1.5, pad=1.5, leadlen=1)
         .side('R', spacing=2)
         .side('T', pad=1.5, spacing=1)
         .pin(name="TRG", side="left", pin='2')
         .pin(name="THR", side="left", pin='6')
         .pin(name="DIS", side="left", pin='7')
         .pin(name="CTL", side="right", pin='5')
         .pin(name="OUT", side="right", pin='3')
         .pin(name="RST", side="top", pin='4')
         .pin(name="Vcc", side="top", pin='8')
         .pin(name="GND", side="bot", pin='1')
         .label('555'))
    BOT = elm.Ground().at(T.GND)
    elm.Dot()
    elm.Resistor().endpoints(T.DIS, T.THR).label('Rb').idot()
    elm.Resistor().up().at(T.DIS).label('Ra').label('+Vcc', 'right')
    elm.Line().endpoints(T.THR, T.TRG)
    elm.Capacitor().at(T.TRG).toy(BOT.start).label('C')
    elm.Line().tox(BOT.start)
    elm.Capacitor().at(T.CTL).toy(BOT.start).label(r'.01$\mu$F', 'bottom').dot()
    elm.Dot().at(T.DIS)
    elm.Dot().at(T.THR)
    elm.Dot().at(T.TRG)
    elm.Line().endpoints(T.RST,T.Vcc).dot()
    elm.Line().up(d.unit/4).label('+Vcc', 'right')
    elm.Resistor().right().at(T.OUT).label('330')
    elm.LED().flip().toy(BOT.start)
    elm.Line().tox(BOT.start)

555 Blinker

You can even create pictorial elements, e.g. the above as a breadboard layout:

import schemdraw
from schemdraw import pictorial

elm.Line.defaults['lw'] = 4

with schemdraw.Drawing():
    bb = pictorial.Breadboard().up()
    pictorial.DIP().up().at(bb.E5).label('555', color="#DDD")
    elm.Line().at(bb.A8).to(bb.L1_7)
    elm.Line().at(bb.J5).to(bb.R1_4)
    elm.Line().at(bb.A5).to(bb.L2_4).color('black')
    pictorial.Resistor(330).at(bb.B7).to(bb.B12)
    pictorial.LED(lead_length=.3*pictorial.INCH).at(bb.C12)
    elm.Line().at(bb.A13).to(bb.L2_13).color('black')
    pictorial.Resistor(520).at(bb.G6).to(bb.G3)
    pictorial.Resistor(520).at(bb.J6).to(bb.R1_10)
    elm.Line().at(bb.H3).to(bb.H7).color('green')
    elm.Wire('c').at(bb.G7).to(bb.D6).linewidth(4).color('green')
    elm.Line().at(bb.H8).to(bb.H12).color('green')
    elm.Line().at(bb.J13).to(bb.R2_14).color('black')
    pictorial.CapacitorMylar(lead_length=.2*pictorial.INCH).at(bb.I12)
    elm.Line().at(bb.C6).to(bb.C3).color('green')
    pictorial.CapacitorMylar(lead_length=.2*pictorial.INCH).at(bb.D2)
    elm.Line().at(bb.A2).to(bb.L2_1).color('black')

555 Breadboard



Source link

Related Posts

About The Author

Add Comment