The XCircuit Tutorial

The XCircuit Tutorial


Table of Contents

Download

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".

File Revision Size Date
tutorial.tar.gz 1 (432KB) January 28, 2003

Getting started

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.

Task 1: Run the program

First, start xcircuit without any parameters: xcircuit

The features of the xcircuit window are as follows:

  1. Along the top of the screen are buttons for pull-down menus called "File", "Edit", "Text", "Options", and "Window".
  2. 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).
  3. On the bottom left is a message window telling you that you are currently editing "Page 1".
  4. 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.
  5. 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".
  6. 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.

Task 2: Change an option from the menu

Acquaint yourself with the arrangement of menu buttons and pulldown menus.
  1. Press the button labeled "Options" with mouse button 1 and hold down the button while you drag the cursor around with the mouse.
  2. Keeping the mouse button pressed down, move down to the "Elements" button. Each button will highlight as you pass through it.
  3. 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.
  4. 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.
  5. 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.
  6. 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".

Task 3: Draw a line

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.
  1. 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).
  2. 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.
  3. 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.
  4. 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.

Task 4: Move an object

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.
  1. 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.
  2. 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.
  3. 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.

Task 5: Change the properties of a polygon

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.
  1. 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.
  2. Tap mouse button 3, and the selection will be canceled.
  3. 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.
  4. 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.
  5. Click mouse button 3 to deselect the object.
  6. 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.
  7. Select the polygon but do not deselect it.
  8. 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.
  9. 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.

Task 6: Change the page

Xcircuit has multiple pages. There are two ways to change the current drawing page, from a keyboard macro convenience function, or from the menu.
  1. 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".
  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.
  3. Keys "1" through "9" and "0" will get you instantly to pages 1 through 10, respectively.
  4. End this task on Page 2, which is currently empty.

Task 7: Select an object from the user library

Another common task in xcircuit is to grab an object from the object library and place it on the drawing.
  1. 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.).
  2. A page will appear, showing a number of circuit objects in the built-in object library.
  3. 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.
  4. 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.
  5. Select the object again (if you have not already done so), and then select the menu item "Options->Elements->Object Size".
  6. 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".
  7. 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.

Task 8: Use a keyboard macro to create an arc

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.
  1. Select the menu item "Edit->Make Arc".
  2. The information window at the bottom will say "Click button 1 and drag to create arc".
  3. 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.
  4. 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.
  5. 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.

Task 9: Zooming and panning

  1. 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.
  2. 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.
  3. 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.
  4. Pan the screen by tapping any mouse button on either of the scrollbars. Note how this function is similar to the "Pan" function.
  5. 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.
  6. 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.

Task 10: Selection of multiple objects

  1. 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).
  2. Grab several objects from the library (see Task 7) and place them on top of each other in the middle of the page.
  3. Decide on one object which you will move, leaving the others where they are.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.

Task 11: Saving a file

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.
  1. Choose a page which you have been drawing on, or create a drawing to save.
  2. 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.
  3. 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.
  4. 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).
  5. 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.
  6. 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.
  7. 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".
  8. 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.
  9. 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".
  10. The file which has just been saved is already in a PostScript format. You may view it with any PostScript previewer (ghostview is recommended).

Task 12: Loading a file

  1. Go to a new, unused page.
  2. Select menu item "File->Read Xcircuit PS". You will get a screen that looks something like the following:
    The load-file popup window.
  3. 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.
  4. A green box will be drawn around each filename as your cursor passes over it.
  5. 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.
  6. Tap the "Okay"