circuit/block-diagram drawing

不问归期 提交于 2019-11-30 08:55:00

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.

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

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

sfinnie

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.

I don't know of any tool that is a clear winner for easily making nice block diagrams with a minimum of manual labor. Some of the best looking results I've seen have been from TikZ. Check out the examples here:

I have been getting very good results from Draw.io. It is a webapp but has a pretty powerful diagram editor and some decent stock symbol libraries. Drawings can be exported as PNG or SVG so can be publication quality and they link up to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!