# gsch2pcb (gschem to PCB) README

    gsch2pcb
    --------
    gsch2pcb is a program that interfaces a set of schematics generated with
    with the gEDA gschem to PCB layout files.

    gsch2pcb is conceptually similar to the gschem2pcb shell script, but
    additionally handles multiple schematics, handles file element footprints,
    and removes pc board elements corresponding to components deleted from the
    schematics.  It also forward annotates component value changes.

    Using gsch2pcb allows you to drive all design changes from the gschem
    schematics without the headache of manually keeping PCB elements and
    element values in sync.

    It requires that the gnet-gsch2pcb.scm file be install into the gEDA
    scheme directory.  On Debian this is /usr/share/gEDA/scheme, but see
    the INSTALL file.

    Typical usage
    -------------
    1) Create your custom PCB elements and save each one into its own file.
       Some compatibility tips if you will be inserting elements into a
       layout manually as well as with gsch2pcb:
         *  Make the initial "Description" field of these elements the same
            as the file name because gsch2pcb depends on this name (which is
            the gschem footprint
            value) to know when footprints/elements are changed.
         *  Make the initial layout-name field (displayed when the "name on PCB"
            menu entry is selected) empty (ie "") so that gsch2pcb
            will not delete your element when you want it to be in the layout
            even though it is not in the schematic.  You can later edit the
            layout-name to be some refdes value, but I'm not sure it makes sense
            to name a PCB element that is not referenced in the schematic.

       Note: since once a layout element is named PCB won't let you reset it
       to an empty name, a sort of kludge is that setting the first character
       of the layout-name to a non-alphanumeric will protect the element from
       being deleted by gsch2pcb.

       These file elements should be placed in a directory heirarchy that
       gsch2pcb will search.  The default directories /usr/local/pcb_lib and
       ./packages are searched in addition to any directories you specify with
       --elements-dir dirname arguments to gsch2pcb.

    2) Create your schematic with gschem.  Make sure each component has a
       unique refdes attribute and a footprint attribute that matches either
       a PCB m4 element or one of your custom file element names.  Beware of
       file element names that collide with PCB m4 macro names (or specify the
       use-files option).
       Make a project file if you wish.

    3) Run "gsch2pcb foo.sch" or "gsch2pcb myproject" if you've created the
       myproject file.  If you didn't specify an output name, this will generate
       a foo.pcb and a foo.net file.
       If you get errors about footprints not found, you need to create PCB
       elements for them and repeat this step until you get no errors.
       Or, just run gsch2pcb again and it will shift unfound elements to
       foo.new.pcb and you can proceed using PCB on foo.pcb if you wish to
       fix the errors from inside of PCB.

    4) Run "pcb foo.pcb".  All the elements will be stacked on top of each other,
       so move them to desired locations.  Load the netlist file foo.net and
       proceed with using PCB.

    5) Modify foo.sch and again run "gsch2pcb foo.sch".
       * If components were added, PCB elements for them will be placed in the
         file foo.new.pcb.  If components were deleted, the elements for them
         will be removed from foo.pcb and the original foo.pcb will be renamed
         to a foo.pcb.bak sequence.
       * If elements can't be found for new schematic footprints, then the
         unfound elements will be indicated with PKG_ lines in foo.new.pcb
         unless you run "gsch2pcb --remove-unfound foo.sch" which will omit
         the PKG_ lines so you can go ahead and load foo.new.pcb into PCB.
       * Note that If you have added elements to the .pcb layout which
         will not exist on the schematics (mounting holes, etc), make sure
          there is no "name on PCB" (the gschem refdes) for them or else gsch2pcb
         will delete them when they don't match a schematic refdes and footprint.
         You could use the --preserve option to prevent deleting any elements at
         all, but this is really not the best way to use gsch2pcb.

    6) Run "pcb foo.pcb" and clean up any dangling traces left over from removed
       elements.  Load any new elements in foo.new.pcb with the "Load layout
       data to paste-buffer" function.  Load the new netlist foo.net.

    Caveats
    -------
    * gsch2pcb uses a gnetlist backend gnet-gsch2pcb.scm, so be sure when you
      install gsch2pcb that the gnet-gsch2pcb.scm file gets installed into the
      right place.  Look at the INSTALL file in the tarball.

    * WARNING:  if you wish to start processing with gsch2pcb any existing PCB
      files that have m4 elements and were originally generated with gschem2pcb,
      then be sure to run first with at least gsch2pcb 0.4:

         gsch2pcb --fix-elements

      on the PCB file schematics or else gsch2pcb will want to delete the
      m4 elements.

    * footprint information is saved into PCB element's Description fields,
      so it's probably not a good idea to change element Description values
      in your layout while using gsch2pcb unless it is a protected element
      that has an empty layout-name.

    Bill Wilson    billw@wt.net