A Welcome and Introduction to XCircuit

XCircuit: Quick Start

The frames version of the XCircuit website has a number of menu items down the left side. This page is accessed from the "Welcome" menu button. If you are looking to download the latest release, choose "Downloads". For compile and install instructions, choose "Install". For online tutorials, go to "Tutorial". For online documentation go to "Reference". Note that the TCL interpreter command-line reference is on a separate web page, although it can be found in the Table of Contents on the Reference web page. Similarly, the PostScript reference page outlining the file format used by XCircuit for saving pages is on a separate web page. Discussions about XCircuit are carried on the mailing list on opencircuitdesign.com.

XCircuit: An Introduction

There are drawing programs, and there are schematic capture programs. All schematic capture programs will produce output for inclusion in publications. However, these programs have different goals, and it shows. Rarely is the output of a schematic capture program really suitable for publication; often it is not even readable, or cannot be scaled. Engineers who really want to have a useful schematic drawing of a circuit usually redraw the circuit in a general drawing program, which can be both tedious and prone to introducing new errors.

XCircuit is a UNIX/X11 (and Windows, or Windows using Cygwin and the Cygwin X-Server) program for drawing publishable-quality electrical circuit schematic diagrams and related figures, and produce circuit netlists through schematic capture. XCircuit regards circuits as inherently hierarchical, and writes both hierarchical PostScript output and hierarchical SPICE netlists. Circuit components are saved in and retrieved from libraries which are fully editable. XCircuit does not separate artistic expression from circuit drawing; it maintains flexiblity in style without compromising the power of schematic capture.

XCircuit is flexible enough to be used as a generic program for drawing just about anything, and is competitive with powerful programs such as "xfig". It is especially good for any task requiring repeated use of a standard set of graphical objects, including architectural drawing, printed circuit board layouts, and (my personal favorite) music typography (see my Music Page for examples).

XCircuit screenshot. Click here for a full-view sample screen (43KB GIF grabbed using xv).

Click here for the sample screen showing the default circuit library page from xcircuit (22KB GIF grabbed using xv). Note that the end user can edit all objects, create new objects, and make personal object libraries.

XCircuit was written and is maintained by Tim Edwards, currently with MultiGiG, Inc., of San Jose, California (Tim lives in Maryland and works remotely). XCircuit started life in the summer of 1993 as a drawing program to render circuit diagrams for an undergraduate electrical engineering course in the Johns Hopkins University Whiting School of Engineering Part-time programs. Since then, it has expanded to encompass schematic capture and is used by people all over the world for both presentations and as an EDA (Electonic Design Automation) tool.

The Power of Programming Languages

XCircuit output is PostScript and only PostScript (if you don't count netlists created from schematic capture). One very well may ask "why?". Most graphics programs keep output in a custom format (.fig files for xfig, for instance) and translate to other graphics formats to create output. Here are some reasons to take a different approach:
  1. PostScript is a programming language. Most people think of PostScript as an output format for laser printers. But it's really a true programming language, a stack language, optimized for two-dimensional graphics but capable of meeting the usual demands of programming: variables, arrays, strings, definitions, loops, conditionals, etc.
  2. PostScript is nearly universal. Ghostscript, bless the hearts of the dedicated programmers who made it so, is an open source PostScript interpreter (i.e., rendering engine) which can be compiled on all the major operating systems and which can translate PostScript into most of the major printer languages and graphics formats (except for those who, to their own disadvantange, quibble about copyright violations).
Think of the relationship of XCircuit to PostScript like the relationship of LaTeX to TeX: TeX is also a programming language, one optimized for text typesetting. It was not an arbitrary decision of Donald Knuth to make TeX so open-ended, and the result is that TeX remains the best typesetter available. There is nothing that TeX cannot do, although figuring out how can be a real pain in the patootie. LaTeX defines a set of macros which effectively restrict the scope of TeX for the average user so they can concentrate on writing rather than programming. Likewise, XCircuit defines a set of macros which restrict the scope of PostScript so the average user can concentrate on drawing rather than programming. Details of the PostScript definitions used in the xcircuit output can be found on the XCircuit PostScript Reference page.

As an extension to the idea of the ``power of programming languages,'' XCircuit now makes extensive use of the TCL scripting language as a command-line interpreter. The use of TCL scripts to interpret and control xcircuit internal data structures makes it possible for the end-user to modify the behavior of xcircuit to suit his or her own needs. Current work on adding features to xcircuit (as opposed to the usual bug-fixing grunt work) attemps to retain the current interface more or less unchanged, and define new capabilities through TCL scripts. See the XCircuit TCL Reference page for details of the extended TCL interpreter interface to XCircuit.

How To Draw Schematic Diagrams

Even the best computer-aided circuit drawing software can be used to generate lousy circuit diagrams. Don't let this happen to you! Learn how to draw good circuit schematics from the experts. Reprinted from Horowitz and Hill, The Art of Electronics, 2nd ed., with permission from the publisher, Cambridge University Press. An essential part of every electrical engineer's education.

XCircuit real-world examples

The most extensive use of xcircuit for a publication to date (that I know of) is Tony Kuphaldt's Lessons In Electric Circuits, a sweeping electronics textbook available for free download from ibiblio.org. This online textbook is an excellent introduction to electric and electronic circuits, generously peppered with schematics, illustrations of project plugboards, and photographs. This link is provided with permission from the author.

My thesis is one example where I use XCircuit extensively for both circuit diagrams and figures. Another use is the book Statistical Methods For Speech Recognition by Frederick Jelinek (MIT Press, 1997), for which I drew the figures, mostly network connection diagrams for Hidden Markov Models.

If you know of other publications which make use of xcircuit, please let me know so I can include them here.


As a working stiff (well, actually, I'm more of a research scientist/engineer who gets to work on extraordinarily fun stuff) who has so far been unsuccessful in getting his laboratory to foot an IR&D bill for open-source CAD software development, I can't pretend to be able to keep up with the demand for program development. Become a developer! Development on the core C code of XCircuit is set up through SourceForge, and it's easy to become part of a code development team. Furthermore, as XCircuit progresses more toward the model of a compact, efficient core C/X11 program extending a Tcl interpreter controlling everything for which speed is not a strong factor but flexibility is, a lot of development work and program extensions will be written as Tcl scripts, apart from the CVS source. Extend XCircuit's usefulness by posting your scripts!

Caveat End-User

Part of the power of open-source software is that you do have a choice! There are plenty of alternative programs out there. The best resource I have found is (was) Tomi Engdahl's web page at the Helsinki University of Technology (HUT), Finland. This page is now expanded and maintained by an organization called e-Panorama.net. There are software links to both Linux and Windows software, and categories for drawing, schematic capture, PCB layout, and more.

I am aware that in many ways I am just duplicating the features of such programs as ``xfig'' and the Caltech "chipmunk" tools' ``until''. My justification is that these programs still don't have a good sense of hierarchy and they don't output PostScript directly, so they often make large files compared to those from xcircuit. Also they don't have built-in and user-defined catalogs of items, which is a necessity for drawings with many instances of a handful of objects, such as you get with circuit diagrams, architectural drawing, etc. Nor can they handle multiple pages of output in one file, and so forth. Thus even though I do describe ``xcircuit'' as a general-purpose drawing tool, if you're really looking for a general-purpose drawing program, you might consider something like xfig, which is powerful and well-developed. However, with each new revision, xcircuit is getting more powerful and easier to use (yeah, that's what they all say, you're saying to yourself).

Xcircuit is streamlined for ease of use in generating circuit schematics. In addition, the schematic capture features allow exporting of the circuit schematics to netlist formats like ``spice,'' ``sim,'' and ``pcb.'' Spice output is fully hierarchical, surpassing the ability of most (if not all?) other schematic capture system by automatically generating subcircuits from the drawing, determining pin connections into a subcircuit from context, not just from designated pins. Subcircuits are not just symbols with their own associated schematics, but also any collection of devices and nets which have been compiled into a library object. The development of XCircuit is also moving in the right direction for PCB engineers. In particular, development parallels work on the open-source program pcb, in an attempt to make XCircuit a useful schematic-capture tool for PCB netlisting and netlist validation.

Go to Tim's home page. . .


Last updated: July 20, 2015 at 8:58am