gEDA/PCB Proposal

Forward annotation upgrade

Feature description

The goal of forward annotation is to read the design information output from e.g. a netlister, and use it to import all information required into PCB, ready for use in creating or modifying a layout. Reading the following information is a required part of creating a PCB layout:

  • Footprints with associated refdeses and their associated layers (if assigned).
  • Graphical elements (pads, tracks, polygons, holes, etc) (usually imported from a previous design iteration).
  • Electronic connectivity (netlist).
  • Any global design information such as routing constraints. (Currently unsupported by PCB).

The scheme currently used by PCB is to read a file – already in PCB format – containing the actual footprints embedded within it. The netlist is read in using a separate step.

The new scheme would read a file containing a list of actions. Each line in the file would correspond to a separate action. The file would be generated by a forward annotation tool (e.g. gsch2pcb). The actions would correspond to the atomic actions performed by PCB itself when it finds a footprint by searching its footprint library.

For example, one line in the forward annotation file might say “(load-element-data SOT-23 U6)”. This would make PCB look for an SOT-23 package in its footprint library (using PCB’s $FOOTPRINT_PATH), place it in a waiting position on the PCB, and give it the refdes “U6”. Another action might say “(add-line <layer> <X1> <Y1> <X2> <Y2> <width> <flags>)”, which would add a straight line segment onto layer <layer> from position (X1, Y1) to position (X2, Y2) having width <width> and flags <flags>. (The flags would specify things like whether the line ends are round or square, along with the other properties of a line.)

Besides importing footprint and graphical information, the new PCB forward annotation facility should import the netlist at the same time as the rest of the layout information. (This is currently a separate step, which is inconsistent with the goal of ease-of-use.)

Note that the above descriptions of the actions are meant to provide examples of how PCB should be modified. The details of each action are to be determined by the developer and the architecture of PCB itself.

Use cases

Once the forward annotation changes are complete, the following use cases should apply:


  1. The user creates his design using gschem.
  2. He creates a forward annotation file by running the .sch files through gsch2pcb, which creates a single .pfa (PCB forward annotation) file.
  3. The user starts PCB.
  4. He clicks “File → new PCB”. A window pops up, providing a place to enter the new board’s layer count and size. The window may also provide a way to specify common board templates (PC-104, 3U Eurocard, etc.)
  5. The new board is shown in PCB’s main window as a white area on a darker background (as currently implemented).
  6. The user clicks “File → Import forward annotation file”.
  7. A file selection window pops up. The user clicks on his .pfa file and clicks OK.
  8. PCB reads each action in the forward annotation file, and does the corresponding thing.
  9. The PCB netlist is also imported during this activity. No separate netlist readin step is required.
  10. At the end of the file’s read-in, the footprints should be present on the board (*not* in the paste buffer), ready to be disbursed and placed.

Existing PCB

  1. The user has a pre-existing .pcb file for the design under consideration. He makes changes to his design using e.g. gschem or gattrib.
  2. The creates a forward annotation file by running the .sch files through gsch2pcb, which creates a single .pfa (PCB forward annotation) file.
  3. The user starts PCB (or re-activates an existing PCB session running in its window).
  4. The user clicks “File → Import forward annotation file”.
  5. A file selection window pops up. The user clicks on his .pfa file and clicks OK.
  6. PCB reads each action in the forward annotation file, and does the corresponding thing. Using the refdes, the importer looks to see if the component in the forward annotation file is already placed in PCB, and if so, it ignores the action.
  7. The netlist is also read in and updated at this stage. No separate netlist readin step is required.
  8. Once this action is complete, the user is ready to continue editing his board.

Other Ideas

  • Besides a menu option, there should be a toolbar button to sync changes
  • Alternately, a thread running a file change monitor can spot the new annotation file when it appears
  • Finally, the project manager (gsch2pcb / xgsch2pcb / geda_manager) can invoke readin of a forward annotation file via IPC

Work required

Some of the support for forward annotation already exists. Specifically, many actions are already supported. Therefore, this project involves:

  1. Creating the missing actions required for full forward annotation.
  2. Creating a method for reading in an action script.
  3. Integrating the new script-based forward annotation into PCB’s GUI.
  4. Testing and bug cleanup.


PCB supports several HIDs. The HID is the interface layer which the user interacts with. The two major HIDs provided for interactive use are based upon 1) the GTK GUI widget set, and 2) The X/Motif GUI widget set. The work called out for this project shall be targeted at the GTK HID. The reason for this is simple: The rest of gEDA uses GTK. A primary goal the renovation work in PCB is to more tightly bind PCB into the entire gEDA workflow. More to the point: the gEDA tool chain should present a more uniform interface to the user. Users expect to see the same “look and feel” in all the tools they use. However, any changes made as part of this work shall not break any feature present in any other HID, including the Motif HID.

Code clarity

Many other changes are desirable in PCB. However, they are outside the scope of this work. The idea behind the changes specified here is that they create a launching point for other developers to come in afterward and continue improving PCB. Therefore, the developer must strive to make his code clear and well commented. Do not use hard to understand code tricks, obfuscating macros, or other devices which will hamper any follow-on work by other developers.


The developer should place Doxygen comments into the header of any new function he writes. Fully doxygenating PCB is outside the scope of this project, but the developer should at least use doxygen for the changes he makes.


The upgrades to PCB must work on the usual platforms supported by the gEDA Project. Specifically:

  • Linux, BSD, Sun.
  • GTK version 2.8 or later (consistent with gschem 1.5 head).

Hooks for support on Windows systems are outside the scope of this project. However, any Windows features present currently in PCB should not break as a result of these changes.

Backwards compatibility

Any changes made to PCB should not break the ability of PCB to import existing .pcb files. It is allowed to break import of .new.pcb files (i.e. the output of gsch2pcb).

GUI modernization

The basic goal is to make the upgraded PCB behave exactly as an inexperienced user might expect, based upon his familiarity with modern GUI-based tools like OpenOffice. This means:

  • PCB should support all the “normal” keystrokes which have become defacto standards for GUI programs. Examples include <ctrl>-c for copy, <ctrl>-x for delete, etc. PCB may continue to support the old key strokes to maintain backward compatibility for those who are already experienced with the program, but in the event that one of PCB’s current keystrokes conflicts with the “defacto standard”, the defacto standard shall be implemented.
  • PCB should support all actions using “noun/verb” syntax. Details of this upgrade are presented in the “actions” section below.
  • PCB should support normal selection modes (i.e. ways to select an object for editing or modification). Details of this upgrade are presented in the “selection methods” section below.
  • PCB’s internals should be upgraded to easily support enhanced menus and button bars. This means upgraded callbacks and possibly also a resource file which specifies things like menu layout, menu options available, and keybindings.

If the descriptions in this specification are ambiguous or unclear, use the behaviors implemented in gschem as the preferred example.


The following actions should be modified to support a “noun/verb” actions, if they do not support it already. Where possible, support for the current “verb/noun” actions should not be dropped to maintain compatibility for users who have learned the old actions. However, if there is a conflict between the new noun/verb and the old verb/noun actions, the new noun/verb actions take presidence.

  • select/delete Using any of: menu item, <ctrl>-x. Delete should move the deleted object(s) from the layout into the copy buffer, so the user may place them elsewhere with a subsequent action. (NOTE: The copy buffer should probably be implemented separately from the existing “element buffer”.)
  • select/remove Using any of menu item, <del>, character d. Remove should permanently remove the selected item.
  • select/move Using: left mouse button down and drag. Also: Select, then use arrow keys to move the selected objects some small quantum of motion (perhaps the grid spacing) in the direction specified by the arrow.
  • select/copy Using any of: menu item, copy button, character c. <ctrl>-c. This should copy the selected items into the copy buffer so the user may place them elsewhere in a subsequent action. (NOTE: The copy buffer should probably be implemented separately from the existing “element buffer”.)
  • paste Using any of: menu item, paste button, <ctrl>-v. This will bring the contents of the copy buffer into action at the cursor. When the user clicks on the design, then the elements will be placed on the layout where the user clicks. Refer to the behavior of gschem to see exactly how this should work.
  • select/move selection to current layer Using menu item,
  • select/move object to opposite layer Using menu item, <shift>-c.
  • select/report object properties Using menu item or <ctrl>-r.
  • select/edit object properties Using menu item or double click on single object. This is a new action.
    If the selected object is a graphical primitive (line, arc, etc), PCB will open up a window displaying the object properties in an editable window, allowing for the user to modify the object’s properties. For example double clicking on a Cu track should open up the edit window, showing the track’s width, current layer, end type (round vs. square), and its beginning and end coordinates.
    If the selected object is a footprint, PCB will open up a window allowing the user to select a different footprint name. Some type of footprint browsing window with previewing should be presented to the user for this. The footprints should be found by looking through PCB’s footprint search path. Recommendation: steal the symbol browser window from gschem for this task. (Question: how to back annotate this info into the .sch files?)
    If the selected object is text, then PCB should open up the text edit dialog box, allow the user to edit his text, click OK, and the text on the layout should be updated.
  • Select/rotate Using menu item or <ctrl>-r. This is a new window (the action already exists). This will open a window asking the user to type in a rotation angle. The user will type in the angle (in degrees), click OK, and the selected item will be rotated. Ideally, the rotation would apply globally to a selected set of items; it is up to the developer to determine if this is feasible. If not, then rotate should apply to only one item.

Selection modes

The following selection modes must be supported:

  • mouse click on single object.
  • <ctrl>-click on multiple objects. (Example: <ctrl>-click this 1, <ctrl>-click this 2, <ctrl>-click this 3, etc.)
  • Click and drag to select objects within a rectangular area.
  • <esc> clears all selections
  • <ctrl>-a selects all objects in the design.
  • <ctrl>-A selects all connected objects. (Question: What is this selection mode useful for?)

Work required

This project involves:

  1. Refactoring and upgrade of program internals to support noun/verb actions.
  2. Create new windows (e.g. object editor, move, rotate, etc.).
  3. Refactoring and upgrade of program internals to support selection modes.
  4. Implementation of GUI resource file which is read in upon program start to configure user interface.
  5. GUI upgrade. Specifically, hook up the callbacks to the menu items and buttons defined in the GUI resource file.
  6. Testing and bug cleanup.

Upgrade of layer and design objects

Feature Description

Currently, PCB’s internal data structures only “know” about metal and silk layers. Other layers commonly used in PCB design are either missing (e.g. DRC layer, outline layer), or are simply derived from the metal layer (solder mask). This task involves implementing full support for layers of arbitrary type and layer count. Also, support for other design objects is part of this upgrade. Specific features required are:

  • Upgrade of existing datastructures to support layers of arbitrary type including: DRC, mechanical outline, annotation, solder mask, paste mask, plated through-hole, unplated through-hole, metal, silk. The upgrade must also provide support for an arbitrary number of layers. Also, allowing for per-layer clearance settings is an important feature for inclusion here.
  • Implement window widget allowing for easy selection/configuration of layer stack-up. Parameters to configure include: layer count, layer type, layer polarity, layer visibility, layer color. The window will also allow the user to re-order the layers (from front to back), and to add or subtract an arbitrary number of layers. The layer window presented in “gerbv” is a reasonable example of what this window should support.
  • Implement a new datastructure representing a pad stack.
  • Implement a window widget allowing for easy editing of the pad stack’s properties, including: metal annulus outer diameter (per layer), solder mask diameter (per layer), paste mask diameter (per layer), clearance width (per layer), hole diameter.
  • Consider how the data-structures could allow support for blind or burried vias in the future.

Work required

This project involves:

  1. Upgrade internal structures and methods to enable full layer support.
  2. Create layer configuration window.
  3. Create internal datastructures and methods to support padstacks.
  4. Create padstack configuration window.
  5. Testing and bug cleanup.

Footprint editor implementation

Incorporating a good footprint editor into PCB is a common request from users. It is important for PCB to clearly distinguish between editing a footprint and editing an entire PCB design. Here are two possible methods to accomplish this:

  1. Although it is not optimal, the symbol editing mode present in gschem provides a reference for how this might be implemented. Specifically, editing a footprint may be implemented as a “mode”, in which the user drills down into the footprint, and is placed into a special mode of the standard PCB editing window which is reserved for editing footprints.
  2. Another way to implement a footprint editor is to have a pop-up window with its own drawing pane along with editing widgets specialized for creating and modifying footprints.

Optionally, features involving editing footprints via the buffer will be removed. Alternately, retain the option allowing the user to draw in the main window, select, then invoke some menu option to convert the selection to a footprint. This option may exist alongside the new footprint editor.


There are two ways to invoke the footprint editor:

  1. Create a new footprint. In this case the user will have no object selected on the PCB drawing window. He will then choose an option from the menu, like “tools → down footprint”. This will place the user into the footprint editor, and the drawing area will be empty
  2. Edit an existing footprint. In this case, the user will select a footprint present on the board by clicking on it. Then he will select an option from the menu, like “tools → down footprint”. This will place the user into the footprint editor, and the drawing area will hold a copy of the selected footprint, ready for editing.

As a third possibility, the user should be able to do “tools → create new footprint”, go into the editor, and then do “file → open” and select a footprint from the library to edit.

As a fourth possibility, allow a mode similar to gschem, where a library browser is used to select and place primitive objects. That would save the user from needing to know where the library files are hidden.


The footprint editor should be a graphical drawing environment similar to that presented by PCB for layout editing.

  • Buttons and menus. The footprint editor should have all the same menus and buttons as are available from the PCB editor. Those menu items and buttons which are not useful for footprint editing should be greyed out.
  • Look and feel. Once the user is placed in the footprint editor, the PCB window should change in some way to reflect that the user is in a different mode. For example, the title bar must say “footprint mode”. Also, the drawing field background color might be changed a little bit to emphasize the change in mode.

The design choice of which environment is better is left to the developer to decide based upon factors including input from the community, ease of implementation, etc.


Once the user has edited his footprint, he will want to save it out. This is a problematic action, since it’s not a good idea to allow the user to overwrite a footprint living in the footprint libraries. Moreover, the user may not have write access to the library directories.

Therefore, when the user is done editing his footprint, there should be only one save action available under the file menu: “file → save footprint as”. This will call up the file save dialog, which will default to sticking the footprint in the current working directory (or the last directory he saved a footprint into during this session). The user will then be required to browse to his preferred save directory, and save the footprint there.


Once the footprint editing session is done, the user may leave the editor and return to his main PCB editing session. This may be accomplished using a menu item like “tools → up to layout”. If any unsaved changes remain in the footprint, then the user should be prompted to either save or discard his changes before leaving the footprint editor.

Updating a footprint placed on the board

After editing a footprint and saving it out, the user will often want to update a footprint already present on the PCB. Here is the preferred method (use case) to do this:

  1. User selects footprint to update.
  2. From menu, user selects “tools → update footprint”. A keystroke to start this action may also be provided.
  3. A pop-up window opens, giving the user the footprint browser (as described above). The window will have has default footprint the name of the currently selected footprint.
  4. The user will either accept the default footprint presented, or he may search for a different footprint. When he is done, he will click OK.
  5. PCB will load the specified footprint from its library. Note: For this to work after editing a footprint, the user must place his local directory first on the footprint search path.
  6. PCB will then replace the old footprint on the board with the one pulled from the library. The old footprint (currently written into the .pcb file) will go away, and the new one will take its place.

Work required

This project involves:

  1. Create internal structures and methods needed to support a separate footprint editor.
  2. Create footprint editing window (if the separate window approach is adopted).
  3. Integrate access to footprint editor into main PCB GUI.
  4. Testing and bug cleanup.

Design Rule Checking Upgrade

Feature Description

The goal of design rule checking (DRC) is to insure that a printed circuit board layout conforms to a set of design rules. Design rules will consist of specifications like minimum copper line width, minimum copper spacing, etc. Generating a manufacturable PCB layout without DRC is tedious at best

The current PCB DRC steps through design rule violations one by one using a dialog box that reports the error, the coordinate position of the error and places the cursor at the error. Bouncing back and forth between the layout and the dialog box is time consuming. Knowing all of the errors prior to starting error correction is usually more productive.

A preferred method of reporting DRC violations would be to graphically indicate all errors on the layout. With this method all errors are quickly visible. DJ has suggested a layer for displaying DRC errors. The user should be able to turn the layer visibility on and off.

A useful option for DRC would be to have it run periodically. A proactive DRC should help novices avoid creating multiple similar errors. Threaded operation, or a DRC which works in packets of time where the mainloop hits idle would be possibilities here. Both have their merits and draw-backs. If the operation is slow, we’ll need some way to queue the work such that updates to the board in the mean time queue updates for new DRC checking.

Similarly, we’d need to ensure that removing or changing objects on the board doesn’t crash the DRC code - if it is running in a thread.

Use Cases

Manual DRC

  1. The user runs DRC using either a hot-key or menu item. An unobtrusive DRC status indicator is displayed. Perhaps the phrase “DRC Check” in yellow text in the top bar.
  2. DRC violation marks are displayed on the DRC layer or on the PCB the layout.
  3. An unobtrusive DRC status indicator is displayed. Perhaps the phrases “DRC PASS” in green text and “DRC FAIL” in red text in the top bar.
  4. If there are DRC failures the user can step to the next error manually or by using a hot-key. After changes are made the DRC can be run manually to verify the fix.

Automatic DRC

  1. Using a menu item the user can set the appropriate time interval for running DRC. A default value is used if a new value is not set.
  2. The user enables automatic DRC mode.
  3. After the DRC idle period has elapsed DRC runs. An unobtrusive DRC status indicator is displayed. Perhaps the phrase “DRC Check” in yellow text in the top bar.
  4. DRC violation marks are displayed on the DRC layer or on the PCB layout.
  5. An unobtrusive DRC status indicator is displayed. Perhaps the phrase “DRC PASS” in green text and “DRC FAIL” in red text in the top bar.
  6. If there are DRC failures the user can step to the next error manually or by using a hot-key. After changes are made the DRC can be run manually to verify the fix.

Work required

This project involves:

  1. Implementation of DRC layer (part of work called out in “DRC Upgrade” section).
  2. Upgrade existing DRC checker with new DRC layer.
  3. Update GUI to use upgraded DRC checker.
  4. Testing and bug cleanup.


All code will be published under Version 2 of the GNU General Public License (GPLv2.) or later.

Linux is a trademark of Linus Torvalds. Website Copyright © 1999 – 2010 Linux Fund, Incorporated, a 501(c)(3) Organization.