Bill, geda-dev readers,
Here are a couple of changes I have made to gsch2pcb which might help
newbies use it. I did these because I was experiencing annoyances
taking a schematic to layout. Please find patches implementing these
changes below.
* I was continually annoyed by "Syntax error" messages when running
pcb. These were occuring because I had unresolved M4 symbols in my
design, and gsch2pcb/gnetlist was putting PKG_foo into the output
file, which made pcb unhappy. To fix this I made "remove-unfound" the
default behavior. This makes gsch2pcb keep PKG_foo out of the
.new.pcb file if it can't resolve PGK_foo. I also installed flags -k
and --keep-unfound into gsch2pcb if you do want to have PKG_foo show up
in the .new.pcb file. These flags are documented when you do
"gsch2pcb --help".
Yes, I know that the user should know of unresolved packages.
However, I don't think that causing PCB to barf is the best way to
tell him. Gsch2pcb already spits out errors for unresolved pacakges;
ultimately I am thinking about patching PCB so that if it sees an
unresolved package it spits a warning and keeps on going. Right now
I think it doesn't load anything if it finds an unresolved package.
(I might be wrong here . . . .)
* Upon exit, I made gsch2pcb should provide instructions about what
to do next. This is because it took me a while to figure out that I
had to do "pcb foo.pcb" and then copy the new elements in via
"file->load layout data to paste buffer". Is this documented
anywhere? Probably, but I am lousy at reading the documentation, and I
suspect that many newbies would also be confused by this.
Here's an example of the output spew I get now when taking new
footprints into a pre-existing project:
----------------------- <spew> ---------------------
[EMAIL PROTECTED] ~/InorBoard]$ gsch2pcb project
m4: /usr/X11R6/lib/X11/pcb/m4/common.m4: No such file or directory
U?: can't find PCB element for footprint DIP14 (value=unknown)
So device U? will not be in the layout.
Rpwr: can't find PCB element for footprint SMD_1206 (value=10)
So device Rpwr will not be in the layout.
Z1: can't find PCB element for footprint SMB (value=1SMB5930BT3)
So device Z1 will not be in the layout.
Done processing. Work performed:
3 file elements and 0 m4 elements added to InorBoard.new.pcb.
3 unknown elements removed from InorBoard.new.pcb.
Next steps:
Run pcb on your file InorBoard.pcb. From within PCB, select
"file -> Load layout data to paste buffer" and copy new
footprints from InorBoard.new.pcb into your existing layout.
--------------------- </spew> -----------------------
Bill, if you like these patches, I can put them in gEDA CVS if you
don't have access. Also, if you don't like the spew, I can create a
-q/--quiet flag to quiet the output of gsch2pcb.
Just let me know . . . .
Stuart
-------------------- Patches --------------------
This diff is against a version of gsch2pcb living in CVS as of last
October or November. I believe it is against gsch2pcb-1.4. The
diff is "diff old new"
---
/usr/local/src/geda-sources-20041016/gedagaf/geda-utils-20040710/src/gsch2pcb.c
2004-01-11 17:31:22.000000000 -0500
+++ gsch2pcb.c 2005-01-12 04:58:48.479406880 -0500
@@ -94,7 +94,7 @@
n_none,
n_empty;
-static gboolean remove_unfound_elements,
+static gboolean remove_unfound_elements = TRUE,
force_element_files,
preserve,
fix_elements,
@@ -1086,9 +1086,15 @@
if (!strcmp(config, "remove-unfound") || !strcmp(config, "r"))
{
+ /* This is default behavior set in header section */
remove_unfound_elements = TRUE;
return 0;
}
+ if (!strcmp(config, "keep-unfound") || !strcmp(config, "k"))
+ {
+ remove_unfound_elements = FALSE;
+ return 0;
+ }
if (!strcmp(config, "preserve") || !strcmp(config, "p"))
{
preserve = TRUE;
@@ -1202,6 +1208,11 @@
" -r, --remove-unfound Don't include references to unfound elements in\n"
" the generated .pcb files. Use if you want PCB to\n"
" be able to load the (incomplete) .pcb file.\n"
+" This is the default behavior.\n"
+" -k, --keep-unfound Keep include references to unfound elements in\n"
+" the generated .pcb files. Use if you want to hand\n"
+" edit or otherwise preprocess the generated .pcb
file\n"
+" before running pcb.\n"
" -p, --preserve Preserve elements in PCB files which are not found\n"
" in the schematics. Note that elements with an
empty\n"
" element name (schematic refdes) are never deleted,\n"
@@ -1390,8 +1401,10 @@
update_element_descriptions(pcb_file_name, bak_file_name);
prune_elements(pcb_file_name, bak_file_name);
+ /* Report work done during processing */
if (verbose)
printf("\n");
+ printf("\nDone processing. Work performed:\n");
if (n_deleted > 0 || n_fixed > 0 || need_PKG_purge || n_changed_value >
0)
printf("%s is backed up as %s.\n",
pcb_file_name, bak_file_name);
@@ -1401,8 +1414,8 @@
if (n_added_ef + n_added_m4 > 0)
printf("%d file elements and %d m4 elements added to %s.\n",
n_added_ef, n_added_m4,
pcb_new_file_name);
- else if (n_not_found == 0)
- printf("No elements to add so not creating %s\n",
pcb_new_file_name);
+ else if (n_not_found == 0)
+ printf("No elements to add so not creating %s\n",
pcb_new_file_name);
if (n_not_found > 0)
{
printf("%d not found elements added to %s.\n",
@@ -1432,5 +1445,17 @@
printf("%d elements not in the schematic preserved in %s.\n",
n_preserved, pcb_file_name);
+ /* Tell user what to do next */
+ if (verbose)
+ printf("\n");
+
+ if (n_added_ef + n_added_m4 > 0)
+ {
+ printf("\nNext steps:\n");
+ printf("Run pcb on your file %s. From within PCB, select\n",
pcb_file_name);
+ printf("\"file -> Load layout data to paste buffer\" and copy
new\n");
+ printf("footprints from %s into your existing layout.\n",
pcb_new_file_name);
+ }
+
return 0;
}