The XCircuit Tutorial
Table of Contents
This download is the tar'd image of everything in the tutorial subdirectory,
including both the standard tutorial and the schematic capture tutorial.
Note that when untar'd, this will expand into a directory tree with top-level
directory named "tutorial".
Welcome to xcircuit, the circuit drawing program by Tim Edwards. In order to
get the most out of this page, you should have already downloaded, compiled,
and installed the xcircuit program and its libraries.
First, start xcircuit without any parameters: xcircuit

The features of the xcircuit window are as follows:
- Along the top of the screen are buttons for pull-down menus called "File",
"Edit", "Text", "Options", and "Window".
- At the top, beside the menu buttons, is a welcome message in the message
window telling you the version number of the program (Version 2.0).
- On the bottom left is a message window telling you that you are currently
editing "Page 1".
- On the rest of the bottom is a message window telling you that xcircuit
has just loaded the library "/usr/local/lib/xcircuit/builtins.lps" (this
may be in a different directory if xcircuit has not been installed in the
default directories). This message will disappear after about 10 seconds.
- At the left and along the bottom are two scrollbars which report the
position of the drawing relative to the main window, and can be used
to reposition the drawing by clicking on the bar with any mouse button.
Note: Due to the length of time necessary to refresh the drawing
window, the scrollbars cannot be "dragged".
- In the center is a white drawing area with lightly-colored grid and
axis lines.
There are two types of mouse button-pushing used in xcircuit. When a button
is pushed and released quickly, I will call it "tapping". When a button
is pushed and held down, I will call it a "pressing". Since pressing
a button is usually performed in order to move objects around on the screen,
I will sometimes refer to it as "dragging" the object.
Note: Xcircuit does not use double-clicking.
Acquaint yourself with the arrangement of menu buttons and pulldown menus.
- Press the button labeled "Options" with mouse button 1 and hold down
the button while you drag the cursor around with the mouse.
- Keeping the mouse button pressed down, move down to the "Elements" button.
Each button will highlight as you pass through it.
- Put the cursor on top of the arrow icon at the right side of the "Elements"
button. You should see a secondary menu titled "Elements" pop up. The
title is the topmost entry of the menu. It has no function and does not
highlight when the cursor is overtop it.
- Keep moving down to the "Color" button and again move the cursor over
the arrow icon. The third and final menu of colors will pop up. Note
that one item, "Inherit Color" has a check mark on it. The check mark
denotes that this entry is the current default color.
- Move down to the purple color button and release the mouse button there.
The menus will disappear. You have just changed the default drawing
color to purple.
- Repeat the procedure up to step 4. When you enter the "color" menu you
will see that the purple color button is now checked, showing that
purple is the default drawing color.
Throughout the tutorial I will refer to the menu items using the pulldown
hierarchy, with an arrow ("->") wherever you need to go to a submenu. So
the "Inherit Color" menu item would be referred to as
"Options->Elements->Color->Inherit Color".
Now that you understand the function of the menu buttons, it's time to learn
how to draw something. The simplest and most common thing to draw in xcircuit
is a polygon.
- Tap mouse button 1 anywhere in the drawing area and release it
immediately. If you wait too long to release the button, xcircuit will
interpret it as trying to "grab" an element on the screen, and nothing
will happen (because there aren't any elements yet to grab).
- Move the cursor around the screen. A purple line (because you chose
purple to be the default color in Task 2) will appear between the
origin point and will track with the cursor.
- Tap mouse button 1 again to finish a line segment. A new line
will begin at the point the first one left off. Do this several times
to form a polygon. Finish the polygon by tapping mouse button 2.
- Repeat steps 1 through 3 but finish by tapping mouse button 3.
The line you have just created will disappear. You have just
cancelled the operation.
A purple polygon
For most operations in xcircuit, tapping mouse button 1 will begin or
continue an operation, tapping mouse button 2 will finish it, and
tapping mouse button 3 will cancel it. The behavior can be slightly
different depending on the circumstance, and the behavior for pressing
buttons 1 and 2 is very different, as demonstrated in Tasks 4 and 5.
mouse button 1 does have one very different function than that described
in the last task. It can be used to "grab" hold of an object for moving.
- Press mouse button 1 close to a line of the polygon you just
drew. Hold down the button. The line should turn gold colored,
indicating that it has been "selected". If instead nothing happens,
then the cursor is too far away from the line. Releasing the button
releases the object.
- Try grabbing and releasing the polygon from different distances to get
a feel for how close you must be to the object in order to grab it.
- Now grab the polygon, and with the mouse button held down, move the
cursor across the screen. The polygon will follow the cursor. This
is how you move an object in xcircuit.
mouse button 2 also has a selection funtion; in fact, it has two of
them. In the normal drawing mode, it can be used to select objects for editing
or changing properties. In this task you will use mouse button 2 to
select the polygon you just created in order to make it a dashed line.
- Select the object by tapping mouse button 2 with the cursor near
to the object. The object will turn gold, indicating that it has been
selected.
- Tap mouse button 3, and the selection will be canceled.
- Investigate the other form of selection by pressing mouse button 2
starting below and to the left of the polygon, and dragging the cursor
to the top and right of the polygon. A green box will follow the
movement of the cursor.
- When the box completely surrounds at least one of the endpoints
of any line segment of the polygon, release the button. The polygon
should be selected.
- Click mouse button 3 to deselect the object.
- Repeat steps 3 through 5, noting that if no endpoint of the polygon
is contained within the select box, then the polygon will not
be selected.
- Select the polygon but do not deselect it.
- Go to the "Options->Elements->Border" submenu and select option
"Dashed". When you release the button, the polygon will be drawn
in dashed lines, and it will no longer be selected.
- Experiment with the different Colors, Fill-styles, and Border-styles
available in the menus. Some of the many varieties are shown below.
More purple polygons.
Top left: original.
Top right: dashed.
Center left: closed. Center right: stippled
(50% stipple).
Bottom left: opaque stippled. Bottom right:
filled solid.
Xcircuit has multiple pages. There are two ways to change the current
drawing page, from a keyboard macro convenience function, or from the
menu.
- Select the menu item "Window->Goto Page->Page 2". The polygon
you just drew on Page 1 will disappear, and you will be on a
clean page, with the bottom left-hand window saying that you
are editing "Page 2".
- Go back to Page 1 using the keyboard macro: With the cursor
in the drawing area, press the "1" key. You will be back on
page one.
- Keys "1" through "9" and "0" will get you instantly to pages
1 through 10, respectively.
- End this task on Page 2, which is currently empty.
Another common task in xcircuit is to grab an object from the object
library and place it on the drawing.
- Select the "Window->Show Library" button from the menu, or press the
"l" (that's "ell" as in "library") key in the drawing window. Note
that the menu button has
"(l)" written after "Show Library", indicating that the keyboard
macro "l" has the same function as the menu button. Generally,
keyboard macros, once memorized, are more convenient to use than
their menu button counterparts. Almost always, the letter or symbol
used for the macro is meaningful and easy to remember (like "a" for
"arc", "s" for "spline", "p" for "pan", "c" for "copy", etc.).
- A page will appear, showing a number of circuit objects in the
built-in object library.
- Grab one object by moving the cursor over top it and pressing and
holding mouse button 1. As soon as the button is pressed,
the object library will disappear, and you will be dragging the
object around Page 2, from which you called up the library. When
you release the button, the object will be deselected. Place it
away from the polygon you drew in the previous tasks.
- Select the object by tapping on it with mouse button 2.
Try changing the border style to dashed. You will see that
nothing happens. This is because object instances from the
library are made up of basic elements like polygons,
arcs, and splines, but they are composite objects which
do not have properties like "Fill-style" and "Border-style".
However, object instances do have the property of color, and
also the property "size" which simple elements like the polygon
do not have.
- Select the object again (if you have not already done so), and
then select the menu item "Options->Elements->Object Size".
- A window will pop up asking you for an object size. Place the
cursor somewhere inside the popup window and change the default
size of "1.00" to "1.5".
- Press the "Okay" button. The popup window will disappear and
the object will now be 1.5 times its original size (that is
to say, its length and width will each be 1.5 times their
previous value).
Part of the default circuits built-in library.
As mentioned above, keyboard macros are generally easier to use than
their menu-button counterparts. You will create an arc in both fashions
to show the difference.
- Select the menu item "Edit->Make Arc".
- The information window at the bottom will say "Click button 1
and drag to create arc".
- Place the cursor where you want the arc center to be and press it.
While holding it down, drag the cursor around the screen. An arc
will follow the cursor.
- Release the mouse button. You will now be editing the angle of the
first endpoint. If you just want a circle, tap mouse button 2
to end. If you keep pressing mouse button 1, you will be
able to edit, in turn, all the properties of the arc such as
endpoint positions and ellipse axis.
- Now, create an arc by tapping the "a" key while the cursor is in the
drawing area. The main difference is that mouse button 1 is
not held down while you form the radius of the arc. Otherwise,
the arc can be edited as before.
Some differenct arcs.
Top left: linewidth of 1.5, first endpoint at 90 degrees.
Top right: closed arc.
Bottom left: red circle.
Bottom right: blue ellipse.
- Pan the screen to be centered on the arc by placing the cursor close to
the center of the arc and tapping the "p" key.
- Pan the screen by selecting menu item "Window->Center Pan" and then
tapping mouse button 1 on the point of the drawing area that
you want to be the new center of the screen.
- Tap the "Z" and "z" keys to zoom in and out, or select the menu items
"Window->Zoom In" and "Window->Zoom Out". Note how the scrollbars
on the side and bottom of the screen change with the scale of the
drawing.
- Pan the screen by tapping any mouse button on either of the scrollbars.
Note how this function is similar to the "Pan" function.
- Zoom to a selected area of the screen by making a green selection box
like you did in Task 5, step 3. However, instead of releasing the
button in order to make the selection, type the "Z" key while the
mouse button is still pressed down. The screen area will zoom to
the area of the green box.
- Alternately, choose "Window->Zoom Box" from the menu. Then press
any mouse button and drag to generate the green selection box. When
the button is released, the screen area will zoom to the area of the
green box.
- Clear the current page by choosing the menu item "File->Clear Page".
There is no keyboard macro for this command, to prevent accidental
erasure of the screen (which cannot be undeleted).
- Grab several objects from the library (see Task 7) and place them
on top of each other in the middle of the page.
- Decide on one object which you will move, leaving the others where
they are.
- Now press mouse button 1 as if you were going to select the
object you want to move. Because the command is ambiguous---the
program doesn't know which one or ones of the objects you really
want to select---the program will query you one by one for which
objects you want to select.
- One object will turn blue, the cursor will become a question mark,
and the information bar at the bottom will read, for example,
"Click to accetp/reject: 1 of 3" if the program found three
objects under the cursor. Release the mouse button at this
point.
- If the object that you want to select and move is colored blue,
click mouse button 2. If an object that you don't
want to select and move is colored blue, click mouse button
3.
- When you have chosen or rejected each of the objects, the cursor
will become a circle. You may now press and hold mouse button
1 and continue with the intended move.
- Try this several times to get used to it.
Three objects simultaneously selected.
The gold-colored gate has already been selected; the program is now prompting
the user for confirmation to add the blue-colored object to the selection.
Message window when selecting multiple objects.
Since the main purpose of xcircuit is to create publishable-quality picutures,
it is necessary to understand a little bit about the PostScript output which
it writes. First I will show you how to save and load a file.
- Choose a page which you have been drawing on, or create a drawing to
save.
- Select the menu item "File->Write Xcircuit PS". You will get a popup
window that looks like the figure below.

The file properties popup window.
- If you tap the button labeled "Write". You will get a message in the
bottom message window saying "Warning: Enter a new name". Nothing
has been written at this point.
- Change the filename. Move the cursor over the window containing the
filename. Delete the current file name and type in a new one.
When you are done, either hit the RETURN key or tap the
button labeled "Okay" (both actions have the same effect).
- Important note: If the name has no extension, an
extension ".ps" will automatically be added when the file
is written. If an extension, for instance ".eps", is written
in the filename, then it will be used.
- When you change the filename, the page label will be changed to
match the filename, and the bottom left-hand message window will
now say "Editing: " followed by the page label name, followed by
the page number in parentheses.

Changes to scale and filename.
- If the filename you chose already exists on the disk, the button
which previously was labeled "Write File" will now say "Overwrite
File", the computer will beep, and the bottom message window will
say "Warning: File exists".
- Tap the button labeled "Close". The window disappears; because
you did not tap the "Write File" button, nothing was written,
although the filename change has been registered.
- Select "File->Write Xcircuit PS" again to bring the window back.
This time, tap the "Write File" button. The file will be written
to the disk current directory, and the button which previously
said "Close" will now say "Done".
- The file which has just been saved is already in a PostScript format.
You may view it with any PostScript previewer (ghostview is recommended).
- Go to a new, unused page.
- Select menu item "File->Read Xcircuit PS". You will get a screen that
looks something like the following:
The load-file popup window.
- If the file list is larger than the window, you may scroll up and down
the list by clicking mouse button 1 or 2 on the
scrollbar at the right side of the window and dragging it up
and down.
- A green box will be drawn around each filename as your cursor passes
over it.
- Find the file that you just saved in the last task. When the green
box is over this filename, tap mouse button 1. The filename
will turn green, and at the same time will be copied into the
text edit box.
- Tap the "Okay"