circuit/block-diagram drawing

12,027

Solution 1

To make production quality circuit diagrams as well as block diagrams, I strongly recommend J. D. Aplevich's "circuit macros". It's well documented and actively maintained. See the examples produced by this package circuit macros examples

There is some learning curve, for example to be able to use the "dpic" graphing language to draw your own diagram. But the tool itself is very powerful.

For me there are two remaining issues:

  1. no live update
  2. svg output is lacking

I hacked up some Javascript to

(watch m4 file change)->[m4->dpic->latex->pdf]->svg->(show in html)

Here is the gist of it

// watch .m4 file

var chokidar = require('chokidar');
var resolve = require('path').resolve;
const touch = require('touch')
const {exec} = require('child_process')

chokidar.watch("*.m4").on('change', fn=>{
   let ff = resolve(fn)
   console.log(ff, "changed")
   exec("runtask.bat " + ff, {cwd:"../"}, (err,stdin,stdout)=>{
    console.log(err,stdin, stdout)
    touch("index.html") //svg updated
    })

})

Here is the runtask.bat for Windows

m4 pgf.m4 %1 | dpic -g > tmp.tex

C:\texlive\2017\bin\win32\pdflatex template.tex

tool\dist-64bits\pdf2svg template.pdf %~dpn1.svg
tool\dist-64bits\pdf2svg template.pdf %~dp1tmp.svg

That way, you can "draw" by writing m4/dpic code and see the result in the browser live; and svg is generated from pdf which looks a lot nicer.

Solution 2

I am also using TikZ at the moment but you may wish to try http://blockdiag.com/

Solution 3

Here is one: http://www.physicsbox.com/indexsolveelec2en.html

Here is where to look for others:

http://www.freebyte.com/electronics/

www.educypedia.be/electronics/easoftsim.htm

Solution 4

There are alternatives to graphviz that may do the job - see e.g. infovis, protovis, tulip.

See also other related questions 1, 2, 3.

Can you explain where graphviz falls short? The only requirement you list that I'm not sure about is attaching to specific ports. I would have thought you might be able to solve that with composite shapes / subgraphs, but maybe not...?

EDIT: Another option, particularly if you're looking at software engineering diagrams. Have you considered the eclipse gmp toolkit? It's what's used to build e.g. the UML2 editor tools.

hth.

Share:
12,027

Related videos on Youtube

JCLL
Author by

JCLL

Updated on June 01, 2022

Comments

  • JCLL
    JCLL about 2 years

    I'm looking for either algorithms or visualization tool for (nice) circuit/block-diagram drawing.

    I am also interested in a general formulation of the problem.

    By "circuit drawing", I mean the capability of exploring place & route for block-diagrams (rectangles) with I/O ports and their connections (wires). These block-diagrams can be hierarchical i.e some blocks may have some nested internal sub-structure etc.

    This topic is strongly related to classical graph-drawing, with the supplemental constraint of the need to take ports location into account, and possibly the shape of the blocks (rectangle of various sizes). Graphviz tools do not respond to the problem (at least my previous experiments have not been satisfactory).

    Force-directed algorithms retain my attention, but I have just found papers on classical directed graphs.

    Any hints ?

    [update nov 21 2013] it seems that the best reference to date is Spönemann

  • JCLL
    JCLL about 13 years
    Thx, Inium, for the links. However I am looking for something more general than pure electronics. There are many area where block diagrams are needed, especially in software engineering.
  • JCLL
    JCLL about 13 years
    Concerning the problem with graphiz : I have not been able to manage the edges routing to turn the graph into something looking like a real engineer drawing (see example )
  • JCLL
    JCLL about 13 years
    Concerning Eclipse, well, I know GMF, but I am not sure it can help me explore algorithms for block-diagram drawing. Need to look at it again.
  • sfinnie
    sfinnie about 13 years
    Ah ok. No, graphviz won't do rectilinear layout. Not sure about the others. Another alternative however could be yworks (yworks.com). The library (yFiles) is not free however there is a free application (yEd) wrapping it that you can feed data into. Its rectilinear layout is pretty good (the editor provides templates for e.g. UML, BPMN). hth.
  • JCLL
    JCLL about 13 years
    Tikz was also my solution, as far as visualization is concerned. I also agree that there is still some labor needed (surprisingly) to design an automatic drawing for such block-diagrams.
  • nibot
    nibot about 13 years
    I have hope that Inkscape will become a good tool for this once the connector tool gets user-placeable connection points (wiki.inkscape.org/wiki/index.php/UsingTheConnectorTool).
  • nibot
    nibot about 13 years
  • Dilawar
    Dilawar almost 11 years
    Tikz rocks! It takes time to learn but you will love it. You can place the nodes at places you like. Once you have figured out the placement, rest will follow.