This program will read a schematic from gschem (part of gEDA) and create a new xpcb layout with all the parts placed on the schematic. There are a couple other programs which attempt to do this, that I found to be unacceptable. They are called gsch2pcb and gschem2pcb and come with gEDA. They create an incredible mess with all the parts placed on top of each other. This program places parts outside the margin of your board in such a way that they do not overlap. It also tries to sort parts by refdes before placing to make it easier to find the parts, although small parts may be placed in gaps left by larger parts and thus end up out of order. The parts are placed outside the board margin so they don't get in the way as you are manually placing the parts.
--two This is the third option
The name of the schematic file to read. Default value: "-". Example: --input_file=board.sch
The name of the layout file to write Default value: "-" Example: --output_file=board.pcb
The width of the finished board Default value: 550000 (5.5 inches) Units: 0.01mils Example: --board_size_x=550000
The height of the finished board Default value: 400000 (4.0 inches) Units: 0.01mils Example: --board_size_y=400000
The width of the working area while placing components around the margin of the board. Default value: 900000 (9.0 inches) Units: 0.01mils Example: --working_size_x=900000
The height of the working area while placing components around the margin of the board. Default value: 700000 (7.0 inches) Units: 0.01mils. Example: --working_size_x=700000
A colon separted list of directories to search for component footprints. All subdirectories will be searched. Default value: "/home/whitis/surface_mount/output/xpcb:\ /home/whitis/surface_mount/hand_drawn" Example: --searchdirs="/usr/local/share/pcb/newlib:/home/me/footprints"
Default Value: 1 Example: --sort_by_refdes=0 (disable) Example: --sort_by_refdes=1 (enable) Example: --sort_by_refdes (enable)
Determines whether to use row major or column major order to layout new parts. Default value=1 Example: --vertical=0
Amount of debugging information to print Default value: 0 Example: --debug (turn on debugging) Example: --debug=5 (even more debugging)
Amuunt of status information to display while processing. Default: 1 (on) Example: --verbose=0 (quiet)
The file sample.png contains a sample of the output of the program
on a real project so you can see what the output looks like.
Actually, there were so many components I ended up splitting
it into two boards.
Compare it to sample_othertools.png
that shows what you get after running gEDA gsch2pcb and pcb autoplace
on the board. It looked even worse before the autoplace.
"xpcb" refers to the program foolishly renamed "pcb" located at http://pcb.sourceforge.net/ This program was originally more sensibly named XPcb.
gschem refers to the schematic capture program produced by gEDA project.
This program does not attempt to autoplace components to minimize trace length based on the netlist connections. This is difficult and of dubious value. Most boards have components that need to be placed in specific locations, such as connectors, switches, LEDS, joysticks, potentiometers, LCD displays, keypads, and certain test points. And there are other components whose placement cannot be deduced by such a program: decoupling capacitors. The xpcb program has such a feature built in; when run it ties up your computer for an hour and you are still left with a bunch of components placed on top of each other. It might work better if you manually placed some components and then selectively use it on groups of components:
Another trick you may want to try for manually placing components on the board is to temporarily delete VCC, GND, and similar nets from the netlist file. These nets generate ratsnest lines that are generally more of a hinderance than a help during rough placement.
Table 1. Feature comparison
| Program: | gschem2xpcb | gschem2pcb | gsch2pcb | |
|---|---|---|---|---|
| Language | C | shell script | C | |
| Lines: | 1540 | 123 | 1270 | |
| License: | other | GPL (bad) | GPL (bad) | |
| obsolete M4 parts | no*** | yes | yes | |
| new Element files | yes | no | yes | |
| multiple sheets | no | no | yes | |
| Places parts: | non-overlapping | overlapping | overlapping | |
| Outside margin: | yes | no | no | |
| Updates existing board | no | no | yes | |
| Imports netlist | no | no | no | |
| ratsnest optimazation | no | no | no | |
| User defined search path | yes | no | no** | |
| Handles element file extensions | yes | no | no |
* Use "cat" to combine multiple schematic files together first. The program won't be bothered by the extra file headers.
** gsch2pcb lets you specify a (single?) directory but you can't exclude existing GPL tainted library directories or change the search order (which starts with obsolete format library symbols first).
***IF you want to use obsolete M4 parts, I suggest writing a small translator program to convert them to element files. This is basically what xpcb does anywya. The QueryLibrary.sh shell script could be called for each symbol to produce an element file. The ListLibraryContents.sh shell script will list the components in each library In determining object extents, the program leaves a little space at the top for the REFDES but does not try to actually calculate the space used by the REFDES. The following script will almost do the job.
#!/bin/bash
mkdir /tmp/junk
for i in *.list; do
name=`basename $i .list`
echo "###Processing Library $name"
fgrep -v "#" $i | (
export IFS=":"
while read a b c; do
echo "a=$a b=$b c=$c"
./QueryLibrary.sh . pcblib "$a" "$b" "$c" >/tmp/junk/$a.xpcb_element
done
)
done
However, QueryLibrary.sh hangs if $c contains spaces. Please bear in mind that converting old m4 libraries has absolutely zero priority for me since I will NEVER use GPL licensed parts.
Manually load netlist in xpcb once you have opened the new board.
Line breaks are not allowed in the middle of an Element, ElementLine, ElementArc, Pin, or Pad line. Some M4 generated parts contain indiscriminate line breaks. This program works fine on parts generated by the "save buffer elements to file" command in xpcb and on parts generated by the opensymbol project.
For each footprint "footprint" specified in the schematic file, the program will by default search for files named "footprint" and "footprint.xpcb_element". You can add additional directories to the search path.
Some of the functions implemented by this program are:
I did not extend gsch2pcb because it had an unacceptable license and poor coding style.
If you don't understand why GPL is a bad thing, visit GPL considered Harmful
gschem2xpcb --input_file=board.sch --output_file=board.pcb cvs add -m "created board.pcb" board.pcb
This program does not respond to any environment variables except those which may influence the loader or C library.
This program should port easily to most UNIX compatible systems even cygwin over windoze.
mkdir /dist cd /dist wget http://www.freelabs.com/~whitis/software/gschem2xpcb/download/gschm2xpcb_latest.tar.gz make clean make make install