PCB Footprint Update Plug-in

This PCB plug-in lets you replace existing footprints in your layout with updated footprints. You can download the source code from the table of attachments below. You can browse the sources here.

Table of Contents

Motivation

Like some others, I found myself with a routed board and while inspecting the Gerber files decided several of my footprints needed tweaking. All my footprints are generated with Make and Guile scripts, so updating the footprint files themselves was easy. Unfortunately there wasn't an easy way in PCB to update my layout to use my new footprints. (Some discussion of these problems can be found in the email archives here and here.)

Plug-in

This PCB plug-in replaces existing footprints in your layout with updated footprints doing its best to preserve the existing footprint's:

  • position,
  • rotation,
  • side of the board it's on,
  • component name and relative placement, scale, orientation, etc.,
  • and pad and pin names.
Because PCB modifies its internal copies of the footprints any time they are moved, rotated, etc., the plug-in needs to use some guess work. The plug-in cannot always determine the correct orientation and in these cases it will skip the replacement. Even when it thinks it has determined the correct orientation, it might get it wrong.

The plug-in adds the UpdateFootprintsFromBuffer action to PCB. The action takes a footprint (i.e., element) that has been loaded into the buffer and uses it to replace existing footprints (i.e., elements) in the layout.

The action runs in one of two modes: "auto" or "manual".

In "auto" mode, the plug-in uses the buffer footprint description text to find corresponding layout footprints. In my workflow the description text always contains the footprint file name, e.g., "PHOENIX-PT-4-R.fp", so executing the action in "auto" mode will automatically replace all existing instances of the footprint in the layout.

In "manual" mode, the footprint description text is not used and the plug-in will try to replace the selected or named footprints.

Here's the usage:

UpdateFootprintsFromBuffer() or UpdateFootprintsFromBuffer(auto)
Use the description field of the buffer element and try to replace any layout element that has a matching description field.
UpdateFootprintsFromBuffer(auto, selected)
Like UpdateFootprintsFromBuffer(auto) but only consider selected layout elements.
UpdateFootprintsFromBuffer(auto, named, <name1>[, <name2>...])
Like UpdateFootprintsFromBuffer(auto) but only consider elements that match the given element names. For example, UpdateFootprintsFromBuffer(auto, named, U101, U103, U105).
UpdateFootprintsFromBuffer(manual) or UpdateFootprintsFromBuffer(manual, selected)
Like the "auto" version, but try to replace the selected layout elements regardless of their description field.
UpdateFootprintsFromBuffer(manual, named, <name1>[, <name2>...])
Like the "auto" version, but try to replace the named layout elements regardless of their description field.

Limitations

Here are the limitations I know of:

  • Only components with a rotation in a multiple of 90 degrees are supported.
  • The rotation of the new element is calculated using two non-coincident pads or pins from both the buffer element and the layout element. For elements consisting entirely of coincident pads and pins, or only a single pad or pin, the plug-in will only translate the replacement element from the buffer without regard to rotation.
  • Element-specific attributes in the layout element, if it has any, are replaced with the buffer element's attributes; i.e., attributes in the layout element, if it has any, will be lost.
  • The quality of the replacement is not evaluated by the plug-in. You may be unhappy with the results.

Since this is my first trip into PCB's internals, and since the biggest layout I tested it on is a simple two layer board with about 100 footprints, please use this plug-in with care and:

Definitely backup any design before you try out this plug-in!

If you find any problems with this plug-in or have any suggestions, feel free to contact me at dferreyra@igc.org .

Action Scripts

To update all my footprints at once, I generated a PCB action script. Here's what a piece of the script looks like:

    ...
    LoadFrom(ElementToBuffer, EDAC-RJ45-RA.fp)
    UpdateFootprintsFromBuffer(auto)
    LoadFrom(ElementToBuffer, LITEON-LTST-C195GEKT.fp)
    UpdateFootprintsFromBuffer(auto)
    LoadFrom(ElementToBuffer, LUMEX-LDD-C402NI.fp)
    UpdateFootprintsFromBuffer(auto)
    ...
Then I execute the script with the ExecuteFile() action. This allows me to update all 100 footprints on my small board automatically and at will.

Building

To build the plug-in:

  1. Untar the distribution file; e.g.:
    • tar -xzf footprint-update-1.01.tar.gz
  2. Edit the Makefile:
    • Change PCB_CVS_DIR to point to the directory containing the PCB source tree.
    • Change INSTALL_DIR to point to the directory where you want the plug-in installed.
  3. Run make to build the plug-in. Run make install to install it.

Note that starting with this PCB commit from 5 Jun 2010, the "Boolean" typedef was replaced by the use of C99's "bool" type. Please download the appropriate version of footprint-update, below. (Thanks to Chris Kilgour for kindly informing me of this and sending me a patch and script!)

References

-- DeanFerreyra - 30 Apr 2008

Topic attachments
  Attachment Size Date Comment
elsegz footprint-update-1.01.tar.gz 23.6 K 11 Sep 2008 - 04:57 Footprint-Update plug-in for PCB (for versions of PCB that use Boolean)
elsegz footprint-update-1.02.tar.gz 23.4 K 21 Aug 2011 - 23:38 Footprint-Update plug-in for PCB (for versions of PCB that use bool)
r21 - 21 Aug 2011 - 23:46:07 - DeanFerreyraYou are here: Bourbon Street Software  >  GEDA > PCBFootprintUpdatePlugIn
 
Home
NearlyFreeSpeech  This site is powered by the TWiki collaboration platform