gEDA Component Renumbering Script (Yar)

I have written a script in Guile Scheme for numbering components in gschem schematics. It is called "yar"—Yet Another Renumbering script.

You can view the source code here.

You can download the source code from the table of attachments below.

Table of Contents

Workflow

I developed yar with my own workflow in mind. My workflow consists of generating schematic files using gschem with the .sch extension, running yar on them to generate files with the .sch.renum extension, and then using the .sch.renum files for generating print-outs and the PCB file. This leaves the original .sch files untouched so that they can be updated and run through yar again as needed.

Yar has no provisions for keeping the same numbering scheme across runs, or for back annotation.

Keyword/value Pairs

Yar automatically recognizes a number of keywords. These keywords are substituted with their current values as yar runs. Here is the list of predefined keywords and their value:

Keyword Substituted Value
FILE File name of the output file.
PAGE Page number. Page numbers are assigned to each input file in the order that they appear on the command line.
PAGES Total number of pages.
DATE Date and time.

In addition to the predefined keywords, users can supply their own keyword/value pairs on the command line. For example, this would define the keyword "REVISION" to have the value "1.5":

  ./yar.scm --subst=REVISION=1.5 ...

To be substituted, keywords within the schematic need to appear within curly braces; e.g., "{DATE}". They can appear anywhere in the schematic.

The common use I've had for this is to create a title block with places for the author, date, page number, revision number, etc. The title block uses text blocks with keywords so that when yar runs, all the relevant fields are filled in automatically.

Multiple Symbols Needing the Same refdes

Yar also looks for refdes values with a keyword embedded between the uppercase letters and the question mark; e.g., "U{ATmega162}?". These keywords are unrelated to the keyword/value pairs described above; they are not built-in keyword and they are not provided on the command line. Yar handles them directly as it encounters them in the schematic files.

The first time yar encounters such a keyword, the refdes gets renumbered as usual; e.g., "U{ATmega162}?" might become "U101". Every subsequent refdes with the same keyword will get the same numbered refdes; e.g., every subsequent "U{ATmega162}?" encountered by yar will be substituted with "U101".

The refdes values associated with the keywords are available to all schematics being processed by the same yar invocation; e.g., all the "U{ATmega162}?" across all the schematic files will get the same refdes value.

The initial uppercase letters become part of the keyword; e.g., "U{ATmega162}?" will be numbered distinctly from "C{ATmega162}?".

This feature is useful when using multiple logical symbols to represent a single physical component. I mostly use this when I separate the power pins of a component into a separate symbol.

Example Yar Command Line

Here's an example use of yar:

  ./yar.scm --subst=NAME='John Doe' --subst=REVISION='1.0' \
relay-power.sch relay-main.sch relay-outputs.sch ...
By default, this will create files with the .renum extention; e.g., relay-power.sch.renum for relay-power.sch.
Topic attachments
  Attachment Size Date Comment
elsegz octw-guile-geda-scripts-1.0.tar.gz 16.9 K 09 Sep 2008 - 22:02 gEDA Guile Scripts 1.0
r8 - 12 Sep 2008 - 20:12:48 - DeanFerreyraYou are here: Bourbon Street Software  >  GEDA > GEDAComponentRenumbering
 
Home
NearlyFreeSpeech  This site is powered by the TWiki collaboration platform