Pass r_NoHolesPolygonDicer a POLYAREA *, not a PLINE *
[geda-pcb/gde.git] / doc / pcb.texi
blobb1adb89478d1d06d932e3bd4224302944959545d
1 \input texinfo    @c -*-texinfo-*-
2 @comment RCS: $Id$
3 @comment %**start of header
4 @setfilename pcb.info
5 @settitle Pcb
6 @setcontentsaftertitlepage
7 @comment %**end of header
9 @include version.texi
11 @ifinfo
12 @format
13 INFO-DIR-SECTION Miscellaneous
14 START-INFO-DIR-ENTRY
15 * pcb: (pcb).                   An interactive printed circuit board editor.
16 END-INFO-DIR-ENTRY
17 @end format
18 @end ifinfo
20 @iftex
21 @finalout
22 @end iftex
24 @ifinfo
25 This file documents how to use Pcb,
26 the interactive printed circuit board layout system for @code{X11}.
28 Copyright (C) 1994,1995,1996, 2004 Thomas Nau
30 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 harry eaton
32 Copyright (C) 2003, 2004, 2005, 2006, 2007 Dan McMahill
34 Copyright (C) 2004 DJ Delorie
36 This program is free software; you may redistribute it and/or modify
37 it under the terms of the GNU General Public License as published by
38 the Free Software Foundation; either version 2 of the License, or
39 (at your option) any later version.
41 This program is distributed in the hope that it will be useful,
42 but WITHOUT ANY WARRANTY; without even the implied warranty of
43 MERCHANT-ABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
44 @b{GNU General Public License} for more details.
46 @end ifinfo
48 @setchapternewpage on
49 @headings single
51 @titlepage
52 @title Pcb-@value{VERSION}
53 @subtitle an interactive
54 @subtitle printed circuit board
55 @subtitle layout system for @code{X11}
56 @author harry eaton
57 @end titlepage
59 @ifnottex
60 @node Top
61 @top Pcb
63 This document is a manual for @code{Pcb}, the interactive printed circuit
64 board layout system for @code{X11}.
65 @end ifnottex
67 @menu
68 * Copying::                @code{Pcb} is freely redistributable!
69 * History::                How it all began.
70 * Overview::               An overview of @code{Pcb}.
71 * Intro::                  A short description of the basic objects.
72 * Getting Started::        Introduction to @code{Pcb}.
73 * Autorouter::             Using the autorouter.
74 * User Commands::          User commands of @code{Pcb}.
75 * Command-Line Options::   Calling @code{Pcb} from a shell.
76 * X11 Interface::          Action routines, resources and default translation.
77 * File Formats::           Description of @code{ASCII} files used by @code{Pcb}.
78 * Library Creation::       Detailed description of symbol library creation.
79 * Schematic Frontends::    Schematic capture programs that work with PCB.
80 * Installation::           Compiling, installing and troubleshooting.
81 * Custom Menus::           Customizing the menu bar.
82 * Regular Expressions::    Searching for elements with regular expressions
83 * Standard Drill Sizes::   Tables of standard drill sizes
84 * Centroid File Format::   Details of the centroid (x-y) output file
85 * Action Reference::       Documentation for all available actions
86 * Glossary::               Glossary
87 * Index::                  The Index.
88 @end menu
90 @c ---------------------------------------------------------------------
91 @node Copying
92 @unnumbered Copying
94 Copyright @copyright{} 1994,1995,1996,1997 Thomas Nau
96 Copyright @copyright{} 1998,1999,2000,2001,2002 harry eaton
98 This program is free software; you may redistribute it and/or modify
99 it under the terms of the GNU General Public License as published by
100 the Free Software Foundation; either version 2 of the License, or
101 (at your option) any later version.
103 This program is distributed in the hope that it will be useful,
104 but WITHOUT ANY WARRANTY; without even the implied warranty of
105 MERCHANT-ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
106 @b{GNU General Public License} for more details.
109 @c --------------------------- chapter 0 -------------------------------
110 @node History
111 @unnumbered History
113 @cindex Atari version
114 @code{Pcb} is a handy tool for laying out printed circuit
115 boards.
117 @code{Pcb} was first written by Thomas Nau for an Atari ST in 1990 and
118 ported to @code{UNIX} and @code{X11} in 1994.
119 It was not intended as a professional layout system,
120 but as a tool which supports people who do some
121 home-developing of hardware.
123 The second release 1.2 included menus for the first time. This made
124 @code{Pcb} easier to use and thus a more important tool.
126 Release 1.3 introduced undo for highly-destructive commands,
127 more straightforward action handling and scalable fonts. Layer-groups
128 were introduced to group signal-layers together.
130 Release 1.4 provided support for add-on device drivers.
131 Two layers (the solder and the component side)
132 were added to support SMD elements. The handling of libraries
133 was also improved in 1.4.1. Support for additional devices like
134 GERBER plotters started in 1.4.4. The undo feature was expanded
135 and the redo-feature added in 1.4.5.
137 harry eaton took over pcb development beginning with Release 1.5,
138 although he contributed some code beginning with Release 1.4.3
140 Release 1.5 provides support for rats-nest generation from simple net
141 lists.  It also allows for automatic clearances around pins that pierce
142 a polygon.  A variety of other enhancements including a Gerber RS-274X
143 driver and NC drill file generation have also been added.
145 Release 1.6 provides automatic screen updates of changed regions.
146 This should eliminate most of the need for the redraw ((@emph{R} key).
147 Also some changes to what order items under the cursor are selected
148 were made for better consistency - it is no longer possible to
149 accidentally move a line or line point that is completely obscured
150 by a polygon laying over top of it.  Larger objects on the upper
151 most layers can be selected ahead of smaller objects on lower layers.
152 These changes make operations more intuitive.  A new mode of line
153 creation was added that creates two line on 45 degree angles
154 with a single click. The actual outline of the prospective line(s) are
155 now shown during line creation.  An arc creation mode was added.
156 Drawn arcs are quarter circles and can be useful for high frequency
157 controlled impedance lines.  (You can have eighth circle arc if the
158 source is compiled with -DARC45, but be aware that the ends of such
159 arcs can never intersect a grid point).  Two new flags for pins and
160 vias were created - one indicates that the pin or via is purely a
161 drill hole and has no copper annulus.  You can only toggle this flag
162 for vias - for elements, it must be an integral part of the element
163 definition.  The other flag controls whether the pad will be round
164 or octagonal.  There is also now a feature for converting the contents
165 of a buffer into an element.
167 Release 1.6.1 added the ability to make groups of action commands bound to
168 a single X11 event to be undone by a single undo. Also a simple design rule
169 checker was added - it checks for minimum spacing and overlap rules. Plus
170 many fixes for bugs introduced with the many changes of 1.6
172 Release 1.7 added support for routing tracks through polygons without touching
173 them. It also added support for unplated drill files, and drawing directly
174 on the silk layer. A Netlist window for easily working with netlist was also added.
176 Release 2.0 adds an auto-router, a new simpler library mechanism, much improved
177 support for graphically creating (and editing) elements, viewable solder-mask
178 layers (and editing), snap to pins and pads, netlist entry by drawing rats, element
179 files (and libraries) that can contain whole sub-layouts, metric grids, improved
180 user interface, a GNU autoconf/automake based build system, and a host
181 of other improvements.
183 Special thanks goes to:
184 @display
185 Thomas Nau (who started the project and wrote the early versions).
186 C. Scott Ananian (who wrote the auto-router code).
187 Bernhard Daeubler (Bernhard.Daeubler@@physik.uni-ulm.de)
188 Harald Daeubler (Harald.Daeubler@@physik.uni-ulm.de)
189 DJ Delorie (djdelorie@@users.sourceforge.net)
190 Larry Doolittle (ldoolitt@@recycle.lbl.gov)
191 Dan McMahill (danmc@@users.sourceforge.net)
192 Roland Merk (merk@@faw.uni-ulm.de)
193 Erland Unruh (Erland.Unruh@@malmo.trab.se)
194 Albert John FitzPatrick III (ajf_nylorac@@acm.org)
195 Boerge Strand (borges@@ifi.uio.no)
196 Andre M. Hedrick (hedrick@@Astro.Dyer.Vanderbilt.Edu)
197 @end display
199 @exdent who provided all sorts of help including porting @code{Pcb} to
200 several operating systems and platforms, bug fixes, library enhancement,
201 user interface suggestions and more. In addition to these people,
202 many others donated time for bug-fixing and
203 other important work. Some of them can be identified in the source code
204 files.  Thanks to all of them. If you feel left out of this list, I
205 apologize; please send me an e-mail and I'll try to correct the omission.
208 @c --------------------------- overview chapter -------------------------------
209 @node Overview
210 @chapter Overview
211 @cindex PCB, an overview
213 Pcb is a printed circuit board editor for the X11 window system.
214 Pcb includes many professional features such as:
215 @itemize @bullet
216 @item Up to 16 copper layer designs by default.  By changing a compile time setting, this
217 can be set as high as needed.
218 @item RS-274X (Gerber) output
219 @item NC Drill output
220 @item Centroid (X-Y) data output
221 @item Postscript and Encapsulated Postscript output
222 @item Autorouter
223 @item Trace optimizer
224 @item Rats nest
225 @item Design Rule Checker (DRC)
226 @item Connectivity verification
227 @item Pcb is Free Software
228 @item Can interoperate with free schematic capture tools such as gEDA and
229   xcircuit
230 @end itemize
232 @c --------------------------- chapter 1 -------------------------------
233 @node Intro
234 @chapter Introduction
235 @cindex layout objects, an overview
237 Each layout consists of several, mostly independent, objects. This chapter
238 gives an overview of the object types and their relationship to each other.
239 For a complete description of how to use @code{Pcb}, refer to
240 @ref{Getting Started}.
241 The layout is generated on-screen on a grid that can have its origin
242 at any desired location.
243 The X coordinate increases to the right, Y increases down to the bottom.
244 All distances and sizes in @code{Pcb} are measured in mils
245 (0.001 inch).  One unit on the coordinate display is one mil in
246 distance on the board. 
247 The grid may be set on a metric pitch, but is only correct to within
248 the nearest +/- 0.01 mil because @code{Pcb} stores all dimensions as
249 integer multiples of 1/100 of a mil or 0.00001 inch.
251 The sections in this chapter are sorted by the
252 order of appearance of the objects within a layout file.
254 @menu
255 * Symbol Objects::         Information about fonts and symbols.
256 * Via Objects::            Vias and pins connect layers.
257 * Element Objects::        Element, the basic type of circuits.
258 * Layer Objects::          A @samp{container} for lines, text...
259 * Line Objects::           Tracks on the board
260 * Arc Objects::            Curved tracks
261 * Polygon Objects::        Planes and such
262 * Text Objects::           Objects to add symbols to your board.
263 * Net Objects::            Describes the desired connections on the board.
264 @end menu
266 @node Symbol Objects
267 @section Symbols
268 @cindex symbols, an overview
269 @cindex font, an overview
271 The top object is the layout itself. It uses a set of symbols
272 that resides at the first logical level. Each symbol is uniquely identified
273 by a seven bit @code{ASCII} code. All layout objects share the same set of
274 symbols. These symbols are used to form text objects on the silkscreen
275 and copper layers.  Undefined symbols are drawn as filled rectangles.
277 Every font file is preprocessed by a user-defined command when it is loaded.
278 For details see @samp{fontCommand}, @ref{Resources}.
281 @node Via Objects
282 @section Vias
283 @cindex vias, an overview
285 Vias provide through-hole connectivity across all layers.
286 While vias look a lot like element pins, don't use vias
287 for adding elements to the layout, even if that seems
288 easier than creating a new element. The default solder-mask
289 will cover over vias, so you won't be able to solder to them.
290 Of course, you can change this so that vias also have
291 solder-mask cut-outs, but it is not the default.
292 Vias are also useful for defining arbitrary drill points such as
293 those used for mounting a board. Vias used in this way have
294 a special flag set so that they have no annular copper ring,
295 and also appear in the unplated drill file. @emph{Ctrl-H} key over
296 a via switches it between being a pure-mounting hole and a regular via.
297 You can assign a name to a via, which is useful during the creation
298 of new element definitions.
299 Each via exists on all copper layers. (@emph{i.e.}
300 blind and buried vias are not supported)
303 @node Element Objects
304 @section Elements
305 @cindex element, an overview
306 @cindex layout-name
308 Elements represent the components on a board.
309 Elements are loaded from @code{ASCII} coded files in a
310 similar manner to the layout file itself, or from the
311 library selector window.
312 An element is composed of lines and arcs on the silk-screen
313 layer (used to define the package outline), pins
314 (or pads for SMD) and three labels that define the
315 description, the element's layout-name (which also
316 appears on the silk-screen layer) and its value. You
317 can choose which of the names are displayed on the screen
318 with the @b{Screen} menu; however, the silk screen in
319 the printout will always show the layout-name.
320 Element pins are contained on the first logical level
321 and so reside on all layers, but the pads of surface-mount
322 elements reside on only the component or solder
323 layers. An element can have a mixture of pins, pads
324 (on one or both sides), and mounting holes.
326 A mark is used to position the element with
327 respect to the cross hair during pasting.
328 The mark will lie on a grid point when the element
329 is positioned.  The mark is drawn as a small diamond
330 shape, but is only visible when @emph{both} the @code{silk}
331 and @code{pins/pads} layers are visible.
332 All parts of an element are treated as one unit, except for
333 the name.
334 It is not possible to delete a single pin or move
335 only part of an element on the layout.
336 You can resize separate pieces of an element,
337 but doing so is usually a bad idea. You can move/rotate
338 the element name independently of the element it belongs
339 to. When you move an element name, a line is draw from
340 the cursor to the element mark so it is easy to tell
341 which element the name belongs to.
344 Each pin and pad has two string identifiers, one is the
345 "name" which is a functional description of the pin
346 (@emph{e.g.} "clock in") and the other is the "number" of the
347 pin which is used to identify it in a netlist. The "number"
348 is usually an integer, but it can be any string. You
349 can edit the "name" of each pin of an element, but the
350 "number" is embedded in the element definition and is
351 determined when the new element is first created.
352 Pads are similar to lines on a layer but they must be oriented
353 either vertically or horizontally.
354 Pads can have either rounded or square ends. Pins
355 can be round, square, or octagonal.
358 Elements are supported by several special layers: @code{silk}, @code{pins/pads} and
359 @code{far-side}.  The @code{silk} layer shows the package outline and
360 also holds legend text and element names. The @code{pins/pads} layer is used to toggle
361 whether the element's pins and pads are displayed. The @code{far-side} layer controls visibility
362 of objects (silkscreen and pads) that are on the far (@emph{i.e.} not currently viewed) side
363 of the board.
365 The ``oldlib'' style of footprint libraries distributed with
366 @code{Pcb} rely upon the M4 macro processor.  M4 is typically
367 installed under the name @code{m4} on most unix-like operating
368 systems.  It is recommended that you use the GNU version of M4 to
369 avoid limitations found in some vendor implementations.  See the m4
370 man page on your system for more information.
371 Every element file is preprocessed by a user-defined command when the file is read.
372 For details see @samp{elementCommand}, @ref{Resources}. @code{m4}, the default
373 value of @samp{elementCommand}, allows you to create libraries for
374 package definitions that are shared by all elements.
375 The old element libraries distributed with @code{Pcb} expect @code{m4} or an
376 equivalent to be the @emph{elementCommand}. The new library scheme simply has
377 each element stored in a self-contained file, so there is no need to learn
378 @code{m4} to add to the libraries.
380 @code{Pcb} can create a list of
381 all connections from one (or all) elements to the others or a list of
382 unconnected pins.
383 It can also verify the layout connections against a netlist file.
384 The element's @samp{layout-name} is the name used to identify the element
385 in a netlist file (see @ref{Netlist File}).
387 The old libraries, or very old (pre-1.6) layout files may have
388 incorrect pin numbering since there was no concept of pin numbers
389 when they were created. @code{Pcb} uses the order of appearance of
390 the pin definitions in the layout or library file if it uses the
391 old format, but there is no guarantee that it will be correct for
392 these old objects.
394 @cindex old library
395 @cindex library accuracy
396 @b{Be aware that a few of the old library parts may still be incorrectly
397 implemented regarding pin-numbering.}  All of the DIL (Dual-
398 Inline-Pins) parts are correct and most of the others are too,
399 but you should verify the pin numbering
400 of any non-DIL part before using an old library part.
401 (use the @samp{generate object report} in the @b{Info} menu
402 to see what @code{Pcb} thinks a pin's number is)
403 All of the old
404 library names begin with a ~, so you can easily identify them.
405 The old libraries also @emph{may} contain other sorts of errors,
406 including incorrect pin spacing, silkscreen overlapping solder areas, etc.
407 @b{Check carefully any element in the old library before using it!}
408 As the new library grows, the old library will be pared down to
409 at least remove all of the elements with errors, but this will
410 take time.
412 You can make your own element definitions graphically now.
413 Simply draw vias for the pins, lines on the solder and/or
414 component layers for surface-mount pads (they must be either horizontal
415 or vertical),
416 and lines and arcs on the silkscreen layer for the silkscreen
417 outline. You should @emph{name} (@emph{N} key) each via and copper line with the pin @emph{number}.
418 Once you are happy with the geometry, select everything that is to become part of
419 the element, then choose @samp{convert selection to element} from the @b{Select} menu.
420 Afterwords you can make pin (or pad) one
421 square if you like, and give the element its various names. You can also give
422 the pins and pads their functional names. Note that the
423 element mark corresponds to the position you click after choosing the
424 conversion from the menu, so decide where the mark goes and make
425 sure it falls on a grid point before you request the conversion.
426 If the vias/lines are not named, then the pin numbering will correspond to the
427 order in which they were placed.
429 When you create a new element, remember that silkscreen lines
430 should @emph{never} overlap the copper part of the
431 pins or pads, as this can interfere with soldering. The silkscreen
432 should identify the maximum extent of the element package so it
433 is easy to see how close elements can be placed together.
435 If you want to make an element similar to an existing one, you can
436 break an element into constituent pieces from the @b{Buffer} menu.
437 Paste the pieces to the layout, make the necessary changes, then
438 convert it back into an element. If the pin numbers haven't changed,
439 there is no need to name each via/line as they are pre-named when
440 the element was broken apart. When you create a new element, you
441 can save it to a file in order to have easy access to it the next
442 time you run @code{Pcb}.
445 @node Layer Objects
446 @section Layers
447 @cindex layers, an overview
449 Every layout consists of several layers that can be used independently
450 or treated as a group.
451 Layer groups can be used to logically separate (and color-code)
452 different traces (@emph{e.g.} power and signal); however, all
453 layers within a group reside on the same physical
454 copper layer of a board, so using different layers within the same
455 group won't provide electrical separation where they touch or overlap.
456 For details, see @samp{layerGroups}, @ref{Resources}.
457 Each layer is drawn in a color defined in the resource file
458 and identified by a name that you can change (for details
459 see @samp{layerColor}, @ref{Resources}.)
460 Layers are really just containers for line, arc, polygon, and text objects.  The
461 component and solder layers contain SMD elements as well, but the
462 file structure doesn't reflect that fact directly.
464 @cindex layer groups
465 Each layer group
466 represents a physical layer on the printed circuit board.  If you want to make
467 a four layer board, you'll need to have at least four layer groups.
468 Connections between layer groups are established only through element pins and vias.
469 The relationship between a specific layer and the board itself is configurable from
470 the @samp{Edit layer groups} option in the @b{Settings} menu.
471 The layer groups corresponding to the physical layers: @emph{component-side}
472 and @emph{solder-side} are always defined and you must map at least one
473 logical layer to each, even if you plan to make a single-sided board.
474 You are not obligated to put tracks on either of them.
475 Surface mount elements always reside on either the component-side or the
476 solder-side layer group. When you paste an element from the buffer,
477 it will go onto whichever side of the board you are viewing.
478 You can swap which side of the board you are viewing by pressing
479 the @emph{Tab} key, or by selecting @samp{view solder side} from the
480 @b{Screen} menu.
481 The layer groups just have a name or number associated with them - where
482 they are sandwiched in the board is left for you to tell the
483 manufacturer.
485 The silkscreen layer is special because there are actually two silkscreen
486 layers, one for the top (component) and one for the bottom (solder) side
487 of the board. Which silk layer you draw on is determined by the side of the
488 board that you are viewing. If you are viewing the component side, then
489 drawing on the silk layer draws to the component-side silk layer.
491 The netlist layer is another special layer. It shows rat's-nest lines
492 (@emph{i.e.} guides that show how the netlist expects the element to interconnect).
493 If you make this the active layer, you can use the Line tool to add
494 entries into the netlist, or to delete connections from the netlist
495 window. Except for these two purposes, you should not
496 make the netlist layer the active layer. Usually there is no need to
497 do this because a separate schematic package should be used to create the
498 netlist. @code{Pcb} can automatically draw all of the rats from
499 the netlist. In some cases you may want to make a small change without
500 going to the trouble of modifying the schematic, which is why this
501 facility is provided.
504 @node Line Objects
505 @section Lines
506 @cindex lines, an overview
508 Lines are used to draw tracks on the pc board.
509 When in the line mode, each @emph{Btn1}
510 press establishes one end of a line.
511 Once the second point is defined, the line is drawn
512 and a new line started where the first one ended.
513 You can abandon the new starting point in favor
514 of another by pressing @emph{Ctrl-Btn1}, or
515 @emph{Btn3}, but don't use @emph{Btn2}.
516 The undo function (@emph{U} key or @samp{undo last operation}
517 from the @b{Edit} menu) will take you back
518 point by point if you use it while in the line mode. If you drag
519 the pointer out of the Layout area while drawing a line, the
520 display will auto-scroll (assuming sufficient zoom for scrolling).
521 To stop auto-scroll, simply pass the pointer over the panner control.
523 @cindex two line mode
524 New lines can be restricted to 45 degree angles if desired. You can toggle this
525 restriction on and off while creating lines by pressing the @emph{period} key.
526 If the 45 degree restriction is turned on, then the @emph{/} (forward slash) key
527 can be used to cycle through three different modes of 45 degree line creation.
528 One mode just creates a single line forced to the nearest 45 degree vector.  The next
529 mode creates two lines from the start to end points such that the first line leaves the
530 start point at a 90 degree vector, and the second line enters the end point on a 45
531 degree vector. The last mode creates two lines such that the first line leaves the
532 start point on a 45 degree vector and arrives at the end point on a 90 degree vector.
533 You can temporarily swap between the last two modes by holding the @emph{Shift} key down.
535 It is simple to edit a line object by breaking it into pieces (insert point mode),
536 moving an end point or the whole line (@emph{Arrow tool}),
537 or changing the layer it resides on (@emph{M} key moves the line under the pointer
538 to the active layer).
539 In the case when two line segments meet at exactly the same
540 point you can delete the intermediate point, otherwise the delete tool removes an entire line.
541 Feel free to experiment
542 since @code{Pcb} will allow you to undo and redo anything that materially affects your work.
543 If you switch active layers in the midst of placing lines a via will automatically be
544 placed, when necessary, in order to continue the connection.
546 @cindex clearance
547 If you draw a line inside a polygon, it will either plow through the
548 polygon creating a clearance, or touch the polygon. This behavior is
549 selectable in the @b{Settings} menu for new lines. To change the
550 behavior of an existing line, hit the @emph{J} key with the cross hair
551 over the line. You can increase the size of the clearance by 2 mils on
552 each edge with the with the
553 @emph{K} key. @emph{Shift-K} will decrease the clearance by 2 mils.
554 The increment may be changed from 2 mils through the application
555 resource file.
556 The clearance can be also increased, decreased and set
557 by the @emph{ChangeClearSize} action.
559 Lines do not need to intersect the center of a pin, pad, via, or other
560 line for @code{Pcb} to understand that they make electrical connection.
561 If the connection is too tenuous, running the design rule checker will report
562 that the connection may break if the line width shrinks slightly.
565 @node Arc Objects
566 @section Arcs
567 @cindex arc
569 @code{Pcb} can handle arcs of any angular extent, but when you
570 create an arc with the Arc tool, it will
571 be a quarter circle (this means they always bend a right angle).  Arcs are very similar
572 to lines otherwise.  They are created on the active layer and have the same thickness
573 that new lines will have.  The various clicks for creating lines work pretty much the
574 same way for creating arcs.
575 In order to make the arc curve in the desired direction, drag the mouse along
576 the tangent line from the starting position towards the end position. If the grid is
577 too coarse, it may not be possible to distinguish whether you've moved over then up,
578 or up then over, so if you can't seem to make the arc go in the direction you want, try pressing
579 the @emph{Shift} key while drawing the arc. Decreasing the grid spacing may also help.
580 Alternatively you can draw the wrong arc, then
581 rotate and move it where you want. Like the Line tool, after an arc is drawn a new
582 starting point is established at the end point.
584 Whenever a starting point is established
585 by either the Line or Arc tools it will be retained if you switch directly between the
586 tools (e.g. @emph{F2} key for Lines, @emph{F8} key for Arcs. Arcs can either touch or
587 clear polygons just like lines do. Of course connection
588 searches, undo and all the other features you'd expect work with arcs too.
591 @node Polygon Objects
592 @section Polygons
593 @cindex polygon, an overview
595 Sometimes it's useful to fill large areas with solid copper.
596 The way to do this is with polygons.
597 Polygons can be created in either the polygon mode or the rectangle mode.
598 In the polygon mode, you'll have to define each corner of the polygon
599 with a mouse click (@emph{Btn1}). When the last point is clicked
600 exactly on top of the starting point, the polygon is finished.
601 Since this can be hard to do, the @emph{Shift-P} key will enter the
602 final point for you, closing the polygon.
603 If the 45 degree angle restriction is turned on
604 and you try to close the polygon when it is not possible, you'll get a
605 warning instead. If you haven't finished entering a polygon, but want to
606 undo one (or more) of the points that you've already defined, use the
607 undo command (@emph{U} key).
609 With the rectangle tool, defining
610 the two diagonally opposite corners is sufficient, but of course the resulting
611 polygon is a rectangle.
612 Like lines, a polygon can by edited by deleting, inserting and moving the points
613 that define it. Pins and vias @emph{always} clear through polygons without
614 touching them when first positioned. You must add a thermal with the thermal
615 tool in order to connect pins and vias to polygons. Thermals can be added and removed by
616 clicking @emph{Btn1} with the thermal tool over the pin or via.
617 The thermal tool always
618 places a thermal to polygons on the active layer, so if the tool doesn't
619 seem to work, it's probably because the polygon you want to touch is not
620 on the active layer.
622 @code{Pcb} is capable of handling complex polygons, but
623 using a number of simpler ones improves performance of the connection tracing code.
624 You also must be careful not to create polygons that touch or overlap themselves.
625 The fabricated board may not look the way you expect if you violate this
626 principle. It is always ok to have two (or more) polygons touch or overlap
627 each other, but not for points within the same polygon to do so.
629 The great advantage to this new polygon behavior is that simple or complex ground
630 and/or power planes can be easily made with polygons and seen on the screen.
631 If you don't want this auto-clearance behavior, or you load a layout created by
632 an early version of @code{Pcb}, the old behavior
633 (shorts to all piercing pins and vias) is available.  A @samp{ChangeSize}
634 operation (@emph{S} key) toggles a polygon between the new and old polygon/pin
635 behavior.
638 @node Text Objects
639 @section Text
640 @cindex text, an overview
641 @cindex strings, an overview
643 Text objects should be used to label a layout or to put additional
644 information on the board. Elements have their @samp{layout-name} labels on the
645 silk-screen layer. If you are making a board without a silkscreen,
646 you can use copper text to label the elements, but you have to do
647 this manually.
649 Text is always horizontal when first created, but the
650 rotate mode can align it along 0, 90, 180 and 270 degree angles.
651 Text on the far side of the board will automatically appear mirror-imaged.
653 @emph{Warning:} @b{TEXT OBJECTS ON A COPPER LAYER CREATE COPPER LINES BUT THEY ARE NOT SCANNED FOR
654 CONNECTIONS OR TESTED FOR CREATING SHORTS VS. THE NETLIST. NEITHER ARE TEXT OBJECTS TESTED AGAINST ANY DESIGN RULES}.
657 @node Net Objects
658 @section Nets
659 @cindex rats-nest
660 @cindex netlist
662 Layout files also contain the netlist that describes how the elements
663 are supposed to be interconnected. This list of connections can be
664 loaded from a netlist file (see @ref{Netlist File}), or
665 entered by drawing rat-lines as described
666 previously. Each net has a name and routing style associated with it.
667 The net contains a list of all element @emph{layout-name} names and
668 pin @emph{numbers} that should
669 be connected to the net. Loading a netlist file will replace all
670 existing nets with the ones from the file.
671 The @emph{Netlist} window provides an easy way to
672 browse through the net list. You can display the rat's-nest by selecting
673 @samp{optimize rats-nest} from the @b{Connects} menu. If you move or rotate elements,
674 the rat's-nest will automatically follow the movements, but they won't
675 necessarily show the shortest paths until you optimize them again.
677 @c --------------------------- chapter 2 -------------------------------
678 @node Getting Started
679 @chapter Getting Started
680 @cindex how to start
682 The goal of this chapter is to give you enough information to learn how
683 @code{Pcb} works and how to develop your layouts to make the best use of @code{Pcb}'s
684 features. All event translations (@emph{i.e.} the buttons and keys you
685 press) refer to the default application resource file shipped with @code{Pcb}.
686 There is probably no need to change this unless your window
687 manager uses some of the button events itself; however, if you @emph{want}
688 to customize the behavior of @code{Pcb} then changing the resource file
689 is usually the best way to do it.
691 Get yourself a printout of this chapter and @emph{User Commands}, if you
692 haven't already done so, and follow the examples.
694 Start @code{Pcb} (the actual command will use all lower-case letters)
695 without any additional options.
696 If you get the error message:
698 @display
699     can't find default font-symbol-file 'default_font'
700 @end display
701 @exdent then the font searchpath or filename in the application resource
702 file is wrong. Be sure that your @code{m4} program supports search paths.
703 If not, get @code{GNU m4}.
704 For other messages, see @ref{problems}.
705 Another quick-start is provided by @code{pcbtest.sh} in the @file{src}
706 directory. If some features don't seem to work, try running @code{pcbtest.sh},
707 if that works, then @code{Pcb} hasn't been installed properly.
709 @menu
710 * Application Window::     The elements of the main window.
711 * Log Window::             The optional logging window
712 * Library Window::         The circuit selection window
713 * Netlist Window::         The desired connections window
714 * Drawing and Removing::
715 * Moving and Copying::
716 * Loading and Saving::
717 * Printing::               Creating Gerber files or postscript files
718 * Arrow Tool::             Selecting/Moving objects.
719 * Rats Nest::              Helps you place and route tracks against a netlist.
720 * Design Rule Checking::   Check for manufactureability
721 * Trace Optimizer::        Optimization of layouts
722 * Searching for elements:: Searching for elements
723 * Measuring distances::    Measuring distances
724 * Vendor drill mapping::   Mapping drills to a vendor specified list
725 * Connection Lists::       How to get a list of all or some connections.
726 @end menu
729 @node Application Window
730 @section The Application Window
732 The main window consists of six areas:
733 the menu at the top, the panner control in the upper left corner, the layer
734 controls located below the panner, the tool buttons
735 located below the layer controls, the Layout area to the right of these, and the
736 status line at the bottom of the window.
738 @menu
739 * Menu::
740 * Status-line and Input-field::  What is the program configuration.
741 * Panner Control::               Used to pan the layout view when zoomed in.
742 * Layer Controls::               Switch layers on/off; change current one.
743 * Tool Selectors::               Select a layout tool.
744 * Layout Area::                  Where the layout is drawn.
745 @end menu
747 @node Menu
748 @subsection Menus
749 @cindex menus
750 @cindex popping up menus
752 The menus are located at the top of the Layout area. Most, but not all,
753 of their functions are also available from the keyboard. Similarly, some
754 functions are only achievable through the keyboard or command entry.
755 Some menu entries such as @samp{center layout} in the @b{Screen} menu require a certain cross hair position.
756 In this case a prompt message will popup at the bottom of the screen
757 with wording similar to the following:
758 @example
759 move pointer to the appropriate screen position and press a button
760 @end example
761 Any mouse button will do the job, whereas any key except the arrow (cursor) keys
762 will cancel the operation. If it seems like the menu hasn't done what you
763 expected, check to see if it is waiting for the position click. For details see @ref{Actions}.
765 Pressing @emph{Btn3} in the Layout area also pops up a menu with many of the most common operations (except
766 when you're in the midst of drawing a line or arc). When
767 a choice in the @emph{Btn3} popup menu needs a cross hair position, it uses the position
768 where the cross hair was when @emph{Btn3} was pressed. For example, to get detailed
769 information on an object, place the cross hair over the object, press @emph{Btn3}, then
770 choose @samp{object report}.  If you pop up the @emph{Btn3} menu but don't want to
771 take any of the actions, click on one of the headers in the menu.
773 @table @b
775 @cindex File, popup menu
776 @item File
777 This menu offers a choice of loading, saving and printing data, saving
778 connection information to a file or quitting the application. Most
779 of the entries in the @b{File} menu are self explanatory.
780 Selecting
781 @samp{print layout} pops up a printer control dialog.
782 A selection of several device drivers is available from the printer control
783 dialog. Presently @emph{PostScript}, @emph{encapsulated PostScript},
784 and @emph{GerberX} are supported. The @emph{GerberX} driver produces
785 all of the files necessary to have the board professionally manufactured.
786 The connection saving features in the @b{File} menu produce outputs in an
787 arcane format that is not too useful. They do @emph{not} produce netlist
788 files.
790 @cindex Edit, popup menu
791 @cindex undo
792 @cindex redo
793 @item Edit
794 The @b{Edit} menu provides the usual cut, copy, paste
795 which work on selections. To learn how to
796 create complex selections, see @ref{Arrow Tool}.
797 The @b{Edit} menu also
798 provides access to Undo and Redo of the last operation. These
799 can also be accomplished with the @emph{U} key and @emph{Shift-R}
800 key.  Finally, the @b{Edit} menu allows you to change the names
801 of: the layout, the active layer, or text objects on the layout.
803 @cindex Screen, popup menu
804 @cindex displaying element names
805 @cindex element, display names of
806 @cindex grid, display
807 @cindex grid, alignment
808 @cindex zoom, setting
809 @item Screen
810 The @b{Screen} menu supports most functions related to
811 the whole Layout area. There are various entries to change the grid to some popular
812 values, the zoom factor, and which kind of element name is displayed.
813 You can also re-align the grid origin and turn on and off the display
814 of the grid.
815 Before changing the grid alignment, I recommend that you zoom in as close as
816 possible so that you're sure the grid
817 points appear exactly where you want them.
819 @cindex solder mask, viewing and editing
820 The @b{Screen} menu also allows you to turn on and off the
821 visibility of the solder-mask layer. When the solder-mask layer
822 is made visible it obscures most of the layout, so only turn
823 this on when you really want to know what the solder-mask will
824 look like. The solder-mask that you see belongs to the
825 side of the board you are viewing, which can be changed with
826 the @samp{view solder side} option, also found in the @b{Screen} menu.
827 When the solder-mask is displayed, the pin and pad clearance adjustments
828 (@pxref{Line Objects}) alter the size of mask cut-outs.
830 @cindex Sizes, popup menu
831 @item Sizes
832 The @b{Sizes} menu allows you to select a group of line thickness, via diameter, via drill
833 size, and clearance (keepaway) (collectively called a "routing style") to be copied to the "active" sizes.
834 You can also change the names given to the routing styles and adjust their values from
835 this menu.  The "active" sizes are also adjustable from this menu.
836 The "active" sizes are shown in the status-line and control the initial size of new vias,
837 drilling holes, lines, clearances, text-objects and also the maximum dimensions of the
838 board layout.
840 @cindex Settings, popup menu
841 @cindex unique names
842 @cindex rubber band
843 @cindex snap to pins
844 @cindex clearance, for new lines
845 @item Settings
846 The @b{Settings} menu controls several operating configuration
847 parameters. The @samp{edit layer groups} entry brings up a dialog
848 that allows you to change the way layers are grouped. Layer grouping
849 is described in @ref{Layer Objects}. The @samp{all-direction lines}
850 entry controls
851 the clipping of lines to 45-degree angles. You can also control
852 whether moving individual objects causes the attached lines to
853 "rubber band" with the move or not from the @b{Settings} menu. Another
854 entry controls whether the starting clip angle for the two-line
855 mode (@pxref{Line Objects}) alternates every other line. You can
856 also control whether element names must be unique from the @b{Settings}
857 menu.  When unique element names are enforced, copying a new element
858 will automatically create a unique @samp{layout-name} name for it
859 provided that the name originally ended with a digit (@emph{e.g.}
860 U7 or R6). The @b{Settings} menu allows you to control
861 whether the cross hair will snap to pins and pads even when they
862 are off-grid. Finally you can control whether new lines and
863 arcs touch or clear intersecting polygons from this menu.
865 @cindex Select, popup menu
866 @cindex selected objects, removing
867 @cindex selected objects, changing sizes
868 @item Select
869 This menu covers most of the operations that work with selected objects.
870 You may either (un)select all visible objects on a layout or only the ones
871 which have been found by the last connection scan see
872 @c DRM: not sure where this was suppose to xfef to.
873 @c @ref{find connections}
875 You can delete all selected objects from this menu.
876 Other entries in the @b{Select} menu change the sizes of selected objects.
877 Note that a select action only affects those objects that are
878 selected @emph{and} have their visibility turned on in the Layer Control
879 panel. The @b{Select} menu also provides a means for selecting objects
880 by name using unix @ref{Regular Expressions}.
882 @cindex Buffer, popup menu
883 @cindex pastebuffer, popup menu
884 @cindex element, editing
885 @item Buffer
886 From the @b{Buffer} menu you may select one out of five
887 buffers to use, rotate or clear its contents or save the buffer contents
888 to a file. You can also use the @samp{break buffer element to pieces} entry
889 to de-compose an element into pieces for editing.
890 Note: only objects with visibility turned on are pasted to the layout. If
891 you have something in a buffer, then change which side of the board you
892 are viewing, the contents of the buffer will automatically be mirrored
893 for pasting on the side you are viewing. It is not necessary to clear
894 a buffer before cutting or copying something into it - it will automatically
895 be cleared first.
897 @cindex Connects, popup menu
898 @cindex auto-router
899 @cindex design rule checker, invoking
900 @item Connects
901 The entries available through the @b{Connects} menu allow you to find
902 connections from objects and to manipulate these.
903 You can also optimize or erase rat's nests from this menu. Finally,
904 the @samp{auto-route all rats} entry allows you to auto-route
905 all connections show by the rat's nest. The auto-router will use
906 any visible copper layer for routing, so turn off the visibility of any
907 layers you don't want it to use. The auto-router will automatically
908 understand and avoid any traces that are already on the board, but
909 it is not restricted to the grid. Finally,
910 the auto-router routes using the active sizes (except for nets that
911 have a route-style defined). @code{Pcb} always knows which tracks
912 were routed by the auto-router, and you can selectively remove them
913 without fear of changing tracks that you have manually routed
914 with the @samp{rip-up all auto-routed tracks} entry in the @b{Connects}
915 menu.  The @samp{design rule checker} entry runs a check for copper
916 areas that are too close together, or connections that touch too
917 tenuously for reliable production. The DRC stops when the first
918 problem is encountered so after fixing a problem be sure to
919 run it again until no problems are found.
920 @display
921 @emph{Warning:} @b{COPPER TEXT IS IGNORED BY THE DRC CHECKER}.
922 @end display
924 @cindex Info, popup menu
925 @cindex report
926 @cindex object report
927 @cindex drill report
928 @item Info
929 The @samp{generate object report} entry from the @b{Info} menu
930 provides a way to get detailed information
931 about an object, such as its coordinates, dimensions, etc.
932 You can also get a report summarizing all of the drills
933 used on the board with @samp{generate drill summary}. Lastly,
934 you can get a list of all pins, pads and vias that were
935 found during a connection search.
937 @cindex Window, popup menu
938 @item Window
939 The @b{Window} menu provides a way to bring each of @code{Pcb's}
940 windows to the front. The @emph{Library} window is used to
941 bring elements from the library into the paste-buffer. The
942 @emph{Message Log} window holds the various messages that
943 @code{Pcb} sends to the user. The @emph{Netlist} window shows
944 the list of connections desired.
946 @end table
948 Now that you're familiar with the various menus, it's time
949 to try some things out. From the @b{File} menu choose
950 @samp{load layout}, navigate to the tutorial folder, then
951 load the file @samp{tut1.pcb}.
954 @node Status-line and Input-field
955 @subsection The Status-line and Input-field
956 @cindex status information
957 @cindex displaying status information
958 @cindex input-field, position of
960 The status-line is located at the bottom edge of the main window.
961 During normal operation the status information is visible there.
962 When a selected menu operation requires an additional button click, the
963 status-line is replaced by a message telling you to position the cursor
964 and click.
965 When a text input is required, the status-line is replaced by the
966 Input-field which has a prompt for typing the input.
968 The status-line shows, from left to right, the side of the board that you
969 are viewing (@emph{Tab} key changes this), the current grid values,
970 if new lines are restricted to 45 degrees,
971 which type of 45 degree line mode is active, whether rubberband move and
972 rotate mode is on (R), and the zoom factor.
973 This information is followed by the active line-width, via-size
974 and drilling hole, keepaway spacing, and text scaling. Last is the active buffer number and the
975 name of the layout. An asterisk appearing at the far left indicates that the
976 layout has been modified since the last save.
977 Note that the name of the layout is not the same
978 thing as the filename of the layout.
979 Change the grid factor to 1.0 mm from the @b{Screen} menu. Observe how the
980 status line shows the new grid setting. Except for the case of the metric
981 grid, all dimensions in the status line are in units of 0.001 inch (1 mil).
983 The input-field pops up (temporarily replacing the status-line) whenever user input
984 is required. Two keys are bound to the input field: the @emph{Escape} key
985 aborts the input, @emph{Return} accepts it. Let's change the name of a component
986 on the board to see how the input-field works. Position the cross hair over
987 R5, and press the @emph{N} key. The input field pops-up showing the name
988 for you to edit. Go ahead and change the name, then hit return. Notice the name
989 of the element changed. Now undo the change by pressing the @emph{U} key. You can
990 position the cross hair over the name, or the element before pressing the
991 @emph{N} key.
993 Now select @samp{realign grid} from the @b{Screen} menu. Notice that the
994 status line has been replaced with an instruction to position the cursor
995 where you want a grid point to fall. In this case, since the cross hair
996 can only fall on a grid point, you must move the tip of the finger cursor
997 to the place where you want a grid point to appear. Do not worry that
998 the cross hair is not coincident with the cursor. Click @emph{Btn1} at
999 your chosen location. See how the grid has shifted, and the status line
1000 has returned.
1002 The present cross hair position is displayed in the upper right corner of the window.
1003 Normally this position is an absolute coordinate, but you can anchor a marker at
1004 the cross hair location by pressing @emph{Ctrl-M} (try it now) and then the
1005 display will read both the absolute cross hair position as well as the difference
1006 between it and the marker. The numbers enclosed in < > are the X and Y distances
1007 between the cross hair and the mark, while the numbers enclosed in parenthesis
1008 are the distance and angle from the mark to the cross hair. The values displayed
1009 are always in units of 0.001 inch (1 mil).
1010 Pressing @emph{Ctrl-M} again turns the marker off.
1012 @node Panner Control
1013 @subsection The Panner Control
1014 @cindex Panner control
1015 @cindex View, adjusting
1017 The panner control, located at the upper left side of the window, is used to
1018 adjust what portion of the layout is seen in the Layout area. The outer
1019 rectangle of the panner represents the whole layout (extended to have the
1020 panner aspect ratio), while the inner control rectangle represents the
1021 portion seen through the Layout area. Slowly drag this part around with
1022 the mouse (@emph{Btn1}) to see how it pans the layout. Release the panner
1023 control, but leave the pointer within the outer most rectangle of the
1024 control. Now hit a few keyboard arrow keys. Each arrow key moves the region
1025 seen one-half window size in the arrow direction. If you want to see a
1026 portion of the layout that is off the top of the screen, you need to
1027 drag the panner up, or hit the up arrow key.
1029 Move the pointer back into the Layout area.
1030 Increase the zoom by hitting the @emph{Z} key. See how the inner part of
1031 the panner becomes smaller to reflect that you are viewing a smaller
1032 part of the layout. Now zoom out by hitting @emph{Shift-Z}. If you
1033 hit the arrow key with the pointer in the Layout area, it moves
1034 the pointer rather than scrolling the window. In general the keyboard
1035 shortcuts depend on which region of @code{Pcb's} window the pointer
1036 is over. For the most part, the key strokes in this manual refer to
1037 the case when the pointer is in the Layout area. You can do fine
1038 scrolling in the Layout area by dragging it directly with the
1039 Panner tool. Press the @emph{Escape} key to select the panner tool.
1040 Now drag in the layout area with @emph{Btn1} down. You can scroll the drawing
1041 window while the pointer is inside it with @emph{Mod-Arrow}
1042 keys.
1044 If you are moving or drawing an object and go beyond the drawing
1045 window borders, the window will auto-scroll. If you want to stop
1046 the auto-scrolling while the pointer is outside the Layout area,
1047 simply pass the pointer briefly over the panner control area, or
1048 a menu button.
1050 Another way to navigate around a layout is with @emph{Shift-Btn3}.
1051 When pressed down, the layout will zoom so the whole extent of
1052 objects is visible, and will return to the previous zoom when
1053 you release the button, but will be centered at the cross hair
1054 position where the button is released. You can do this while in
1055 the middle of drawing an object. Try it now to center near
1059 @node Layer Controls
1060 @subsection The Layer Controls
1061 @cindex layer controls
1062 @cindex layers, switching on/off
1063 @cindex layers, changing which is active
1064 @cindex change active layer
1066 The layer control panel, located below the panner control, is used to turn on
1067 and off the display of layer groups and to select the active drawing layer.
1068 If a layer hasn't been named, the label "@emph{(unknown)}" is used as the default.
1069 If this happens, it probably means the application resources are not installed
1070 properly.
1072 The upper buttons are used to switch layers on and off. Click
1073 @emph{<Btn1>} on one or more of them. Each click toggles the setting.
1074 If you turn off the currently active layer, another one that is visible
1075 will become active. If there are no others visible, you will not be
1076 able to turn off the active layer.
1077 When the layers are grouped, clicking on these buttons will toggle
1078 the visibility of all layers in the same group. This is a good idea because
1079 layers in the same group reside on the same physical layer of
1080 the actual board. Notice that this example has 2 groups each having
1081 3 layers, plus two other layers named @samp{unused}.
1082 Use the @samp{Edit layer groups} option in the @samp{Settings} menu to
1083 change the layer groupings. Note that changing the groupings can
1084 radically alter the connectivity on the board.
1085 Grouping layers is only useful for helping you to color-code
1086 signals in your layout. Note that grouping layers actually reduces the number
1087 of different physical layers available for your board, so to make an eight
1088 layer board, you cannot group any layers.
1090 The @emph{far side} button turns on and off the visibility of elements
1091 (including SMD pads) on the opposite (to the side you're viewing)
1092 board side, as well as silk screening on that side. It does not
1093 hide the x-ray view of the other copper layers, these must be turned off
1094 separately if desired.  Use the @emph{tab} key to view the entire board from the other
1095 side.  To see a view of what the back side of the board will actually look like,
1096 make the solder layer the active layer then press @emph{tab} until the status
1097 line says "solder" on the right, then turn off the visibility of all layers
1098 except solder, pins/pads, vias, and silk. Now turn them all back on.
1100 The lowest button, named @emph{active}, is used to change the active
1101 drawing layer. Pressing @emph{<Btn1>} on it pops up a menu to select which
1102 layer should be active.
1103 Each entry is labeled with the layer's name and drawn in its color.
1104 The active layer is automatically made visible. The active layer is
1105 always drawn on top of the other layers, so the ordering of layers
1106 on the screen does not generally reflect the ordering of the manufactured
1107 board. Only the solder, component, silkscreen, and solder-mask layers
1108 are always drawn in their physical order. Bringing the active layer
1109 to the top makes it easier to select and change objects on the active layer.
1110 Try changing the active layer's name to @emph{ABC} by selecting
1111 @samp{edit name of active layer} from the @samp{Edit} menu.
1112 Changing the active layer can also be done by pressing keys
1113 @emph{1..MAX_LAYER}.
1115 Turn off the visibility of the component layer.
1116 Now make the component layer the active layer. Notice that it
1117 automatically became visible. Try setting a few
1118 other layers as the active layer. You should also experiment
1119 with turning on and off each of the layers to see what happens.
1121 The netlist layer is a special layer for adding connections to
1122 the netlist by drawing rat lines. This is not the recommended
1123 way to add to the netlist, but occasionally may be convenient.
1124 To learn how to use the netlist layer see @ref{Net Objects}.
1127 @node Tool Selectors
1128 @subsection The Tool Selectors
1129 @cindex mode selection
1130 @cindex tool selection
1131 @cindex selecting a new tool
1133 The tool selector buttons reside below the layer controls.
1134 They are used to select which layout tool to use in the drawing
1135 area. Each tool performs its function when @emph{Btn1} is pressed.
1136 Every tool gives the cursor a unique shape that identifies it.
1137 The tool selector buttons themselves are icons that illustrate their function.
1138 Each layout tool can also be selected from the keyboard:
1139 @example
1140     @emph{Escape} key   Panner tool
1141     @emph{F1} key       Via tool
1142     @emph{F2} key       Line tool
1143     @emph{F3} key       Arc tool
1144     @emph{F4} key       Text tool
1145     @emph{F5} key       Rectangle tool
1146     @emph{F6} key       Polygon tool
1147     @emph{F7} key       Buffer tool
1148     @emph{F8} key       Delete tool
1149     @emph{F9} key       Rotate tool
1150     @emph{Insert} key   Insert-point tool
1151     @emph{F10} key      Thermal tool
1152     @emph{F11} key      Arrow tool
1153     @emph{F12} key      Lock tool
1154 @end example
1156 Some of the tools are very simple, such as the Via tool.  Clicking
1157 @emph{Btn1} with the Via tool creates a via at the cross hair position.
1158 The via will have the diameter and drill sizes that are active,
1159 as shown in the status line.
1160 The Buffer tool is similar.  With it, @emph{<Btn1>} copies
1161 the contents of the active buffer to the layout, but only
1162 those parts that reside on visible layers are copied.
1163 The Rotate tool allows you to rotate elements, arcs, and text objects
1164 90 degrees counter-clockwise with each click. Holding the @emph{Shift}
1165 key down changes the Rotate tool to clockwise operation.
1166 Anything including groups of objects
1167 can be rotated inside a buffer using the rotate buffer menu option.
1169 The Line tool is explained in detail in @ref{Line Objects}. Go read
1170 that section if you haven't already.
1171 Activate the Line tool. Set the active layer to the solder layer.
1172 Try drawing some lines. Use the @emph{U} key to undo some of the
1173 lines you just created. Zoom in a bit closer with the @emph{Z} key.
1174 Draw some more lines. Be sure to draw some separate lines by starting
1175 a new anchor point with @emph{Ctrl-Btn1}. Change the @samp{crosshair snaps to pin/pads}
1176 behavior in the @b{Settings} menu. Now draw a line. Notice that
1177 the new line points must now always be on a grid point. It might not
1178 be able to reach some pins or pads with this setting. Increase the active line thickness
1179 by pressing the @emph{L} key. Note that the status line updates
1180 to reflect the new active line thickness. Now draw another line. Before completing the
1181 next line, make the component layer active by pressing the @emph{4} key.
1182 Now finish the line. Notice that a via was automatically placed where
1183 you switched layers. @code{Pcb} does not do any checks to make sure that
1184 the via could safely be placed there. Neither does it interfere with
1185 your desire to place lines haphazardly. It is up to you to place
1186 things properly when doing manual routing with the Line tool.
1188 The Arc tool is explained in detail in @ref{Arc Objects}. Its
1189 use is very similar to the Line tool.
1191 The Rectangle tool, Polygon tool and Thermal tool are explained in detail in
1192 @ref{Polygon Objects}. Go read that section.
1193 Remember that the Thermal tool will only create and destroy thermals
1194 to polygons on the active layer. Use the Rectangle tool to make a
1195 small copper plane on the component layer. Now place a via in the
1196 middle of the plane. Notice that it does not touch the plane, and
1197 they are not electrically connected. Use the Thermal tool to make
1198 the via connect to the plane. Thermals allow the via or pin to
1199 be heated by a soldering iron without having to heat the entire
1200 plane. If solid connections were made to the plane, it could be
1201 nearly impossible to solder. Click on the via again with the
1202 Thermal tool to remove the connection to the plane.
1204 The Insert-point tool is an editing tool that allows you to add
1205 points into lines and polygons.  The
1206 Insert-point tool enforces the 45 degree line
1207 rule.  You can force only the shorter line segment to 45
1208 degrees by holding the @emph{Shift} key down while inserting the point.
1209 Try adding a point into one of the lines you created. Since line
1210 clipping is turned on, you may need to move the cross hair quite far
1211 from the point where you first clicked on the line. Turn off the
1212 line clipping by selecting @samp{all-direction lines} from the
1213 @b{Settings} menu (or hit
1214 the @emph{Period} key). Now you can place an inserted point anywhere.
1215 Try adding a point to the rectangle you made earlier. Start by clicking
1216 somewhere along an edge of the rectangle, then move the pointer to
1217 a new location and click again.
1219 The delete-mode deletes the object beneath the cursor with each
1220 @emph{Btn1} click.
1221 If you click at an end-point that two lines have in common, it will replace the two lines with a single line
1222 spanning the two remaining points.  This can be used to delete an "inserted"
1223 point in a line, restoring the previous line.  Now delete one of the original corner
1224 points of the polygon you were just playing with. To do this, place the cross hair over the
1225 corner and click on it with the Delete tool. You could also use the @emph{Backspace} key
1226 if some other tool is active. Try deleting some of
1227 the lines and intermediate points that you created earlier. Use undo
1228 repeatedly to undo all the changes that you've made. Use redo
1229 a few times to see what happens. Now add a new line. Notice that
1230 you can no longer use redo since the layout has changed since
1231 the last undo happened. The undo/redo tree is always pruned in this
1232 way (@emph{i.e.} it has a root, but no branches).
1234 The Arrow tool is so important, it has its own section: @ref{Arrow Tool}.
1235 Go read it now.
1237 The Lock tool allows you to lock objects on the layout. When an object
1238 is locked, it can't be selected, moved, rotated, or resized. This is
1239 useful for very large objects like ground planes, or board-outlines that
1240 are defined as an element. With such large objects, nearly anywhere you
1241 click with the Arrow tool will be on the large object, so it could be
1242 hard to draw box selections. If you lock an object, the Arrow tool will
1243 behave as if it didn't exist.  You cannot unlock an object with undo.
1244 You must click on it again with the Lock tool. If an object is locked,
1245 previous changes to it cannot be undone either. When you lock
1246 an object, a report message about it is popped up and will always tell
1247 you what object it is, and that it is locked if you just locked it.
1248 Other than noticing your inability to manipulate something, the only
1249 way to tell an object is locked is with a report from the @b{Info}
1250 menu. Use the Lock tool sparingly.
1253 @node Layout Area
1254 @subsection Layout Area
1255 @cindex grid
1257 The layout area is where you see the layout. The cursor shape depends
1258 on the active tool when the pointer is moved into the layout area.
1259 A cross hair follows the X11 pointer with respect to the grid setting.
1260 Select a new grid from the @emph{Screen} menu.
1261 The new value is updated in the status line.
1262 A different way to change the grid is
1263 @emph{Shift<Key>g} to decrease or @emph{<Key>g} to increase
1264 it, but this only works for English (integer mil) grids.
1265 The grid setting is saved along with the data when you save a pcb layout.
1266 For homemade layouts a value around 50 is a good setting.
1267 The cursor can also be moved in the layout area with the cursor (arrow) keys or, for larger
1268 distances, by pressing the @emph{Shift} modifier together with a cursor key.
1271 @node Log Window
1272 @section Log Window
1273 @cindex log window
1274 @cindex messages
1276 This optional window is used to display all kind of messages including
1277 the ones written to @emph{stderr} by external commands. The main advantage
1278 of using it is
1279 that its contents are saved in a scrolling list until the
1280 program exits. Disabling this feature by setting the resource
1281 @emph{useLogWindow} to @emph{false} will generate popup windows to display
1282 messages. The @emph{stderr} of external commands will appear on @code{Pcb}s
1283 @emph{stderr} which normally is the parent shell. I suggest you iconify
1284 the log window after startup for example by setting @emph{*log.iconic} to
1285 @emph{true} in the resource file. If @emph{raiseLogWindow} is set @emph{true},
1286 the window will deiconify and raise itself whenever new messages are to be
1287 displayed.
1290 @node Library Window
1291 @section Library Window
1292 @cindex library window
1294 The library window makes loading elements (or even partial layouts) easy.
1295 Just click the appropriate library from the list on the left. A list
1296 of its elements then appears on the right. Select an element
1297 from the list by clicking on its description. Selecting an element from the
1298 library will also automatically copy the element into
1299 the active buffer, then invoke the @emph{Buffer} tool so
1300 you can paste it to the layout. Elements in the old library should be
1301 taken with a grain of salt (@emph{i.e.} check them carefully before
1302 using).  The old library names all begin with ~ so you can easily distinguish between
1303 the old and new libraries.  All of the elements in the new library
1304 should  be thoroughly vetted, so you
1305 can use them with confidence. The new libraries are stored simply
1306 as directories full of element files, so making additions to the
1307 new library is easy since there is no need to learn @code{m4}.
1308 For details on the old libraries,
1309 check-out @ref{Library File} and @ref{Library Contents File}. For
1310 details on the format of an element file used for the new libraries,
1311 see @ref{Element File}.
1314 @node Netlist Window
1315 @section Netlist Window
1316 @cindex Netlist Window
1318 The netlist window is very similar to the library window. On the left
1319 is a list of all of the nets, on the right is the list of connections
1320 belonging to the chosen net. The chosen net is highlighted in the
1321 list and also shown on the second line of the window in red. If the
1322 net name has a star to the left of it then it is "disabled". A disabled
1323 net is treated as if it were not in the net list. This is useful, for
1324 example, if you plan to use a ground plane and don't want the ground
1325 net showing up in the rat's nest. You can enable/disable individual
1326 nets by double-clicking the net name. If you want to enable or disable
1327 all nets at once, there are two buttons at the top of the netlist
1328 window for this purpose.
1330 The button labeled @samp{Sel Net On Layout}
1331 can be used to select (on the layout) everything that is connected
1332 (or is supposed to be connected) to the net. If you click on a
1333 connection in the connection list, it will select/deselect
1334 the corresponding pin or pad in the layout and also center the layout
1335 window where it is located. If you "Find" (@samp{lookup connection
1336 to object} in the @b{Connects} menu [also @emph{F} key]), a pin
1337 or pad it will also choose the net and connection in the netlist window
1338 if it exists in the netlist.
1340 If no netlist exists for the layout, then the netlist window does not
1341 appear. You can load a netlist from a file from the @b{File} menu. The
1342 format for netlist files is described in @ref{Netlist File}.
1345 @node Drawing and Removing
1346 @section Drawing and Removing Basic Objects
1347 @cindex drawing objects
1348 @cindex removing objects
1349 @cindex erasing objects
1350 @cindex object, drawing and removing
1352 hace begging gutting here, and do a real-world tutorial example.
1354 There are several ways of creating new objects: you can draw them yourself,
1355 you can copy an existing object (or selection), or you can load an element from a file or
1356 from the Library window. Each type of object has a particular tool for creating it.
1358 The active tool can be selected from the tool selectors in the bottom
1359 left corner or by one of the function keys listed earlier in this chapter.
1360 Each @emph{<Btn1>} press with the tool tells the application to create
1361 or change the appropriate object or at least take
1362 the first step to do so. Each tools causes the cursor to take
1363 on a unique shape and also causes the corresponding
1364 tool selector button to be highlighted. You can use either cue
1365 to see which tool is active.
1367 Insert mode provides the capability of inserting new points into existing
1368 polygons or lines. The 45 degree line clipping is now enforced when selected.
1369 Press and hold the shift key while positioning the new point to only clip
1370 the line segment to the nearer of the two existing points to 45 degrees.
1371 You can also toggle the 45-degree clipping in the middle of a point
1372 insertion by pressing the @emph{<Key>.}
1373 If the shift key is not depressed and the 45 degree line clipping mode
1374 is on, both new line segments must be on 45 degree angles - greatly
1375 restricting where the new point may be placed. In some cases this can cause
1376 confusion as to whether an insertion has been started since the two new
1377 lines may be forced to lie parallel on top of the original line until the
1378 pointer is moved far from the end points.
1380 Removing objects, changing their size or moving them only applies to objects
1381 that are visible when the command is executed.
1383 @menu
1384 * Common::           Keystrokes common to some objects.
1385 * Lines::
1386 * Arcs::
1387 * Polygons::         Drawing polygons and rectangles.
1388 * Text::
1389 * Vias::
1390 * Elements::
1391 * Pastebuffer::      A multi-purpose buffer.
1392 @end menu
1394 @node Common
1395 @subsection Common Drawing and Removing Methods
1396 @cindex creating objects
1397 @cindex object, creating an
1398 @cindex removing objects
1399 @cindex object, removing an
1400 @cindex thickness of objects
1401 @cindex object, changing the size of an
1403 There are several keystrokes and button events referring to an @emph{object}
1404 without identifying its type. Here's a list of them:
1406 @emph{<Btn1>} creates (or deletes)  an object depending on the
1407 current mode.
1409 @emph{<Key>BackSpace} or @emph{<Key>Delete} removes the visible
1410 object at the cursor location. When more than one object exists at the
1411 location, the order of removal is: via, line, text, polygon and
1412 element. The drawn layer order also affects the search - whatever is
1413 top - most (except elements) is affected before lower items.  Basically
1414 all this means that what is removed is probably just what you expect.
1415 If for some reason it isn't, undo and try again.
1416 Only one object is removed for each keystroke. If two or more
1417 of the same type match, the newest one is removed.
1419 Use @emph{<Key>s} and @emph{Shift<Key>s} to change the size (width)
1420 of lines, arcs, text objects, pins, pads and vias, or to toggle the style
1421 of polygons (whether pins and vias automatically have clearances).
1423 @emph{<Key>n} changes the name of pins, pads, vias, the
1424 string of a text object, or the currently displayed label of an element.
1426 @emph{<Key>m} moves the line, arc, or polygon under the cross hair to the
1427 active layer if it wasn't on that layer already.
1429 @emph{<Key>u} (undo) recovers from an unlimited number of operations
1430 such as creating, removing, moving, copying, selecting etc. It works like
1431 you'd expect even if you're in the midst of creating something.
1433 @emph{Shift<Key>r} restores the last undone operation provided no other
1434 changes have been made since the undo was performed.
1436 @emph{<Key>tab} changes the board side you are viewing.
1438 For a complete list of keystrokes and button events see @ref{Translations}.
1441 @node Lines
1442 @subsection Lines
1443 @cindex lines, an example
1444 @cindex example of line handling
1446 To draw new lines you have to be in @emph{line-mode}. Get there either by
1447 selecting it from the @emph{Tool palette} or by pressing @emph{<Key>F2}.
1448 Each successive @emph{notify} event creates a new line. The
1449 adjustment to 45 degree lines is done automatically if it is selected from the
1450 @emph{Display} menu. You can toggle the 45 degree mode setting by
1451 pressing the @emph{<Key>.} (That is the period key). When 45 degree enforcement
1452 is turned on there are three distinct modes of line creation: a single
1453 line on the closest 45 degree vector towards the cross hair (but not necessarily
1454 actually ending at the cross hair), two lines created such that the first leaves
1455 the start point on a 90 degree vector and the second arrives at the cross hair
1456 on a 45 degree vector, and finally two lines created such that the first leaves
1457 the start point on a 45 degree vector and the second arrives at the cross hair
1458 on a 90 degree vector.  These last two modes always connect all the way from
1459 the start and end points, and all lines have angles in 45 degree multiples.
1460 The @emph{<Key>/} cycles through the three modes.  The status line shows a
1461 text icon to indicate which of the modes is active and the lines following
1462 the cross hair motion show the outline of the line(s) that will actually be created.
1463 Press @emph{<Key>Escape} to leave line-mode.
1465 @emph{<Key>l}, @emph{Shift<Key>l} and the entries in the
1466 @emph{Sizes} menu change the initial width of new lines.  This width is also
1467 displayed in the status line.
1470 @node Arcs
1471 @subsection Arcs
1472 @cindex arc, an example
1474 An Arc is drawn  with the @emph{arc-tool}. Get there either by selecting it
1475 from the @emph{Tool palette} or by pressing @emph{<Key>F8}. Press @emph{Btn1} to
1476 define the starting point for the arc.  Drag the mouse towards the desired
1477 end point along the path you want the arc to follow.  The outline of the arc that
1478 will be created is shown on the screen as you move the mouse.  Arcs are always
1479 forced to be 90 degrees and have symmetrical length and width ( i.e. they are
1480 a quarter circle).  The next @emph{Btn1} click creates the arc.  It will have
1481 the same width as new lines (displayed in the status line) and appear on the
1482 active layer. The arc leaves the starting point towards the cross hair along
1483 the axis whose distance from the cross hair is largest.  Normally this means that
1484 if you drag along the path you want the arc to follow, you'll get what you
1485 want.  If the grid is set to the arc radius, then the two distances will be
1486 equal and you won't be able to get all of the possible directions.  If this
1487 is thwarting your desires, reduce the grid spacing (@emph{!Shift<Key>G}) and
1488 try again.
1491 @node Polygons
1492 @subsection Polygons and Rectangles
1493 @cindex polygon, an example
1494 @cindex example of polygon handling
1495 @cindex rectangle, an example
1496 @cindex example of rectangle handling
1498 A polygon is drawn by defining all of its segments as a series of
1499 consecutive line segments. If the first point matches a new one and if
1500 the number of points is greater than two, then the polygon is closed.
1501 Since matching up with the first point may be difficult, you may use
1502 @emph{Shift<Key>p} to close the polygon. The @emph{Shift<Key>p} won't
1503 work if clipping to 45 degree lines is selected
1504 and the final segment cannot match this condition.
1505 I suggest you create simple convex polygons in order to avoid a strong
1506 negative impact on the performance of the connection scanning routines.
1507 The @emph{rectangle-mode} is just an easy way to generate rectangular polygons.
1508 @emph{Polygon-mode} also is selected by @emph{<Key>F6} whereas
1509 @emph{rectangle-mode} uses @emph{<Key>F4}.
1510 Pressing a @emph{<Btn1>} at two locations creates a rectangle by
1511 defining two of its corners.
1512 @emph{<Key>Insert} brings you to @emph{insert-point-mode} which lets you
1513 add additional points to an already existing polygon.
1514 Single points may be removed by moving the cross hair to them and selecting
1515 one of the delete actions @emph{(remove-mode, BackSpace, or Delete}. This only works
1516 if the remaining polygon will still have three or more corners.
1517 Pressing @emph{<Key>u}  or @emph{<Key>p} while entering a new polygon
1518 brings you back to the previous corner. Removing a point does not
1519 force clipping to 45 degree angles (because it's not generally possible).
1520 Newly created polygons will not connect to pins or vias
1521 that pierce it unless you create a thermal (using the thermal mode) to make
1522 the connection. If the edge of a polygon gets too close to a pin or via that
1523 lies outside of it, a warning will be issued and the pin will be given a
1524 special color. Increasing the distance between them will remove the warning
1525 color.
1528 @node Text
1529 @subsection Text
1530 @cindex text, an example
1531 @cindex strings, an example
1532 @cindex example of text handling
1534 Pressing @emph{<Key>F5} or clicking one of the text selector buttons
1535 changes to @emph{text-mode}.
1536 Each successive notify event (@emph{<Btn1>})
1537 pops up the input line at the bottom and queries for a string.
1538 Enter it and press @emph{<Key>Return} to confirm or
1539 @emph{<Key>Escape} to abort.
1540 The text object is created with its upper left corner at the current pointer
1541 location.
1542 The initial scaling is changed by @emph{<Key>t} and
1543 @emph{Shift<Key>t} or from the @emph{Sizes} menu.
1545 Now switch to @emph{rotate-mode} and press
1546 @emph{<Btn1>} at the text-objects location. Text objects
1547 on the solder side of the layout are automatically mirrored and
1548 flipped so that they are seen correctly when viewing the solder-side.
1550 Use @emph{<Key>n} to edit the string.
1552 @b{TEXT OBJECTS ON COPPER LAYERS CREATE COPPER LINES BUT THEY ARE NOT SCANNED FOR
1553 CONNECTIONS}. If they are moved to the silkscreen layer, they
1554 no longer create copper.
1557 @node Vias
1558 @subsection Vias
1559 @cindex vias, an example
1560 @cindex example of via handling
1562 The initial size of new vias may be changed by @emph{<Key>v} and
1563 @emph{Shift<Key>v} or by selecting the appropriate entry from the
1564 @emph{Sizes} menu. @emph{Mod1<Key>v} and @emph{Mod1 Shift<Key>v} do
1565 the same for the drilling hole of the via.
1566 The statusline is updated with the new values.
1567 Creating a via is similar to the other objects. Switch to @emph{via-mode}
1568 by using either the selector button or @emph{<Key>F1} then press
1569 @emph{<Key>]} or @emph{<Btn1>} to create one.
1570 @emph{<Key>n} changes the name of a via. If you want to create a mounting
1571 hole for your board, then you can place a via where you want the hole to
1572 be then convert the via into a hole.  The conversion is done by pressing
1573 @emph{!Ctrl<Key>h} with the cross hair over the via.  Conceptually it is
1574 still a via, but it has no copper annulus.  If you create such a hole in
1575 the middle of two polygons on different layers, it will short the layers.
1576 Theoretically you could arrange for such a hole not to be plated, but a
1577 metal screw inserted in the hole would still risk shorting the layers.
1578 A good rule is to realize that holes in the board really are vias between
1579 the layers and so place them where they won't interfere with connectivity.
1580 You can convert a hole back into a normal via with the same keystroke used
1581 to convert it in the first place.
1583 @node Elements
1584 @subsection Elements
1585 @cindex element, an example
1586 @cindex example of element handling
1588 Some of the functions related to elements only work if both the package
1589 layer and the pin layer are switched on.
1591 Now that you're familiar with many of the basic commands, it is
1592 time to put the first element on the layout.
1593 First of all, you have to load data into the paste buffer.
1594 There are four ways to do this:
1595 @example
1596    1) load the data from a library
1597    2) load the data from a file
1598    3) copy data from an already existing element
1599    4) convert objects in the buffer into an element
1600 @end example
1601 We don't have any elements on the screen yet nor anything in the
1602 buffer, so we use number one.
1604 @cindex example files
1605 @cindex m4, preprocessing example files
1606 Select @emph{lsi} from the menu in the library window press
1607 @emph{<Btn1>} twice at the appropriate text-line to get
1608 the MC68030 CPU.
1609 The data is loaded and the mode is switched to @emph{pastebuffer-mode}.
1610 Each notify event now creates one of these beasts. Leave the mode
1611 by selecting a different one or by @emph{<Key>Escape} which resets
1612 all modes..
1613 The cross hair is located at the @emph{mark} position as defined by
1614 the data file. Rotating the buffer contents is done by selecting
1615 the @emph{rotate} entry of the @emph{Buffer} menu or by pressing
1616 @emph{Shift<Key>F3}. The contents of the buffer
1617 are valid until new data is loaded into it either by a cut-to-buffer
1618 operation, copy-to-buffer operation or by loading a new data file.
1619 There are 5 buffers
1620 available  (possibly more or less if changed at compile time
1621 with the @code{MAX_BUFFER} variable in @file{globalconfig.h}).
1622 Switching between them is done by selecting a menu entry or
1623 by @emph{Shift<Key>1..MAX_BUFFER}.
1624 Each of the two board sides has its own buffers.
1626 The release includes all data files for the circuits that are used
1627 by the demo layout. The elements in the LED example are not found in the library,
1628 but you can lift them from the example itself if you want.
1629 If you have problems with the color of the cross hair, change the resource
1630 @emph{cross hairColor} setting to a different one.
1632 @cindex example of loading an element file
1633 @cindex pins, an example
1634 @cindex example of pin handling
1635 Now load a second circuit, the MC68882 FPU for example.
1636 Create the circuit as explained above. You now have two different unnamed
1637 elements. Unnamed means that the layout-name of the element
1638 hasn't been set yet. Selecting @emph{description} from the @emph{Display}
1639 menu displays the description string of the two circuits which
1640 are CPU and FPU. The values of the circuits are set to MC68030 and MC68882.
1641 Each of the names of an element may be changed
1642 by @emph{<Key>n} at the elements location and editing the old name in
1643 the bottom input line. Naming pins and vias is similar to elements.
1644 You can hide the element name so that it won't appear on the board
1645 silkscreen by pressing @emph{<key>h} with the cursor over the element.
1646 Doing so again un-hides the element name.
1648 Entering @kbd{:le} and selecting an element data file is
1649 the second way to load circuits.
1651 The third way to create a new element is to copy an existing one.
1652 Please refer to @ref{Moving and Copying}.
1654 @cindex example of creating an element
1655 @cindex element, creating a new package
1656 @cindex pastebuffer, convert contents to element
1657 @cindex buffer, convert contents to element
1658 The fourth way to create a new element is to convert a buffer's contents
1659 into an element.  Here's how it's done: Select the Via-tool from the
1660 @emph{Tool pallet}.  Set the grid spacing to something appropriate for
1661 the element pin spacing.  Now create a series of vias where the pins
1662 go.  Create them in pin number order. It is often handy to place a reference
1663 point (@emph{!Ctrl<Key>m}) in the center of the first pin in order to measure
1664 the location of the other pins.  Next make a solder-side layer the active
1665 layer from the @emph{active-layer} popup menu.  Now draw the outline of
1666 the element using lines and arcs.  When you're done, select everything that
1667 makes up the element with a box selection (@emph{<Btn3Down> drag,
1668 <Btn3Up>}). Now select "cut selection to buffer" from the @emph{Buffer}
1669 menu. Position the cursor over the center of pin 1 and press the left
1670 button to load the data into the buffer.
1671 Finally select "convert buffer to element" from the @emph{Buffer} menu.
1672 You'll only want to create elements this way if they aren't already in the
1673 library.  It's also probably a good idea to do this before starting any of
1674 the other aspects of a layout, but it isn't necessary.
1676 To display the pinout of a circuit move to it and press @emph{Shift<Key>d}
1677 or select @emph{show pinout} from the @emph{Objects} menu. A new window
1678 pops up and displays the complete pinout of the element. This display can
1679 be difficult to read if the component has been rotated 90 degrees :-(
1680 therefore, the new window will show an un-rotated view so the pin names
1681 are readable.
1682 @emph{<Key>d} displays the name of one or all pins/pads inside the
1683 Layout area, this is only for display on-screen, it has no effect on any
1684 printing of the layout.
1686 You also may want to change a pin's or pad's current size by pressing
1687 @emph{<Key>s} to increase or @emph{Shift<Key>s} to decrease it. While
1688 this is possible, it is not recommended since care was probably taken
1689 to define the element structure in the first place. You can also change the thickness
1690 of the element's silkscreen outline with the same keys. You can
1691 change whether a pin or SMD pad is rounded or square with the @emph{<Key>q}.
1692 SMD pads should usually have squared ends. Finally, you can change whether
1693 the non-square pins are round or octagonal with the @emph{!Ctrl<Key>o}.
1695 SMD elements and silkscreen objects are drawn in the "invisible object"
1696 color if they are located on the opposite side of the board.
1698 For information on element connections refer to @ref{Connection Lists}.
1701 @node Pastebuffer
1702 @subsection Pastebuffer
1703 @cindex pastebuffer, an example
1704 @cindex example of pastebuffer handling
1705 @cindex buffer, an example
1706 @cindex example of buffer handling
1708 The line-stack and element-buffer of former releases have been replaced
1709 by 5 (possibly more or less if changed at compile time
1710 with the @code{MAX_BUFFER} variable in @file{globalconfig.h})
1711 multi-purpose buffers that are selected by
1712 @emph{Shift<Key>1..MAX_BUFFER}. The status line shows which buffer is
1713 the active one.
1714 You may load data from a file or layout into them.
1715 Cut-and-paste works too.
1716 If you followed the instructions earlier in this chapter you should
1717 now have several objects on the screen. Move the cross hair to one of them
1718 and press @emph{<Btn3Down>} to toggle its selection flag. (If you drag the
1719 mouse while the button is down, a box selection will be attempted instead
1720 of toggling the selection.)  The object
1721 is redrawn in a different color. You also may want to try
1722 moving the pointer while holding the third button down and
1723 release it on a different location. This selects all objects inside the
1724 rectangle and unselects everything else.  If you want to add a box selection
1725 to an existing selection, drag with @emph{Mod1<Btn3Down>} instead.
1726 Dragging @emph{Shift Mod1<Btn3Down>} unselects objects in a box.
1727 Now change to @emph{pastebuffer-mode} and select some operations from the
1728 @emph{Buffer} menu. Copying objects to the buffer is available as
1729 @emph{Mod1<Key>c} while cutting them uses @emph{Mod1<Key>x} as
1730 shortcut. Both clear the buffer before new data is added.
1731 If you use the menu entries, you have to supply a cross hair position by
1732 pressing a mouse button. The objects are attached to the pastebuffer
1733 relative to that cross hair location.
1734 Element data or PCB data may be merged into an existing layout by loading
1735 the datafiles into the pastebuffer. Both operations are available from
1736 the @emph{File} menu or as user commands.
1738 @node Moving and Copying
1739 @section Moving and Copying
1740 @cindex moving, an example
1741 @cindex copying, an example
1742 @cindex example of moving
1743 @cindex example of copying
1745 All objects can be moved including element-names, by
1746 @emph{<Btn2Down>}, dragging the pointer while holding the button down
1747 and releasing it at the new location of the object. If you use
1748 @emph{Mod1<Btn2Down>} instead, the object is copied. Copying does not work for
1749 element-names of course. You can move all selected objects with
1750 @emph{Shift <Btn1>}.  This uses the Pastebuffer, so
1751 it will remove whatever was previously in the Pastebuffer.
1752 Please refer to @ref{Pastebuffer}.
1753 If you want to give a small nudge to an object, but you don't think
1754 that the mouse will give you the fine level of control that you want,
1755 you can position the cursor over the object, press @emph{<Key>[},
1756 move it with the arrow keys, then press @emph{<Key>]} when it's at the
1757 desired position.  Remember that all movements are forced onto grid coordinates, so
1758 you may want to change the grid spacing first.
1760 @cindex moving, traces to a different layer
1761 @cindex changing layers
1762 To move a trace or group of traces to a different layer, first select
1763 the tracks to be moved.  It's easiest to do this if you shut off everything
1764 but that layer first (i.e. silk, pins, other layers, etc).
1765 Now set the current layer to be the new layer.  
1766 Press Shift-M to move all the selected tracks to the current layer.
1767 See the @emph{MoveToCurrentLayer} action for more details.
1769 @node Loading and Saving
1770 @section Loading and Saving
1771 @cindex loading, an example
1772 @cindex saving, an example
1773 @cindex example of saving
1774 @cindex example of loading
1776 After your first experience with @code{Pcb} you will probably want to save
1777 your work. @kbd{:s name} passes the data to an external program which
1778 is responsible for saving it. For details see @emph{saveCommand} in
1779 @ref{Resources}.
1780 Saving also is available from the @emph{File} menu, either with or
1781 without supplying a filename. @code{Pcb} reuses the last
1782 filename if you do not pass a new one to the save routine.
1784 To load an existing layout either select @emph{load layout data} from the
1785 @emph{File} menu or use @kbd{:l filename}. A file select box pops up if you
1786 don't specify a filename. Merging existing layouts into the new one is
1787 supported either by the @emph{File} menu or by @kbd{:m filename}.
1789 @cindex backup
1790 @cindex saving layouts
1791 @cindex preventing loss of data
1792 @cindex /tmp
1793 @cindex directory /tmp
1794 @cindex temporary files
1795 @code{Pcb} saves a backup of the current layout at a user specified interval.
1796 The backup filename is created by appending a dash, "-", to the @file{.pcb} filename.
1797 For example, if you are editing the layout in @file{projects/board.pcb} then the
1798 backup file name will be @file{projects/board.pcb-}.  If the layout is new and
1799 has not been saved yet, then the backup file name is @file{PCB.####.backup} where the "####"
1800 will be replaced by the process ID of the currenting running copy of @code{Pcb}.
1801 This default backup file name may be changed at compilation time via the
1802 @code{BACKUP_NAME}
1803 variable in @file{globalconfig.h}).  During critical
1804 sections of the program or when data would be lost it is saved as
1805 @file{PCB.%i.save}.  This file name may be changed at compile time
1806 with the @code{SAVE_NAME} variable in @file{globalconfig.h}.
1809 @node Printing
1810 @section Printing
1811 @cindex printing, an example
1812 @cindex example of printing
1814 @code{Pcb} now has support for device drivers,
1815 @code{PostScript}, @emph{encapsulated PostScript},
1816 and @emph{Gerber RS-274X} drivers are
1817 available so far.  The @emph{Gerber RS-274X}
1818 driver additionally generates a numerical control (NC) drill file for
1819 automated drilling,
1820 a bill of materials file to assist in materials procurement and
1821 inventory control, and a centroid (X-Y) file which includes the
1822 centroid data needed
1823 by automatic assembly (pick and place) machines.
1824  I recommend the use of @code{GhostScript} if you
1825 don't have a @code{PostScript} printer for handling the PostScript
1826 output. Printing always generates
1827 a complete set of files for a specified driver.
1828 See the page about
1829 the @emph{Print()} action for additional information about the filenames.
1830 The control panel offers a number of options. Most of them are not available
1831 for Gerber output because it wouldn't make sense, for example,  to scale the gerber output
1832 (you'd get an incorrectly made board!)  The options are:
1834 @table @samp
1835 @cindex device, selecting an output
1836 @cindex output device
1837 @item device
1838 The top menu button selects from the available device drivers.
1840 @cindex rotating printout
1841 @item rotate
1842 Rotate layout 90 degrees counter-clockwise before printing (default).
1844 @cindex mirroring printout
1845 @item mirror
1846 Mirror layout before printing. Use this option depending
1847 on your production line.
1849 @cindex color printout
1850 @item color
1851 Created colored output. All colors will be converted to black if this option
1852 is inactive.
1854 @cindex outline printout
1855 @item outline
1856 Add a board outline to the output file. The size is determined by the
1857 maximum board size changeable from the @emph{sizes} menu. The outline appears
1858 on the top and bottom sides of the board, but not on the internal layers.
1859 An outline can be useful for determining where to shear the board from the
1860 panel, but be aware that it creates a copper line.  Thus it has the potential
1861 to cause short circuits if you don't leave enough room from your wiring
1862 to the board edge.  Use a viewer to see what the output outline looks like
1863 if you want to know what it looks like.
1865 @cindex alignment targets
1866 @item alignment
1867 Additional alignment targets are added to the output. The distances between
1868 the board outline is set by the resource @emph{alignmentDistance}.  Alignment
1869 targets should only be used if you know for certain that YOU WILL BE USING
1870 THEM YOURSELF.  It is extremely unlikely that you will want to have alignment
1871 targets if you send gerber files to a commercial pcb manufacture to be made.
1873 @cindex scaling a printout
1874 @item scaling
1875 It's quite useful to enlarge your printout for checking the layout.
1876 Use the scrollbar to adjust the scaling factor to your needs.
1878 @cindex print media
1879 @cindex media, size of
1880 @item media
1881 Select the size of the output media from this menu. The user defined size
1882 may be set by the resource @emph{media} either from one of the well known
1883 paper sizes or by a @code{X11} geometry specification.
1884 This entry is only available if you use @code{X11R5} or later.
1885 For earlier releases the user defined size or, if not available, @emph{A4}
1886 is used.
1887 Well known size are:
1888 @display
1889         A3
1890         A4
1891         A5
1892         letter
1893         tabloid
1894         ledger
1895         legal
1896         executive
1897 @end display
1899 @cindex offset of printout
1900 @cindex print offset
1901 @item offset
1902 Adjust the offsets of the printout by using the panner at the right side
1903 of the dialog box.
1904 This entry is only available if you use @code{X11R5} or later. A zero
1905 offset is used for earlier releases.
1907 @cindex DOS filenames
1908 @item 8.3 filenames
1909 Select this button to generate DOS compatible filenames for the output files.
1910 The @emph{command} input area will disappear if selected.
1912 @cindex print command
1913 @item commandline
1914 Use this line to enter a command (starts with @kbd{|}) or a filename.
1915 A %f is replaced by the current filename.
1916 The default is set by the resource @emph{printCommand}.
1918 @end table
1920 The created file includes some labels which are guaranteed to stay unchanged
1921 @table @samp
1922 @item PCBMIN
1923 identifies the lowest x and y coordinates in mil.
1925 @item PCBMAX
1926 identifies the highest x and y coordinates in mil.
1928 @item PCBOFFSET
1929 is set to the x and y offset in mil.
1931 @item PCBSCALE
1932 is a floating point value which identifies the scaling factor.
1934 @item PCBSTARTDATA
1935 @itemx PCBENDDATA
1936 all layout data is included between these two marks. You may use them with an
1937 @code{awk} script to produce several printouts on one piece of paper by
1938 duplicating the code and putting some @code{translate} commands in front.
1939 Note, the normal @code{PostScript} units are 1/72 inch.
1940 @end table
1943 @node Connection Lists
1944 @section Connection Lists
1945 @cindex example of connection lists
1946 @cindex connections, creating list of
1948 After completing parts of your layout you may want to check if all drawn
1949 connections match the ones you have in mind. This is probably best done
1950 in conjunction with a net-list file: see @ref{Rats Nest}.
1951 The following examples give more rudimentary ways to examine
1952 the connections.
1953 @example
1954     1) create at least two elements and name them
1955     2) create some connections between their pins
1956     3) optionally add some vias and connections to them
1957 @end example
1959 Now select @emph{lookup connection} from the @emph{Connections} menu,
1960 move the cursor to a pin or via and press any mouse button. @code{Pcb}
1961 will look for all other pins and/or vias connected to the one you have
1962 selected and display the objects in a different color.
1963 Now try some of the reset options available from the same menu.
1965 There also is a way to scan all connections of one element. Select
1966 @emph{a single element} from the menu and press any button at the
1967 element's location. All connections of this element will be saved
1968 to the specified file.
1969 Either the layout name of the element or its canonical name is used to
1970 identify pins depending on the one which is displayed on the screen
1971 (may be changed by @emph{Display} menu).
1973 An automatic scan of all elements is initiated by choosing
1974 @emph{all elements}. It behaves in a similar fashion to scanning a single
1975 element except the resource @emph{resetAfterElement}
1976 is used to determine if connections should be reset before a new element is
1977 scanned. Doing so will produce very long lists because the power lines are
1978 rescanned for every element. By default the resource is set to @emph{false}
1979 for this reason.
1981 To scan for unconnected pins select @emph{unused pins} from the same
1982 menu.
1985 @node Arrow Tool
1986 @section Arrow Tool
1987 @cindex selecting, using the arrow tool
1988 @cindex moving objects
1989 @cindex arrow tool
1990 @cindex tool, arrow
1992 Some commands mentioned earlier in this chapter also are able to operate on all
1993 selected and visible objects. The Arrow tool is used to select/deselect
1994 objects and also to move objects or selections.  If you click and release
1995 on an object with the Arrow tool, it will unselect everything else and
1996 select the object. Selected objects change color to reflect that
1997 they are selected. If you @emph{Shift} click, it will add the object to
1998 (or remove) the object from the existing selection. If you drag with
1999 the mouse button down with the Arrow tool, one of several things could
2000 happen: if you first pressed the button on a selected object, you
2001 will be moving the selection to where you release the button. If you
2002 first pressed the button on an unselected object, you will be moving
2003 that object. If you first pressed the button over empty space, you
2004 will be drawing a box to select everything inside the box. The @emph{Shift}
2005 key works the same way with box selections as it does with single objects.
2007 Moving a single un-selected object is different from moving a selection.
2008 First of all, you can move the end of line, or a point in a polygon this
2009 way which is impossible by moving selections. Secondly, if rubber banding
2010 is turned on, moving a single object will rubber-band the attached lines.
2011 Finally, it is faster to move a single object this way since there is no need
2012 to select it first.
2014 You can select any visible object unless it is locked. If you select an
2015 object, then turn off its visibility with the Layer controls, it won't
2016 be moved if you move the remaining visible selection.
2018 If you have not configured to use strokes in the @code{Pcb} user interface, then
2019 the middle mouse button is automatically bound to the arrow tool, regardless
2020 of the active tool (which is bound to the first mouse button). So using
2021 the middle button any time is just like using the first mouse button
2022 with the Arrow tool active.
2024 The entries of the @emph{Selection} menu are hopefully self-explanatory.
2025 Many of the @emph{Action Commands} can take various key words that make
2026 them function on all or some of the selected items.
2028 @node Rats Nest
2029 @section Rats Nest
2030 @cindex rats nest
2031 @cindex netlist
2032 @cindex rat-line
2034 If you have a netlist that corresponds to the layout you are working on, you
2035 can use the rats-nest feature to add rat-lines to the layout.
2036 First you will need to load a netlist file (see @emph{:rn},
2037 @ref{User Commands}).
2038 @emph{<Key>w} adds rat-lines on the active layer using the current
2039 line thickness shown in the status line (usually you'll want them to be thin lines).
2040 Only those rat-lines that fill in missing connectivity (since you have
2041 probably routed some connections already) are added.
2042 If the layout is already completely wired, nothing will be added, and you will
2043 get a message that the wiring is complete.
2045 Rat-lines are lines having the special property that they only connect to pins and
2046 pads at their end points.  Rat-lines are drawn on the screen with a stippled pattern
2047 to make them easier to identify since they have special behavior and cannot
2048 remain in a completed layout.
2049 Rat-lines are added in the minimum length straight-line tree pattern
2050 (always ending on pins or pads) that satisfies the missing connectivity in the circuit.
2051 Used in connection with moves and rotates of the elements, they are extremely useful for
2052 deciding where to place elements on the board. The rat-lines will always automatically
2053 rubberband to the elements whether or not the rubberband mode is on. The only way for
2054 you to move them is by moving the parts they connect to.
2055 This is because it is never desirable to have the rat-lines disconnected from
2056 their element pins.  Rat-lines will normally criss-cross
2057 all over which gives rise to the name "rats nest" describing a layout connected with
2058 them.  If a SMD pad is unreachable on the active layer, a warning will be issued
2059 about it and the rat-line to that pad will not be generated.
2061 A common way to use rats nests is to place some
2062 elements on the board, add the rat-lines, and then use a series of moves/rotates of the
2063 elements until the rats nest appears to have minimum tangling.  You may want to iterate this step
2064 several times. Don't worry if the layout looks messy - as long as you can get a sense for whether
2065 the criss-crossing is better or worse as you move things, you're fine.
2066 After moving some elements around, you may want to optimize the rats nest @emph{<Key>o}
2067 so that the lines are drawn between the closest points (this can change once you've moved components).
2068 Adding rat-lines only to selected pads/pins (@emph{Shift<Key>w})
2069 is often useful to layout a circuit a little bit at a time.
2070 Sometimes you'll want to delete all the rat-lines (@emph{<Key>e}) or
2071 selected rat-lines (@emph{Shift<Key>e}) in order to reduce confusion.
2072 With a little practice you'll be able to achieve a near optimal component placement with
2073 the use of a rats nest.
2075 Rat-lines are not only used for assisting your element placement, they can also help
2076 you to route traces on the board.
2077 Use the @emph{<Key>m} to convert a rat-line under the cursor into
2078 a normal line on the active layer.
2079 Inserting a point into a rat-line will also cause the two new lines to be normal lines
2080 on the board.
2081 Another way that you can use rat-lines is to
2082 use the @emph{<Key>f} with the cursor over a pad or pin.  All of the pins and
2083 pads and rat-lines belonging to that net will be highlighted. This is a helpful way to
2084 distinguish one net from the rest of the rats nest.  You can then route those tracks,
2085 turn off the highlighting (@emph{Shift<Key>f}) and repeat the process. This will work even
2086 if the layer that the rat-lines reside on is made invisible - so only the pins and pads
2087 are highlighted.
2088 Be sure to erase the rat-lines (@emph{<Key>e} erases them all) once you've
2089 duplicated their connectivity by adding your own lines.
2090 When in doubt, the @emph{<Key>o} will delete only those
2091 rat-lines that are no longer needed.
2093 If connections exist on the board that are not listed in the netlist when
2094 @emph{<Key>w} is pressed, warning messages are issued and the affected pins and
2095 pads are drawn in a special @emph{warnColor} until the next @emph{Notify()} event.
2096 If the entire layout agrees completely with the netlist, a message informs you that
2097 the layout is complete and no rat-lines will be added (since none are needed).
2098 If the layout is complete, but still has rat-lines then you will be warned
2099 that rat-lines remain. If you get no message at all it's probably because some
2100 elements listed in the net list can't be found and where reported in an earlier
2101 message.
2102 There shouldn't be any rat-lines left in a completed layout, only normal lines.
2104 The @emph{Shift<Key>w} is used to add rat-lines to only those missing connections among
2105 the selected pins and pads.  This can be used to add rat-lines in an incremental
2106 manner, or to force a rat-line to route between two points that are not the
2107 closest points within the net. Often it is best to add the rats nest in an incremental fashion, laying
2108 out a sub-section of the board before going further. This is easy to accomplish since
2109 new rat-lines are never added where routed connectivity already makes the necessary
2110 connections.
2112 @node Design Rule Checking
2113 @section Design Rule Checking
2114 @cindex design rule checking
2115 @cindex drc
2116 @cindex spacing, minimum
2117 @cindex overlap, minimum
2119 After you've finished laying out a board, you may want to check
2120 to be certain that none of your interconnections are too closely
2121 spaced or too tenuously touching to be reliably fabricated. The design
2122 rule checking (DRC) function does this for you. Use the command ":DRC()" (without
2123 the quotes of course) to invoke the checker.  If there are no problem areas,
2124 you'll get a message to that effect.  If any problem is encountered, you will get
2125 a message about it and the affected traces will be highlighted. One part of the
2126 tracks of concern will be selected, while the other parts of concern will have the
2127 "FindConnection" highlighting. The screen will automatically be centered in the
2128 middle of the object having the "FindConnection" (Green) highlighting.  The middle of
2129 the object is also the coordinates reported to be "near" the problem.  The actual trouble
2130 region will be somewhere on the boundary of this object.  If the two parts are
2131 from different nets then there is some place where they approach each
2132 other closer than the minimum rule.  If the parts are from the same net, then
2133 there is place where they are only barely connected. Find that place and connect
2134 them better.
2136 After a DRC error is found and corrected you must run the DRC again because
2137 the search for errors is halted as soon as the first problem is found. Unless you've
2138 been extremely careless there should be no more than a few design rule errors
2139 in your layout.  The DRC checker does not check for minimum spacing rules to
2140 copper text, so always be very careful when adding copper text to a layout.
2141 The rules for the DRC are specified in the application resource file.  The minimum
2142 spacing value (in mils) is given by the @emph{Settings.Bloat} value. The default
2143 is 7 mils. The minimum touching overlap (in mils) is given by the
2144 @emph{Settings.Shrink} value. This value defaults to 5 mils. Check with your
2145 fabrication process people to determine the values that are right for you.
2147 If you want to turn off the highlighting produced by the DRC, perform an
2148 undo (assuming no other changes have been made).  To restore the highlighting,
2149 use redo.  The redo will restore the highlighting quickly without re-running
2150 the DRC checker.
2152 @node Trace Optimizer
2153 @section Trace Optimizer
2154 @cindex trace optimizer
2155 @cindex optimizer
2157 PCB includes a flexible trace optimizer.  The trace optimizer can be run
2158 after auto routing or hand routing to clean up the traces.
2160 @table @b
2161 @item Auto-Optimize
2162 Performs debumpify, unjaggy, orthopull, vianudge, and viatrim, in that
2163 order, repeating until no further optimizations are performed.
2165 @item Debumpify
2166 Looks for U shaped traces that can be shortened or eliminated.
2168 @item Unjaggy
2169 Looks for corners which could be flipped to eliminate one or more
2170 corners (i.e. jaggy lines become simpler).
2172 @item Vianudge
2173 Looks for vias where all traces leave in the same direction. Tries to
2174 move via in that direction to eliminate one of the traces (and thus a
2175 corner).
2177 @item Viatrim
2178 Looks for traces that go from via to via, where moving that trace to a
2179 different layer eliminates one or both vias.
2181 @item Orthopull
2182 Looks for chains of traces all going in one direction, with more traces
2183 orthogonal on one side than on the other. Moves the chain in that
2184 direction, causing a net reduction in trace length, possibly eliminating
2185 traces and/or corners.
2187 @item SimpleOpts
2188 Removing unneeded vias, replacing two or more trace segments in a row
2189 with a single segment. This is usually performed automatically after
2190 other optimizations.
2192 @item Miter
2193 Replaces 90 degree corners with a pair of 45 degree corners, to reduce
2194 RF losses and trace length.
2196 @end table
2198 @node Searching for elements 
2199 @section Searching for elements
2200 @cindex Searching for elements
2201 @vindex Searching for elements
2203 To locate text or a specific element or grouping of similar elements
2204 choose @samp{Select by name} from the @b{Select} menu, then choose the
2205 appropriate subsection.  At the bottom of the screen the prompt
2206 @emph{pattern:} appears.  Enter the text or @ref{Regular Expressions}
2207 of the text to be found.  Found text will be highlighted.
2209 @node Measuring distances
2210 @section Measuring distances
2211 @cindex Measuring distances
2212 @vindex Measuring distances
2214 To measure distances, for example the pin-to-pin pitch of a part to
2215 validate a footprint, place the cursor at the starting
2216 measurement point, then press @emph{!Ctrl<Key>m}.  This marks the
2217 current  location with a @emph{X}. The @emph{X} mark is now the zero point
2218 origin for the relative cursor position display.  The cursor display
2219 shows both absolute position and position relative to the mark as
2220 the mouse is moved away from the mark.  If a mark is already present,
2221 the mark is removed and the cursor display stops displaying relative
2222 cursor coordinates.
2224 @node Vendor drill mapping
2225 @section Vendor Drill Mapping
2226 @cindex Vendor rules
2227 @cindex Vendor mapping
2228 @cindex Drill table
2229 @cindex Vendor drill table
2231 @code{Pcb} includes support for mapping drill holes to a specified set
2232 of sizes used by a particular vendor.  Many PCB manufacturers have a
2233 prefered set of drill sizes and charge extra when others are used.
2234 The mapping can be performed on an existing design and can also be
2235 enabled to automatically map drill holes as vias and elements are
2236 instantiated. 
2238 The first step in using the vendor drill mapping feature is to create
2239 a resource file describing the capabilities of your vendor.  The file
2240 format is the resource file format described in @ref{Resource Syntax}.
2241 A complete example is given below.
2243 @example
2244 # Optional name of the vendor
2245 vendor = "Vendor Name"
2247 # units for dimensions in this file.
2248 # Allowed values:  mil/inch/mm
2249 units = mil
2251 # drill table
2252 drillmap = @{
2253    # When mapping drill sizes, select the nearest size
2254    # or always round up.  Allowed values:  up/nearest
2255    round = up
2257    # The list of vendor drill sizes.  Units are as specified
2258    # above.
2259    20
2260    28
2261    35
2262    38
2263    42
2264    52
2265    59.5
2266    86
2267   125   
2268   152
2270    # optional section for skipping mapping of certain elements
2271    # based on reference designator, value, or description
2272    # this is useful for critical parts where you may not
2273    # want to change the drill size.  Note that the strings
2274    # are regular expressions.  
2275    skips = @{
2276       @{refdes "^J3$"@}  # Skip J3.
2277       @{refdes "J3"@}  # Skip anything with J3 as part of the refdes.
2278       @{refdes "^U[1-3]$" "^X.*"@} # Skip U1, U2, U3, and anything starting with X.
2279       @{value "^JOHNSTECH_.*"@} # Skip all Johnstech footprints based on the value of a part.
2280       @{descr "^AMP_MICTOR_767054_1$"@} # Skip based on the description.
2281    @}
2284 # If specified, this section will change the current DRC
2285 # settings for the design.  Units are as specified above.
2286 drc = @{
2287    copper_space = 7
2288    copper_width = 7
2289    silk_width = 10
2290    copper_overlap = 4
2292 @end example
2294 The vendor resource is loaded using the @emph{LoadVendor} action.
2295 This is invoked by entering:
2296 @example
2297 :LoadVendor(vendorfile)
2298 @end example
2299 from within @code{Pcb}.  Substitute the file name of your vendor
2300 resource file for @samp{vendorfile}.  This action will load the vendor
2301 resource and modify all the drill holes in the design as well as the
2302 default via hole size for the various routing styles.
2304 Once a vendor drill map has been loaded, new vias and elements will
2305 automatically have their drill hole sizes mapped to the vendor drill
2306 table.  Automatic drill mapping may be disabled under the ``Settings''
2307 menu.  To re-apply an already loaded vendor drill table to a design,
2308 choose ``Apply vendor drill mapping'' from the ``Connects'' menu.
2310 See @ref{Actions} for a complete description of the actions associated
2311 with vendor drill mapping.
2313 Note that the expressions used in the @code{skips} section are regular
2314 expressions.  See @ref{Regular Expressions} for an introduction to
2315 regular expressions.  
2317 @c --------------------------- Autorouter Chapter -------------------------------
2318 @node Autorouter
2319 @chapter Autorouter
2320 @cindex autorouter
2322 @code{Pcb} includes an autorouter which can greatly speed up the
2323 layout of a circuit board.  The autorouter is a rectangle-expansion
2324 type of autorouter based on 
2325 ``A Method for Gridless Routing of Printed Circuit Boards'' by
2326 A. C. Finch, K. J. Mackenzie, G. J. Balsdon, and G. Symonds in the
2327 1985 Proceedings of the 22nd ACM/IEEE Design Automation Conference.
2328 This reference is available from the ACM Digital Library at
2329 @url{http://www.acm.org/dl} for those with institutional or personal
2330 access to it.  It's also available from your local engineering
2331 library.  The reference paper is not needed for using the autorouter.
2333 Before using the autorouter, all elements need to be loaded into the
2334 layout and placed and the connectivity netlist must be loaded.  Once
2335 the elements have been placed and the netlist loaded, the following
2336 steps will autoroute your design.
2338 @enumerate
2339 @item Turn off visibility of any layers that you don't want the router
2340 to use.
2342 @item Turn of via visibility if you don't want the router to use any
2343 new vias. 
2345 @item Use only plain rectangles for power/ground planes that you want
2346    the router to use [use the rectangle tool!]
2348 @item Make at least one connection from any plane you want the router to
2349    use to the net you want it to connect to.
2351 @item Draw continuous lines (on all routing layers) to outline keep-out
2352    zones if desired.
2354 @item Use routing styles in the netlist to have per-net routing styles.  
2355   Note that the routing style will be used for an entire net.  This means
2356   if you have a wide metal setting for a power net you will need to manually
2357   route breakouts from any fine pitch parts on their power pins because
2358   the router will not be able to change to a narrow trace to connect
2359   to the part.
2361 @item Set the current routing style to whatever you'd like the router to
2362    use for any nets not having a defined route style in the netlist.
2364 @item Disable any nets that you don't want the autorouter to route
2365    (double-click them in the  netlist window to add/remove the *)
2367          NOTE: If you will be manually routing these later not using
2368    planes, it is usually better to let the autorouter route them then rip
2369    them up yourself afterwards. If you plan to use a ground/power plane
2370    manually, consider making it from one or more pure rectangles and
2371    letting the autorouter have a go at it.
2373 @item Create a fresh rat's nest. ('E' the 'W')
2375 @item Select ``show autorouter trials'' in the settings menu if you want
2376    to watch what's happening
2378 @item Choose ``autoroute all rats'' in the connection menu.
2380 @item If you really want to muck with the router because you have a
2381    special design, e.g. all through-hole components you can mess with
2382    layer directional costs by editing the autoroute.c source file and
2383    changing the directional costs in lines 929-940. and try again. Even
2384    more mucking about with costs is possible in lines 4540-4569, but it's
2385    probably not such a good idea unless you really just want to
2386    experiment.
2388 @end enumerate
2390 After the design has been autorouted, you may want to run the trace
2391 optimizer.  See section @ref{Trace Optimizer} for more information on
2392 the trace optimizer.
2395 @c --------------------------- User Commands chapter -------------------------------
2396 @node User Commands
2397 @chapter User Commands
2399 @cindex user commands
2400 @cindex entering user commands
2401 The entering of user-commands is initiated by the action routine
2402 @emph{Command()} (the @code{(":")} character) and finished by either
2403 @emph{<Key>Return}
2404 or @emph{<Key>Escape} to confirm or to abort. These two key-bindings
2405 cannot be changed from the resource file.
2406 The triggering event, normally a key press, is ignored.
2407 The input area will replace the bottom statusline. It pops
2408 up when @emph{Command()} is called. The arguments of the user-commands
2409 are passed to the external commands without modification.
2410 See also, the resource @emph{saveInTMP}.
2412 There are simple @emph{usage} dialogs for each command and one for the
2413 complete set of commands.
2416 @table @samp
2418 @findex :l
2419 @cindex loading layouts
2420 @cindex layout, loading a
2421 @item l [filename]
2422 Loads a new datafile (layout) and, if confirmed, overwrites any existing unsaved data.
2423 The filename and the searchpath (@emph{filePath}) are passed to the
2424 command defined by @emph{fileCommand}.
2425 If no filename is specified a file select box will popup.
2427 @findex :le
2428 @cindex loading elements to buffer
2429 @cindex element, loading to buffer
2430 @item le [filename]
2431 Loads an element description into the paste buffer.
2432 The filename and the searchpath (@emph{elementPath}) are passed to the
2433 command defined by @emph{elementCommand}.
2434 If no filename is specified a file select box will popup.
2436 @findex :m
2437 @cindex loading a layout to buffer
2438 @cindex merging layouts
2439 @cindex layout, loading to buffer
2440 @cindex layout, merging a
2441 @item m [filename]
2442 Loads an layout file into the paste buffer.
2443 The filename and the searchpath (@emph{filePath}) are passed to the
2444 command defined by @emph{fileCommand}.
2445 If no filename is specified a file select box will popup.
2447 @findex :q
2448 @cindex exit
2449 @cindex quit
2450 @item q[!]
2451 Quits the program without saving any data (after confirmation).
2452 q! doesn't ask for confirmation, it just quits.
2454 @findex :s
2455 @cindex saving layouts
2456 @cindex layout files, saving of
2457 @item s [filename]
2458 Data and the filename are passed to the command defined by the resource
2459 @emph{saveCommand}. It must read the layout data from @emph{stdin}.
2460 If no filename is entered, either the last one is used
2461 again or, if it is not available, a file select box will pop up.
2463 @findex :rn
2464 @cindex rat's nest
2465 @cindex layout-name
2466 @item rn [filename]
2467 Reads in a netlist file.  If no filename is given
2468 a file select box will pop up.
2469 The file is read via the command defined by the
2470 @emph{RatCommand} resource. The command must send its output to @emph{stdout}.
2472 Netlists are used for generating rat's nests (see @ref{Rats Nest}) and for
2473 verifying the board layout (which is also accomplished by the @emph{Ratsnest}
2474 command).
2476 @findex :w[q]
2477 @cindex saving layouts
2478 @cindex layout files, saving of
2479 @item w[q] [filename]
2480 These commands have been added for the convenience of @code{vi} users and
2481 have the same functionality as @emph{s} combined with @emph{q}.
2483 @findex :actionCommand()
2484 @cindex action command
2485 @cindex Actions, initiating
2486 @item actionCommand
2487 Causes the actionCommand to be executed.  This allows you to initiate actions
2488 for which no bindings exist in the resource file.  It can be used to initiate any
2489 action with whatever arguments you enter.  This makes it possible to do things
2490 that otherwise would be extremely tedious.  For example, to change the drilling
2491 hole diameter of all vias in the layout to 32 mils, you could select everything using the
2492 selection menu, then type "@emph{:ChangeDrillSize(SelectedVias, 32)}".  (This will
2493 only work provided the via's diameter is sufficiently large to accommodate a 32 mil hole).
2494 Another example might be to set the grid to 1 mil by typing "@emph{:SetValue(Grid, 1)}".
2495 Note that some actions use the current cursor location, so be sure to place the cursor
2496 where you want before entering the command.  This is one of my favorite new
2497 features in 1.5 and can be a powerful tool. Study the @ref{Actions} section to
2498 see what actions are available.
2500 @end table
2503 @c --------------------------- chapter 4 -------------------------------
2504 @node Command-Line Options
2505 @chapter Command-Line Options
2506 @cindex starting @code{Pcb}
2507 @cindex command-line options
2509 There are several resources which may be set or reset in addition to the
2510 standard toolkit command-line options. For a complete list refer to
2511 @ref{Resources}.
2513 The synopsis is:
2515 @code{pcb [-option ...] [-toolkit_option ...] [layout-file]}
2519 @code{pcb -specialoption}
2521 @menu
2522 * Options::                @code{Pcb} command-line options.
2523 * Special Options::        Version and copyright information.
2524 @end menu
2526 @node Options
2527 @section Options
2529 @table @samp
2531 @vindex allDirectionLines
2532 @cindex line clipping
2533 @cindex clipping of lines
2534 @findex -alldirections
2535 @findex +alldirections
2536 @item -alldirections/+alldirections
2537 Disables or enables line clipping to 45 degree angles. Overwrites the
2538 resource @emph{allDirectionLines}.
2540 @vindex backgroundImage
2541 @cindex background
2542 @findex -background
2543 @item -background file
2544 Selects a PPM file to be displayed as the board background (for tracing).
2545 See backgroundImage in @ref{Resources} for details.
2547 @vindex backupInterval
2548 @cindex backup
2549 @findex -backup
2550 @item -backup value
2551 Time between two backups in seconds. Passing zero disables the backup feature.
2552 Overwrites the resource @emph{backupInterval}.
2554 @vindex charactersPerLine
2555 @cindex characters per line
2556 @cindex length of outputline
2557 @cindex outputline, length of
2558 @findex -c
2559 @item -c value
2560 Number of characters per output line. The resource @emph{charactersPerLine} is
2561 overwritten.
2563 @vindex fontFile
2564 @vindex default font
2565 @findex -fontfile
2566 @cindex default font
2567 @cindex symbols
2568 @item -fontfile filename
2569 The default set of symbols (font) for a new layout is read from this file.
2570 All directories as defined by the resource @emph{fontPath} are scanned
2571 for the file. The scan is only performed if the filename doesn't contain
2572 a directory component. The @emph{fontFile} resource is changed.
2574 @vindex elementCommand
2575 @findex -lelement
2576 @cindex element, command
2577 @cindex element, files
2578 @cindex loading elements
2579 @cindex preprocessing element data
2580 @cindex unix command
2581 @item -lelement command-line
2582 Sets the command to be executed when an element is loaded from a file to the
2583 paste buffer. The command may contain %f and %p to pass the requested filename
2584 and the searchpath to the command. It must write the data to its
2585 standard output. The related resource is @emph{elementCommand}.
2587 @vindex fileCommand
2588 @findex -lfile
2589 @cindex file load command
2590 @cindex layout files
2591 @cindex loading layouts
2592 @cindex preprocessing layout data
2593 @cindex unix command
2594 @item -lfile command-line
2595 Sets the command to be executed when a new layout is loaded from a file.
2596 The command may contain %f and %p to pass the requested filename
2597 and the searchpath to the command. It must write the data to its
2598 standard output. The related resource is @emph{fileCommand}.
2600 @vindex fontCommand
2601 @cindex font command
2602 @cindex font files
2603 @cindex loading fonts
2604 @cindex loading symbols
2605 @cindex preprocessing font data
2606 @cindex unix command
2607 @findex -lfont
2608 @item -lfont command-line
2609 Sets the command to be executed when a font is loaded from a file.
2610 The command may contain %f and %p to pass the requested filename
2611 and the searchpath to the command. It must write the data to its
2612 standard output. The related resource is @emph{fontCommand}.
2614 @vindex layerGroups
2615 @cindex layers, groups
2616 @cindex groups
2617 @findex -lg
2618 @item -lg layergroups
2619 This option overwrites the resource @emph{layerGroups}. See its description
2620 for more information. The value is used for new layouts only.
2622 @vindex libraryFilename
2623 @findex -libname
2624 @cindex library name
2625 @item -libname filename
2626 The default filename for the library. Overwrites the resource
2627 @emph{libraryFilename}.
2629 @vindex libraryPath
2630 @findex -libpath
2631 @cindex library search path
2632 @item -libpath path
2633 The default search path for the the library. Overwrites the resource
2634 @emph{libraryPath}.
2636 @vindex libraryCommand
2637 @cindex library command
2638 @cindex loading elements
2639 @cindex preprocessing element data
2640 @cindex unix command
2641 @findex -llib
2642 @item -llib command-line
2643 Sets the command to be executed when an element is loaded from the library.
2644 The command may contain %f and %p to pass the requested filename
2645 and the searchpath to the command. %a is replaces by the three arguments
2646 @emph{template}, @emph{value} and @emph{package}. The command must write
2647 the data to its standard output. The related resource is @emph{libraryCommand}.
2649 @vindex libraryContentsCommand
2650 @cindex library contents command
2651 @cindex listing libraries
2652 @cindex unix command
2653 @findex -llibcont
2654 @item -llibcont command-line
2655 The command lists the contents of the library.
2656 The command may contain %f and %p to pass the library filename
2657 and the searchpath to the command. Also refer to @ref{Library File}
2658 and @ref{Library Contents File}.
2659 The related resource is @emph{libraryContentsCommand}.
2661 @cindex log window
2662 @cindex messages
2663 @findex -loggeometry
2664 @item -loggeometry geometry
2665 Determines the geometry of the log window.
2667 @vindex pinoutNameLength
2668 @findex -pnl
2669 @cindex namelength of pins
2670 @cindex pin, name of
2671 @cindex length of a pin name
2672 @item -pnl value
2673 Restricts the displayed length of the name of a pin in the pinout window to
2674 the passed value. See also, the resource @emph{pinoutNameLength}.
2676 @vindex pinoutZoom
2677 @cindex pinout, zoomfactor of display
2678 @cindex zoom of pinout window
2679 @findex -pz
2680 @item -pz value
2681 Sets the zoom factor for the pinout window according to the formula:
2682 scale = 1:(2 power value). The related resource is @emph{pinoutZoom}.
2684 @vindex resetAfterElement
2685 @findex -reset
2686 @findex +reset
2687 @cindex connections, reseting after element
2688 @cindex reseting found connections
2689 @item -reset/+reset
2690 If enabled, all connections are reset after each element is scanned.
2691 This feature is only used while scanning connections to all elements.
2692 See also, @emph{resetAfterElement}.
2694 @vindex ringBellWhenFinished
2695 @findex -ring
2696 @findex +ring
2697 @cindex keyboard bell
2698 @item -ring/+ring
2699 Overrides the resource @emph{ringBellWhenFinished}. If enabled, the bell
2700 sounds when connection searching has finished.
2702 @vindex routeStyle
2703 @findex -rs
2704 @cindex routing style
2705 @item -rs string
2706 Overrides the resource @emph{routeStyle}. The string defines a colon
2707 separated list of route styles. The route styles consist of a
2708 comma separated list of name, line thickness, via diameter, and via drill size.
2709 e.g. "Fat,50,100,40:Skinny,8,35,20:75Ohm,110,110,20"
2711 @vindex saveLastCommand
2712 @cindex saving last entered user command
2713 @cindex inputfield, saving entered command-line
2714 @findex -s
2715 @findex +s
2716 @item -s/+s
2717 Enables/Disables the saving of the previous commandline. Overrides the
2718 @emph{saveLastCommand} resource.
2720 @vindex saveInTMP
2721 @findex -save
2722 @findex +save
2723 @cindex backup
2724 @cindex saving layouts
2725 @cindex preventing loss of data
2726 @cindex temporary files
2727 @cindex /tmp
2728 @cindex directory /tmp
2729 @item -save/+save
2730 See the resource description of @emph{saveInTMP} for details.
2732 @vindex saveCommand
2733 @cindex file save command
2734 @cindex layout files
2735 @cindex saving layouts
2736 @cindex postprocessing layout data
2737 @cindex unix command
2738 @findex -sfile
2739 @item -sfile command-line
2740 Sets the command to be executed when an layout file is saved.
2741 The command may contain %f which is replaced by the filename. The command
2742 must read its data from the standard input.
2743 The resource @emph{saveCommand} is overwritten.
2745 @vindex scriptFilename
2746 @findex -script
2747 @cindex startup actions script
2748 @item -script filename
2749 Specifies a script file containing PCB actions to be executed
2750 upon startup.  Overwrites the resource
2751 @emph{scriptFilename}.
2753 @vindex size
2754 @cindex size of a layout
2755 @cindex layout size
2756 @findex -size
2757 @item -size <width>x<height>
2758 Overrides the resource @emph{size} which determines the maximum size
2759 of a layout.
2761 @vindex volume
2762 @cindex speaker volume
2763 @cindex volume of speaker
2764 @findex -v
2765 @item -v value
2766 Sets the volume of the X speaker. The value is passed to @code{XBell()} and
2767 must be in the range -100..100.
2769 @end table
2772 @node Special Options
2773 @section Special Options
2775 There are some special options available in addition to normal command line
2776 options. Each of these must be the only option specified on a command line.
2777 The available special options are:
2779 @table @samp
2781 @findex -copyright
2782 @findex --copyright
2783 @cindex copyright
2784 @item -copyright
2785 Prints out the copyright notice and terminates.
2787 @findex -version
2788 @cindex release, current
2789 @cindex version, current
2790 @item -version
2791 Prints out the version ID and terminates.
2793 @findex -help
2794 @item -help
2795 Prints out the usage message and terminates.
2797 @end table
2800 @c --------------------------- chapter 5 -------------------------------
2801 @node X11 Interface
2802 @chapter X11 Interface
2803 @cindex X11
2805 This chapter gives an overview about the additional @code{X11} resources which
2806 are defined by @code{Pcb} as well as the defined action routines.
2808 @menu
2809 * Resources::      Non-standard @code{X11} application resources.
2810 * Actions::        A list of available action routines.
2811 * Translations::   A list of the default key translations (as shipped).
2812 @end menu
2815 @node Resources
2816 @section Non-Standard X11 Application Resources
2817 @cindex resources
2818 @cindex X11 resources
2820 In addition to the toolkit resources, @code{Pcb} defines the
2821 following resources:
2823 @table @samp
2825 @vindex absoluteGrid
2826 @cindex grid
2827 @item absoluteGrid (boolean)
2828 Selects if either the grid is relative to the position where it has changed
2829 last or absolute, the default, to the origin (0,0).
2831 @vindex alignmentDistance
2832 @cindex alignment
2833 @item alignmentDistance (dimension)
2834 Specifies the distance between the boards outline to the alignment targets.
2836 @vindex allDirectionLines
2837 @cindex lines, clipping to 45 degree
2838 @cindex clipping lines to 45 degree
2839 @item allDirectionLines (boolean)
2840 Enables (default) or disables clipping of new lines to 45 degree angles.
2842 @vindex backgroundImage
2843 @cindex background
2844 @item backgroundImage (string)
2845 If specified, this image will be drawn as the background for the
2846 board.  The purpose of this option is to allow you to use a scan of an
2847 existing layout as a prototype for your new layout.  To do this, there
2848 are some limitations as to what this image must be.  The image must be
2849 a PPM binary image (magic number @samp{P6}).  It must have a maximum
2850 pixel value of 255 or less (i.e. no 16-bit images).  It must represent
2851 the entire board, as it will be scaled to fit the board dimensions
2852 exactly.  Note that it may be scaled unevenly if the image doesn't
2853 have the same aspect ratio of your board.  You must ensure that the
2854 image does not use more colors than are available on your system
2855 (mostly this is for pseudo-color displays, like old 8-bit displays).
2856 For best results, I suggest the following procedure using The Gimp:
2857 Load your image (any type).  Image->Scale if needed.
2858 Image->Colors->Curves and for each of Red, Green, and Blue channel
2859 move the lower left point up to about the 3/4 line (value 192).  This
2860 will make your image pale so it doesn't interfere with the traces
2861 you'll be adding.  Image->Mode->Indexed and select, say, 32 colors
2862 with Normal F-S dithering.  File->Save As, file type by extension,
2863 use @file{.ppm} as the extension.  Select Raw formatting.
2865 @vindex backupInterval
2866 @cindex backup
2867 @item backupInterval (int)
2868 @code{Pcb} has an automatic backup feature which saves the current data
2869 every n seconds. The default is @emph{300} seconds. A value of zero disables
2870 the feature. The backup file is named @file{/tmp/PCB.%i.backup} by
2871 default (this may have been changed at compilation time via the
2872 @code{BACKUP_NAME}
2873 variable in @file{globalconfig.h}).
2874 @emph{%i} is replaced by the process ID.
2875 See also, the command-line option @emph{-backup}.
2877 @vindex bloat
2878 @cindex bloat
2879 @cindex drc
2880 @item Bloat (dimension)
2881 Specifies the minimum spacing design rule in mils.
2883 @vindex charactersPerLine
2884 @cindex characters per line
2885 @cindex linelength
2886 @cindex list of connections
2887 @item charactersPerLine (int)
2888 @code{Pcb} uses this value to determine the page width when creating lists.
2889 N, the number of characters per line, defaults to @emph{80}.
2890 See also, the command-line option @emph{-c}.
2892 @vindex connectedColor
2893 @cindex colors
2894 @cindex connections, colors
2895 @item connectedColor (color)
2896 All pins, vias, lines and rectangles which are selected during a connection
2897 search are drawn with this color. The default value is determined by
2898 @emph{XtDefaultForeground}.
2900 @vindex cross hairColor
2901 @cindex colors
2902 @cindex cursor color
2903 @item cross hairColor (color)
2904 This color is used to draw the cross hair cursor. The color is a result of
2905 a @emph{XOR} operation with the contents of the Layout area. The result
2906 also depends on the default colormap of the @code{X11} server because only
2907 the colormap index is used in the boolean operation and @code{Pcb} doesn't
2908 create its own colormap. The default setting is @emph{XtDefaultForeground}.
2910 @vindex elementColor
2911 @vindex elementSelectedColor
2912 @cindex colors
2913 @cindex element, color
2914 @item elementColor (color)
2915 @itemx elementSelectedColor (color)
2916 The elements package part is drawn in these colors, for normal and selected
2917 mode, respectively, which both default to @emph{XtDefaultForeground}.
2919 @vindex elementCommand
2920 @cindex element, command
2921 @cindex element, files
2922 @cindex loading elements
2923 @cindex preprocessing element data
2924 @cindex unix command
2925 @cindex m4
2926 @item elementCommand (string)
2927 @code{Pcb} uses a user defined command to read element files. This resources
2928 is used to set the command which is executed by the users default shell.
2929 Two escape sequences are defined to pass the selected filename (%f) and the
2930 current search path (%p). The command must write the element data
2931 to its standard output. The default value is
2932 @example
2933     M4PATH="%p";export M4PATH;echo 'include(%f)' | m4
2934 @end example
2935 Using the GNU version of @code{m4} is highly recommended.
2936 See also, the command-line option @emph{-lelement}.
2938 @vindex elementPath
2939 @cindex searchpath for element files
2940 @cindex path for element files
2941 @cindex element, files
2942 @cindex loading elements
2943 @item elementPath (string)
2944 A colon separated list of directories or commands (starts with '|').
2945 The path is passed to the program specified in @emph{elementCommand} together
2946 with the selected element name. A specified command will be executed in order
2947 to create entries for the fileselect box. It must write its results to
2948 @emph{stdout} one entry per line.
2949 See also, the user-command @emph{le[!]}.
2951 @vindex fileCommand
2952 @cindex file load command
2953 @cindex layout files
2954 @cindex loading layouts
2955 @cindex preprocessing layout data
2956 @cindex unix command
2957 @cindex cat
2958 @item fileCommand (string)
2959 The command is executed by the user's default shell whenever existing layout
2960 files are loaded. Data is read from the command's standard output.
2961 Two escape sequences may be specified to pass the selected filename (%f)
2962 and the current search path (%p). The default value is:
2963 @example
2964     cat %f
2965 @end example
2966 See also, the command-line option @emph{-lfile}.
2968 @vindex filePath
2969 @cindex searchpath for layout files
2970 @cindex path for layout files
2971 @cindex layout files
2972 @cindex loading layouts
2973 @item filePath (string)
2974 A colon separated list of directories or commands (starts with '|').
2975 The path is passed to the program specified in @emph{fileCommand} together
2976 with the selected filename. A specified command will be executed in order
2977 to create entries for the fileselect box. It must write its results to
2978 @emph{stdout} one entry per line.
2979 See also, the user-command @emph{l[!]}.
2981 @vindex fontCommand
2982 @cindex font command
2983 @cindex font files
2984 @cindex loading fonts
2985 @cindex loading symbols
2986 @cindex preprocessing font data
2987 @cindex unix command
2988 @cindex cat
2989 @item fontCommand (string)
2990 Loading new symbol sets also is handled by an external command. You again
2991 may pass the selected filename and the current search path by passing
2992 %f and %p in the command string. Data is read from the commands standard
2993 output. This command defaults to
2994 @example
2995     cat %f
2996 @end example
2997 See also, the command-line option @emph{-lfont}.
2999 @vindex fontFile
3000 @cindex default font
3001 @cindex symbols
3002 @item fontFile (string)
3003 The default font for new layouts is read from this file which is searched
3004 in the directories as defined by the resource @emph{fontPath}.
3005 Searching is only performed if the filename does not contain a directory
3006 component.
3007 The default filename is @file{default_font}.
3008 See also, the command-line option @emph{-fontfile}.
3010 @vindex fontPath
3011 @cindex searchpath for font files
3012 @cindex path for font files
3013 @cindex font files
3014 @cindex loading fonts
3015 @cindex loading symbols
3016 @item fontPath (string)
3017 This resource, a colon separated list of directories, defines the searchpath
3018 for font files. See also, the resource @emph{fontFile}.
3020 @vindex grid
3021 @cindex grid
3022 @cindex cursor steps
3023 @item grid (int)
3024 This resources defines the initial value of one cursor step. It defaults
3025 to @emph{100 mil} and any changes are saved together with the layout data.
3027 @vindex gridColor
3028 @cindex colors
3029 @cindex grid color
3030 @item gridColor (color)
3031 This color is used to draw the grid. The color is a result of
3032 a @emph{INVERT} operation with the contents of the Layout area. The result
3033 also depends on the default colormap of the @code{X11} server because only
3034 the colormap index is used in the boolean operation and @code{Pcb} doesn't
3035 create its own colormap. The default setting is @emph{XtDefaultForeground}.
3037 @vindex invisibleObjectsColor
3038 @cindex colors
3039 @cindex element, color
3040 @item elementColor (color)
3041 Elements located on the opposite side of the board are drawn in this color.
3042 The default is @emph{XtDefaultForeground}.
3044 @vindex layerColor
3045 @vindex layerSelectedColor
3046 @cindex colors
3047 @cindex layers, colors
3048 @item layerColor1..MAX_LAYER (color)
3049 @itemx layerSelectedColor1..MAX_LAYER (color)
3050 These resources define the drawing colors of the different layers in
3051 normal and selected state. All values are preset to @emph{XtDefaultForeground}.
3053 @vindex layerGroups
3054 @cindex layers, groups
3055 @cindex groups
3056 @item layerGroups (string)
3057 The argument to this resource is a colon separated list of comma separated
3058 layer numbers (1..MAX_LAYER). All layers within one group are switched on/off
3059 together. The default setting is @emph{1:2:3:...:MAX_LAYER} which means
3060 all layers are handled separately. Grouping layers one to three looks like
3061 @emph{1,2,3:4:...:MAX_LAYER}
3062 See also, the command-line option @emph{-lg}.
3064 @vindex layerName
3065 @cindex layer, name of
3066 @item layerName1..MAX_LAYER (string)
3067 The default name of the layers in a new layout are determined by these
3068 resources. The defaults are empty strings.
3070 @vindex libraryCommand
3071 @cindex library command
3072 @cindex loading elements
3073 @cindex unix command
3074 @item libraryCommand (string)
3075 @code{Pcb} uses a command to read element data from libraries.
3076 The resources is used to set the command which is executed by the users
3077 default shell.  Three escape sequences are defined to pass the selected
3078 filename (%f), the current search path (%p) as well (%a) as the three
3079 parameters @emph{template}, @emph{value} and @emph{package} to the command.
3080 It must write the element data to its standard output. The default value is
3081 @example
3082     NONE/share/pcb/oldlib/QueryLibrary.sh %p %f %a
3083 @end example
3085 @vindex elementContentsCommand
3086 @cindex library contents command
3087 @cindex listing library contents
3088 @cindex unix command
3089 @item libraryContentsCommand (string)
3090 Similar to @emph{libraryCommand}, @code{Pcb} uses the command specified
3091 by this resource to list the contents of a library.
3092 @example
3093         NONE/share/pcb/oldlib/ListLibraryContents.sh %p %f
3094 @end example
3095 is the default.
3097 @vindex libraryFilename
3098 @cindex default library
3099 @cindex library name
3100 @item libraryFilename (string)
3101 The resource specifies the name of the library. The default value is
3102 @emph{pcblib} unless changed at compile time
3103 with the @code{LIBRARYFILENAME} variable in @file{globalconfig.h}.
3105 @vindex libraryPath
3106 @cindex searchpath for libraries
3107 @cindex path for libraries
3108 @cindex library searchpath
3109 @item libraryPath (string)
3110 A colon separated list of directories that will be passed to the commands
3111 specified by @emph{elementCommand} and @emph{elementContentsCommand}.
3113 @vindex lineThickness
3114 @cindex lines, size
3115 @cindex size of lines
3116 @cindex thickness of lines
3117 @item lineThickness (dimension)
3118 The value, in the range [1..250] (the range may be changed at compile
3119 time with the @code{MIN_LINESIZE} and @code{MAX_LINESIZE} variables in
3120 @file{globalconfig.h}), defines the
3121 initial thickness of new lines. The value is preset to @emph{ten mil}.
3123 @vindex media
3124 @cindex media
3125 @cindex media margin
3126 @cindex print media
3127 @item media (<predefined> | <width>x<height>+-<left_margin>+-<top_margin>)
3128 The default (user defined) media of the @code{PostScript} device. Predefined
3129 values are @emph{a3}, @emph{a4}, @emph{a5}, @emph{letter}, @emph{tabloit},
3130 @emph{ledger}, @emph{legal}, and @emph{executive}.
3131 The second way is to specify the medias width, height and margins in mil.
3132 The resource defaults to @emph{a4} size unless changed at compile time
3133 with the @code{DEFAULT_MEDIASIZE} variable in @file{globalconfig.h}.
3135 @vindex offLimitColor
3136 @cindex colors
3137 @cindex off limit color
3138 @item offLimitColor (color)
3139 The area outside the current maximum settings for width and height is drawn
3140 with this color. The default value is determined by @emph{XtDefaultBackground}.
3142 @vindex pinColor
3143 @vindex pinSelectedColor
3144 @cindex colors
3145 @cindex pin color
3146 @item pinColor (color)
3147 @itemx pinSelectedColor(color)
3148 This resource defines the drawing color of pins and pads in both states.
3149 The values are preset to @emph{XtDefaultForeground}.
3151 @vindex pinoutFont0..6
3152 @cindex font, used for pin names
3153 @cindex pinout, font to display pin names
3154 @item pinoutFont (string)
3155 This fonts are used to display pin names. There is one font for each zoom
3156 value. The values are preset to @emph{XtdefaultFont}.
3158 @vindex pinoutNameLength
3159 @cindex namelength of pins
3160 @cindex pin, name of
3161 @cindex length of a pin name
3162 @item pinoutNameLength (int)
3163 This resource limits the number of characters which are displayed for
3164 pin names in the pinout window. By default the string length is limited
3165 to @emph{eight} characters per name.
3166 See also, the command-line option @emph{-pnl}.
3168 @vindex pinoutOffsetX
3169 @vindex pinoutOffsetY
3170 @cindex offset of pinout
3171 @item pinoutOffsetX (int)
3172 @itemx pinoutOffsetY (int)
3173 These resources determine the offset in @emph{mil} of the circuit from the
3174 upper left corner of the window when displaying pinout information.
3175 Both default to @emph{100 mil}.
3177 @vindex pinoutTextOffsetX
3178 @vindex pinoutTextOffsetY
3179 @cindex offset of pinnames
3180 @item pinoutTextOffsetX (int)
3181 @itemx pinoutTextOffsetY (int)
3182 The resources determine the distance in mil between the drilling hole of a pin
3183 to the location where its name is displayed in the pinout window.
3184 They default to @emph{X:50} and @emph{Y:0}.
3186 @vindex pinoutZoom
3187 @cindex pinout, zoomfactor of display
3188 @cindex zoom of pinout window
3189 @item pinoutZoom (int)
3190 Sets the zoom factor for the pinout window according to the formula:
3191 scale = 1:(2 power value). Its default value is @emph{two} which results in
3192 a @emph{1:4} scale.
3193 See also, the command-line option @emph{-pz}.
3195 @vindex printCommand
3196 @cindex printing
3197 @item printCommand (string)
3198 Default file for printouts. If the name starts with a '|' the output
3199 is piped through the command. A %f is replaced by the current filename.
3200 There is no default file or command.
3202 @vindex raiseLogWindow
3203 @cindex log window
3204 @cindex messages
3205 @item raiseLogWindow (boolean)
3206 The log window will be raised when new messages arrive if this resource
3207 is set @emph{true}, the default.
3209 @vindex ratCommand
3210 @cindex rats nest
3211 @cindex netlist
3212 @item ratCommand (string)
3213 Default command for reading a netlist. A %f is replaced by the netlist
3214 filename. Its default value is "@emph{cat %f}".
3216 @vindex ratPath
3217 @cindex rats nest
3218 @cindex netlist
3219 @item ratPath (string)
3220 Default path to look for netlist files. It's default value is "."
3222 @vindex resetAfterElement
3223 @cindex connections, reseting after element
3224 @cindex reseting found connections
3225 @item resetAfterElement (boolean)
3226 If set to @emph{true}, all found connections will be reset before a new
3227 element is scanned. This will produce long lists when scanning the whole
3228 layout for connections. The resource is set to @emph{false} by default.
3229 The feature is only used while looking up connections of all elements.
3230 See also, the command-line option @emph{-reset, +reset}.
3232 @vindex ringBellWhenFinished
3233 @cindex keyboard bell
3234 @item ringBellWhenFinished (boolean)
3235 Whether to ring the bell (the default) when a possibly lengthy operation
3236 has finished or not.
3237 See also, the command-line option @emph{-ring, +ring}.
3239 @vindex routeStyle
3240 @cindex routing style
3241 @item routeStyle (string)
3242 Default values for the menu of routing styles (seen in the sizes menu).
3243 The string is a comma separated list of name, line thickness,
3244 via diameter, and via drill size.
3245 e.g. "Fat,50,100,40:Skinny,8,35,20:75Ohm,110,110,20"
3246 See also, the command-line option @emph{-rs} and @emph{Sizes Menu}
3248 @vindex rubberBandMode
3249 @cindex move
3250 @cindex rubberband
3251 @cindex rotate
3252 @item rubberBandMode (boolean)
3253 Whether rubberband move and rotate (attached lines stretch like
3254 rubberbands) is enabled (the default).
3256 @vindex saveCommand
3257 @cindex file save command
3258 @cindex layout files
3259 @cindex saving layouts
3260 @cindex postprocessing layout data
3261 @cindex unix command
3262 @cindex cat
3263 @item saveCommand (string)
3264 This command is used to save data to a layout file. The filename may be
3265 indicated by placing @code{%f} in the string. It must read the data from
3266 its standard input.  The default command is:
3267 @example
3268     cat - > %f
3269 @end example
3270 See also, the command-line option @emph{-sfile}.
3272 @vindex saveInTMP
3273 @cindex backup
3274 @cindex saving layouts
3275 @cindex preventing loss of data
3276 @cindex temporary files
3277 @cindex /tmp
3278 @cindex directory /tmp
3279 @item saveInTMP (boolean)
3280 Enabling this resource will save all data which would otherwise be lost
3281 in a temporary file @file{/tmp/PCB.%i.save}.  The file name may
3282 be changed at compile time
3283 with the @code{EMERGENCY_NAME} variable in @file{globalconfig.h}.
3285 @emph{%i} is replaced by the process ID.
3286 As an example, loading a new layout when the old one hasn't been saved would
3287 use this resource.
3288 See also, the command-line option @emph{-save, +save}.
3290 @vindex saveLastCommand
3291 @cindex saving last entered user command
3292 @cindex inputfield, saving entered command-line
3293 @item saveLastCommand (boolean)
3294 Enables the saving of the last entered user command. The option is
3295 @emph{disabled} by default.
3296 See also, the command-line option @emph{-s, +s}.
3298 @vindex shrink
3299 @cindex shrink
3300 @cindex drc
3301 @item Shrink (dimension)
3302 Specifies the minimum overlap (touching) design rule in mils.
3304 @vindex size
3305 @cindex default layout size
3306 @cindex layout, default size of
3307 @item size (<width>x<height>)
3308 Defines the width and height of a new layout. The default is
3309 @emph{7000x5000} unless changed at compile time
3310 with the @code{DEFAULT_SIZE} variable in @file{globalconfig.h}.
3313 @vindex stipplePolygons
3314 @cindex polygon
3315 @cindex display
3316 @item stipllePolygons (boolean)
3317 Determines whether to display polygons on the screen with a stippled
3318 pattern.  Stippling can create some amount of transparency so that
3319 you can still (to some extent) see layers beneath polygons.
3320 It defaults to False.
3322 @vindex textScale
3323 @cindex text, default scaling
3324 @cindex default text scaling
3325 @item textScale (dimension)
3326 The font scaling in percent is defined by this resource. The default is
3327 @emph{100} percent.
3329 @vindex useLogWindow
3330 @cindex log window
3331 @cindex messages
3332 @item useLogWindow (boolean)
3333 Several subroutines send messages to the user if an error occurs.
3334 This resource determines if they appear inside the log window or as a separate
3335 dialog box. See also, the resource @emph{raiseLogWindow} and the command line
3336 option @emph{-loggeometry}.
3337 The default value is @emph{true}.
3339 @vindex viaColor
3340 @vindex viaSelectedColor
3341 @cindex colors
3342 @cindex vias, color
3343 @item viaColor (color)
3344 @item viaSelectedColor (color)
3345 This resource defines the drawing color of vias in both states.
3346 The values are preset to @emph{XtDefaultForeground}.
3348 @vindex viaThickness
3349 @vindex viaDrillingHole
3350 @cindex vias, size
3351 @cindex size of vias
3352 @cindex thickness of vias
3353 @item viaThickness (dimension)
3354 @itemx viaDrillingHole (dimension)
3355 The initial thickness and drilling hole of new vias. The values must be in the
3356 range [30..400] (the range may be changed at compile
3357 time with the @code{MIN_PINORVIASIZE} and @code{MAX_PINEORVIASIZE} variables in
3358 @file{globalconfig.h}), with at least 20
3359 mil of copper.
3360 The default thickness is @emph{40 mil} and the default drilling hole is
3361 @emph{20 mil}.
3363 @vindex volume
3364 @cindex speaker volume
3365 @cindex volume of speaker
3366 @item volume (int)
3367 The value is passed to @code{XBell()} which sets the volume of the @code{X}
3368 speaker.
3369 The value lies in the range -100..100 and it defaults to the maximum volume of
3370 @emph{100}.
3372 @vindex warnColor
3373 @cindex colors
3374 @cindex color, warning
3375 @item warnColor (color)
3376 This resources defines the color to be used for drawing pins and pads when
3377 a warning has been issued about them.
3379 @vindex zoom
3380 @cindex zoom of Layout area
3381 @item zoom (int)
3382 The initial value for output scaling is set according to the following
3383 formula: scale = 1:(2 power value). It defaults to @emph{three} which results
3384 in an output scale of @emph{1:8}.
3386 @end table
3388 Refer also to @ref{Command-Line Options}.
3390 @node Actions
3391 @section Actions
3392 @cindex actions
3393 @cindex translations
3394 @cindex key translations
3395 @cindex button translations
3396 @cindex X11 translations
3398 All user accessible commands may be bound to almost any @code{X} event. Almost
3399 no default binding for commands is done in the binaries, so it is vital for the
3400 application that at least a system-wide application resource file exists.
3401 This file normally resides in the @file{share/pcb} directory and
3402 is called @file{Pcb}. The bindings to which the manual refers to are the
3403 ones as defined by the shipped resource file. Besides binding an action to
3404 an X11 event, you can also execute any action command using a ":" command
3405 (see @ref{User Commands}).
3407 Take special care about translations related to the functions keys and the
3408 pointer buttons because most of the window managers use them too.
3409 Change the file according to your hardware/software environment.
3410 You may have to replace all occurances of @emph{baseTranslations} to
3411 @emph{translations} if you use a @code{X11R4} server.
3413 Passing @emph{Object} as an argument to an action routine causes the object
3414 at the cursor location to be changed, removed or whatever. If more than
3415 one object is located at the cross hair position the smallest type is used.
3416 If there are two of the same type the newer one is taken.
3417 @emph{SelectedObjects} will handle all selected and visible objects.
3420 @table @samp
3421 @findex AddRats()
3422 @cindex rats nest
3423 @cindex netlist
3424 @cindex rat-line
3425 @item AddRats(AllRats|SelectedRats)
3426 Adds rat-lines to the layout using the loaded netlist file (see the @emph{:rn},
3427 @ref{User Commands}.). Rat lines are added on the active layer using the current
3428 line thickness shown in the status line.
3429 Only missing connectivity is added by the
3430 AddRats command so if, for example, the layout is complete nothing will be added.
3431 Rat lines are drawn on the screen with a stippled pattern
3432 to make them easier to identify since they cannot appear in a completed layout.
3433 The rat-lines are added in the minimum length straight-line tree pattern
3434 (always ending on pins or pads) that satisfies the missing connectivity in the circuit.
3435 If a SMD pad is unreachable on the active layer, a warning will be issued
3436 about it and the rat-line to that pad will not be generated.
3437 If connections exist on the board which are not listed in the netlist while
3438 AllRats are being added, warning messages will be issued and the affected pins and
3439 pads will be drawn in a special @emph{warnColor} until the next @emph{Notify()} event.
3440 If the entire layout agrees completely with the net-list a message informs you that
3441 the layout is complete and no rat-lines are added (since none are needed).
3442 If @emph{SelectedRats}
3443 is passed as the argument, only those missing connections that might connect among
3444 the selected pins and pads are drawn.
3445 Default:
3446 @example
3447 None<Key>w:     AddRats(AllRats)
3448 !Shift<Key>w:   AddRats(SelectedRats)
3449 None<Key>o:     DeleteRats(AllRats) AddRats(AllRats)
3450 !Shift<Key>o:   DeleteRats(SelectedRats) AddRats(SelectedRats)
3451 @end example
3453 @findex ApplyVendor()
3454 @cindex vendor map
3455 @cindex vendor drill table
3456 @item ApplyVendor()
3457 Applies an already loaded vendor drill map to the design.
3458 @example
3459 ApplyVendor()
3460 @end example
3462 @findex Atomic()
3463 @cindex undo, multi-action resources
3464 @cindex atomic
3465 @item Atomic(Save|Restore|Block|Close)
3466 Controls the undo grouping of sequences of actions. Before the first action
3467 in a group, Atomic(Save) should be issued.  After each action that might
3468 be undoable, Atomic(Restore) should be issued.  Atomic(Block) concludes
3469 and save the undo grouping if there was anything in the group to undo.
3470 Atomic(Close) concludes and save the undo grouping even if nothing was
3471 actually done.  Thus it might produce an "empty" undo.  This can be useful
3472 when you want to use undo in a group of actions.
3474 @findex Bell()
3475 @cindex signal
3476 @cindex bell
3477 @item Bell([-100..100])
3478 Rings the bell of your display. If no value is passed the setting
3479 of the resource @emph{volume} will be used.
3481 @findex ChangeClearSize()
3482 @cindex change sizes
3483 @cindex sizes, changing of objects
3484 @cindex clearance, changing of objects
3485 @item ChangeClearSize(Object, value[, unit])
3486 @itemx ChangeClearSize(SelectedPins|SelectedVias, value[, unit])
3487 The effect of this action depends on if the soldermask display is presently
3488 turned on or off. If soldermask is displayed, then the soldermask
3489 relief size will be changed.  If soldermask display is turned off,
3490 then the clearance to polygons will be changed.
3491 @emph{unit} is "mil" or "mm".  If not specified the units will default
3492 to the internal unit of 0.01 mil.
3493 @example
3494 !Mod1<Key>k:      ChangeClearSize(Object, +2, mil)
3495 !Mod1 Shift<Key>k: ChangeClearSize(Object, -2, mil)
3496 @end example
3498 @findex ChangeDrillSize()
3499 @cindex change sizes
3500 @cindex sizes, changing of objects
3501 @cindex drilling hole, changing of objects
3502 @item ChangeDrillSize(Object, value[, unit])
3503 @itemx ChangeDrillSize(SelectedPins|SelectedVias, value[, unit])
3504 This action routine changes the drilling hole of pins and vias.
3505 If @emph{value} starts with + or -, then it adds (or subtracts)
3506 @emph{value} from the current hole diameter, otherwise it sets the
3507 diameter to the value.
3508 @emph{unit} is "mil" or "mm".  If not specified the units will default
3509 to the internal unit of 0.01 mil.
3510 Default:
3511 @example
3512 !Mod1<Key>s:       Change2ndSize(Object, +5, mil)
3513 !Mod1 Shift<Key>s: Change2ndSize(Object, -5, mil)
3514 @end example
3516 @findex ChangeFlag()
3517 @cindex flags, changing
3518 @cindex octagonal flag, changing
3519 @cindex square flag, changing
3520 @cindex thermal flag, changing
3521 @itemx ChangeFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square,0|1)
3522 Sets/clears the indicated flag.  This adds/removes thermals, adds/removes the flag
3523 which indicates a pin/pad should be square, or adds/removes the flag which
3524 indicates a pin/pad should be octagonal.
3525 @example
3526 :ChangeFlag(SelectedVias,thermal,1)
3527 :ChangeFlag(SelectedPads,square,0)
3528 @end example
3530 @findex ChangeHole()
3531 @cindex vias, converting to mounting hole
3532 @cindex mounting holes
3533 @item ChangeHole(Object|SelectedVias)
3534 This action routine converts a via to and from a hole.  A hole is
3535 a via that has no copper annulus. The drill size for the via
3536 determines the hole diameter.
3537 @example
3538 !Ctrl<Key>h:    ChangeHole(Object)
3539 @end example
3541 @findex ChangeName()
3542 @cindex name, change an objects
3543 @cindex change object name
3544 @cindex object, change name of
3545 @item ChangeName(Object)
3546 @itemx ChangeName(Layer|Layout)
3547 Changes the name of the visible object at the cursor location. A text object
3548 doesn't have a name therefore the text string itself is changed.
3549 The element name currently used for display is always the one changed with this
3550 command.
3551 See @emph{Display(Description|NameOnPCB|Value)} for details.
3552 Passing @emph{Layer} changes the current layers name.
3553 Default:
3554 @example
3555 None<Key>n: ChangeName(Object)
3556 @end example
3558 @findex ChangeOctagon()
3559 @cindex pins, changing shape of
3560 @cindex vias, changing shape of
3561 @cindex octagonal pins and vias
3562 @itemx ChangeOctagon(Object|SelectElements|SelectedPins|SelectedVias|Selected)
3563 Toggles what shape the affected pin(s) or via(s) will be drawn when they
3564 are not square. The shape will either be round or octagonal.
3565 Default:
3566 @example
3567 !Ctrl<Key>o: ChangeOctagon(Object)
3568 @end example
3570 @findex ChangePinName()
3571 @cindex changing pin/pad names
3572 @cindex pin/pad names, changing
3573 @item ChangePinName(ElementName, PinNumber, PinName)
3574 Changes the name for a specified pin or pad number on a specified element.
3575 This action is typically used to forward annotate pin/pad names from a schematic
3576 to the layout.
3577 @example
3578 ChangePinName(U1, 14, VDD)
3579 @end example
3582 @findex ChangeSize()
3583 @cindex change sizes
3584 @cindex sizes, changing of objects
3585 @cindex thickness, changing of objects
3586 @item ChangeSize(Object, value[, unit])
3587 @itemx ChangeSize(SelectedLines|SelectedPins|SelectedVias, value[, unit])
3588 @itemx ChangeSize(SelectedPads|SelectedTexts|SelectedNames, value[, unit])
3589 @itemx ChangeSize(SelectedElements, value[, unit])
3590 To change the size of an object you have to bind these action to some
3591 @code{X} event (or use :ChangeSize(...)).  If @emph{value} begins with
3592 a + or - then the value will be added (or subtracted) from the current
3593 size, otherwise the size is set equal to @emph{value}. Range checking is
3594 done to insure that none of the maximum/minimums of any size are violated.
3595 If @emph{Object} is passed then a single object at the cursor location is
3596 changed. If any of the @emph{Selected} arguments are passed then all selected
3597 and visible objects of that type are changed. If the type being modified is
3598 an element, then the thickness of the silkscreen lines defining the element
3599 is changed.
3600 @emph{unit} is "mil" or "mm".  If not specified the units will default
3601 to the internal unit of 0.01 mil.
3602 Default:
3603 @example
3604 None<Key>s:   ChangeSize(Object, +5)
3605 !Shift<Key>s: ChangeSize(Object, -5)
3606 @end example
3608 @findex ChangeSquare()
3609 @cindex change square flag
3610 @cindex square flag, changing of objects
3611 @cindex thickness, changing of objects
3612 @item ChangeSquare(Object|SelectedElements|SelectedPins)
3613 Toggles the setting of the square flag. The flag is used to identify a
3614 certain pin, normally the first one, of circuits. It is also used to
3615 make SMD pads have square ends.
3616 @example
3617 None<Key>q:   ChangeSquare(Object)
3618 @end example
3620 @findex ClrFlag()
3621 @cindex flags, clearing
3622 @cindex flags, clearing
3623 @cindex octagonal flag, clearing
3624 @cindex square flag, clearing
3625 @cindex thermal flag, clearing
3626 @itemx ClrFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square)
3627 Clears the indicated flag.  This removes thermals, removes the flag
3628 which indicates a pin/pad should be square, or removes the flag which
3629 indicates a pin/pad should be octagonal.
3630 @example
3631 :ClrFlag(SelectedVias,thermal)
3632 @end example
3634 @findex Command()
3635 @cindex start user input
3636 @cindex inputfield, start user input
3637 @item Command()
3638 Calling @emph{Command()} pops up an input line at the bottom of the window
3639 which allows you to enter commands. Including all action commands!
3640 The dialog ends when @emph{None<Key>Return}
3641 to confirm or @emph{None<Key>Escape} to abort is entered.
3642 Default:
3643 @example
3644 <Key>colon: Command()
3645 @end example
3647 @findex Connection()
3648 @cindex scanning connections
3649 @cindex searching connections
3650 @cindex connections, reseting
3651 @cindex reseting found connections
3652 @cindex connections, searching for
3653 @cindex saving found connections
3654 @item Connection(Find)
3655 @itemx Connection(ResetFoundLinesAndRectangles|ResetPinsViasAndPads|Reset)
3656 The @emph{Connection()} action is used to mark all connections from one pin,
3657 line or via to others.
3658 The @emph{ResetFoundLinesAndRectangles, ResetFoundPinsAndVias} and
3659 @emph{Reset} arguments may be used to reset all marked lines and rectangles,
3660 vias and pins or all of them. The search starts with the pin or via
3661 at the cursor position. All found objects are drawn with the color
3662 defined by the resource @emph{connectedColor}.
3663 See also, @emph{Display(Description|NameOnPCB|Value)}.
3664 Default:
3665 @example
3666 !Shift<Key>c: Connection(Reset)
3667 None<Key>f:   Connection(Find)
3668 !Shift<Key>f: Connection(Reset)
3669 @end example
3671 @findex DeleteRats()
3672 @cindex rats nest
3673 @cindex rat-line
3674 @cindex netlist
3675 @item DeleteRats(AllRats|SelectedRats)
3676 This routine deletes either all rat-lines in the layout, or only
3677 the selected and visible ones. Non-rat-lines and other layout
3678 objects are unaffected.
3679 Default:
3680 @example
3681 None<Key>e:   DeleteRats(AllRats)
3682 !Shift<Key>e: DeleteRats(SelectedRats)
3683 @end example
3685 @findex DisableVendor()
3686 @cindex vendor map, disabling
3687 @cindex vendor drill table, disabling
3688 @item DisableVendor()
3689 Disables automatic drill size mapping to the loaded vendor drill table.
3690 @example
3691 DisableVendor()
3692 @end example
3694 @findex DisperseElements()
3695 @cindex dispersing elements
3696 @cindex distributing elements
3697 @cindex elements, dispersing
3698 @cindex elements, distributing
3699 @item DisperseElements(All|Selected)
3700 Disperses either all elements or only the selected elements in the
3701 layout.  This action should be used at the
3702 start of a design to spread out all footprints before any placement or
3703 routing is done.  
3704 @example
3705 DisperseElements(All)
3706 @end example
3709 @findex Display()
3710 @cindex centering
3711 @cindex redrawing layout
3712 @cindex refreshing layout
3713 @cindex name of an element
3714 @cindex displaying element names
3715 @cindex element, display names of
3716 @cindex grid, absolute and relative
3717 @cindex grid, display
3718 @cindex rubberband
3719 @cindex pinout, display of
3720 @cindex displaying pinout
3721 @cindex lines, clipping to 45 degree
3722 @cindex clipping lines to 45 degree
3723 @item Display(Description|NameOnPCB|Value)
3724 @itemx Display(Toggle45Degree|CycleClip)
3725 @itemx Display(Grid|ToggleGrid)
3726 @itemx Display(ToggleRubberBandMode)
3727 @itemx Display(Center|ClearAndRedraw|Redraw)
3728 @itemx Display(Pinout|PinOrPadName)
3729 This action routines handles some output related settings. It is
3730 used to center the display around the cursor location and to redraw the
3731 output area optionally after clearing the window.
3732 Centering is done with respect to the @emph{grid} setting. Displaying the
3733 grid itself may be switched on and off by @emph{Grid} but only if
3734 the distance between two pixels exceeds 4 pixels.
3735 @code{Pcb} is able to handle several labels of an element. One of them
3736 is a description of the functionality (eg resistor), the second should be
3737 a unique identifier (R1) whereas the last one is a value (100k).
3738 The @emph{Display()} action selects which of the names is displayed.
3739 It also controls which name will be affected by the @emph{ChangeName} command.
3740 If @emph{ToggleGrid} is passed, @code{Pcb} changes between relative
3741 ('rel' in the statusline) and absolute grid (an 'abs' in the statusline).
3742 Relative grid means the pointer position when the command is issued is
3743 used as the grid origin; while (0,0) is used in the absolute grid case.
3744 Passing @emph{Pinout} displays the pinout of the element at the current
3745 cursor location whereas @emph{PinOrPadName} toggles displaying of the
3746 pins or pads name under the cursor. If none of them matches but the cursor
3747 is inside of an element, the flags is toggled for all of its pins and pads.
3748 For details about rubberbands see also the details about @emph{Mode}.
3749 Default:
3750 @example
3751 None<Key>c:  Display(Center)
3752 None<Key>d:  Display(PinOrPadName)
3753 !Shift<Key>d: Display(Pinout)
3754 None<Key>r:  Display(ClearAndRedraw)
3755 None<Key>.:  Display(Toggle45Degree)
3756 None<Key>/:  Display(CycleClip)
3757 @end example
3759 @findex DRC()
3760 @cindex design rule checking
3761 @cindex drc
3762 @item DRC()
3763 Initiates design rule checking of the entire layout. Must be repeated
3764 until no errors are found.
3766 @findex ExecuteFile()
3767 @cindex actions file, executing
3768 @cindex script file, executing
3769 @itemx ExecuteFile(filename)
3770 Executes the PCB actions contained in the specified file.
3771 This can be used to automate a complex sequence of operations.
3772 @example
3773 :ExecuteFile(custom.cmd)
3774 @end example
3775 The command file contains a list of PCB actions.  Blank lines
3776 are ignored and lines starting with a # are treated as comment
3777 lines.  For example
3778 @example
3779 # This is a comment line
3780 Display(Grid)
3781 SetValue(Zoom,2)
3782 DRC()
3783 @end example
3785 @findex EditLayerGroups()
3786 @cindex layers, editing of groups
3787 @cindex groups, editing of
3788 @item EditLayerGroups()
3789 Pops up a dialog box to edit the layergroup setting. The function is also
3790 available from the @emph{Objects} menu.
3791 There are no defaults.
3793 @findex EnableVendor()
3794 @cindex vendor map, enabling
3795 @cindex vendor drill table, enabling
3796 @item EnableVendor()
3797 Enables automatic drill size mapping to the loaded vendor drill table.
3798 @example
3799 EnableVendor()
3800 @end example
3803 @findex Load()
3804 @cindex loading files
3805 @item Load(ElementToBuffer|Layout|LayoutToBuffer|Nelist)
3806 This routine pops up a fileselect box to load layout, element data,
3807 or netlist.
3808 The passed filename for layout data is saved and may be reused.
3809 @emph{ElementToBuffer} and @emph{LayoutToBuffer} load the data into the
3810 current buffer.
3811 There are no defaults.
3813 @findex LoadVendor()
3814 @cindex vendor map, loading
3815 @cindex vendor drill table, loading
3816 @item LoadVendor(vendorfile)
3817 Loads the specified vendor resource file.
3818 @example
3819 LoadVendor(myvendor.res)
3820 @end example
3822 @findex MarkCrosshair()
3823 @cindex mark
3824 @cindex cursor position
3825 @item MarkCrosshair()
3826 This routine marks the current cursor location with an X, and then
3827 the cursor display shows both absolute position and position relative to
3828 the mark.  If a mark is already present, this routine removes it and
3829 stops displaying relative cursor coordinates.
3830 Defaults:
3831 @example
3832 !Ctrl<key>m:    MarkCrosshair()
3833 @end example
3835 @findex Mode()
3836 @cindex mode, selecting of
3837 @cindex operation modes, selecting of
3838 @item Mode(Copy|InsertPoint|Line|Move|None|PasteBuffer|Polygon|Thermal)
3839 @itemx Mode(Remove|Rectangle|RubberbandMove|Text|Via)
3840 @itemx Mode(Cycle)
3841 @itemx Mode(Notify)
3842 @itemx Mode(Save|Restore)
3843 Switches to a new mode of operation. The active mode is displayed by a thick
3844 line around the matching mode selector button.
3845 Most of the functionality of @code{Pcb} is implemented by selecting a mode
3846 and calling @emph{Mode(Notify)}. The arguments @emph{Line}, @emph{Polygon},
3847 @emph{Rectangle}, @emph{Text} and @emph{Via} are used to create the
3848 appropriate object whenever @emph{Mode(Notify)} is called. Some of them,
3849 such as @emph{Polygon}, need more than one call for one object to be created.
3850 @emph{InsertPoint} adds points to existing polygons or lines.
3851 @emph{Save} and @emph{Restore} are used to temporarily save the mode, switch
3852 to another one, call @emph{Mode(Notify)} and restore the saved one. Have
3853 a look at the application resource file for examples.
3854 @emph{Copy} and @emph{Move} modes are used to change an object's location and,
3855 optionally, to create a new one. The first call of @emph{Mode(Notify)} attaches
3856 the object at the pointer location to the cross hair whereas the second
3857 one drops it to the layout. The @emph{rubberband} version of move performs the
3858 move while overriding the current rubberband mode.
3859 Passing @emph{PasteBuffer} attaches the contents of the currently selected
3860 buffer to the cross hair. Each call to @emph{Mode(Notify)} pastes this contents
3861 to the layout. @emph{Mode(Cycle)} cycles through the modes available in the
3862 mode-button pallet.
3863 @emph{Mode(None)} switches all modes off.
3864 Default:
3865 @example
3866 <Key>Escape:             Mode(None)
3867 <Key>space:              Mode(Cycle)
3868 None<Key>BackSpace:      Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore)
3869 None<Key>Delete:         Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore)
3870 None<Key>F1:             Mode(Via)
3871 None<Key>F2:             Mode(Line)
3872 None<Key>F3:             Mode(PasteBuffer)
3873 None<Key>F4:             Mode(Rectangle)
3874 None<Key>F5:             Mode(Text)
3875 None<Key>F6:             Mode(Polygon)
3876 None<Key>F7:             Mode(Thermal)
3877 None<Key>F8:             Mode(Arc)
3878 None<Key>Insert:         Mode(InsertPoint)
3879 None<Key>[:              Mode(Save) Mode(Move) Mode(Notify)
3880 None<Key>]:              Mode(Notify) Mode(Restore)
3881 None<Btn1>:          Mode(Notify)
3882 !Shift Ctrl<Btn1>:   Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore)
3883 None<Btn2Down>:          Mode(Save) Mode(Move) Mode(Notify)
3884 None<Btn2Up>:            Mode(Notify) Mode(Restore)
3885 !Mod1<Btn2Down>:       Mode(Save) Mode(Copy) Mode(Notify)
3886 !Mod1<Btn2Up>:         Mode(Notify) Mode(Restore)
3887 Shift BTNMOD<Btn2Down>: Mode(Save) Mode(RubberbandMove) Mode(Notify)
3888 @end example
3890 @findex MovePointer()
3891 @cindex pointer, moving of
3892 @cindex cursor movements
3893 @item MovePointer(delta_x, delta_y)
3894 With this function it is possible to move the cross hair cursor by using the
3895 cursor keys. The @code{X} server's pointer follows because the necessary
3896 events are generated by @code{Pcb}. All movements are performed with respect
3897 to the currently set grid value.
3898 Default:
3899 @example
3900 None<Key>Up:      MovePointer(0, -1)
3901 !Shift<Key>Up:    MovePointer(0, -10)
3902 None<Key>Down:    MovePointer(0, 1)
3903 !Shift<Key>Down:  MovePointer(0, 10)
3904 None<Key>Right:   MovePointer(1, 0)
3905 !Shift<Key>Right: MovePointer(10, 0)
3906 None<Key>Left:    MovePointer(-1, 0)
3907 !Shift<Key>Left:  MovePointer(-10, 0)
3908 @end example
3910 @findex MoveToCurrentLayer()
3911 @cindex objects, moving to current layer
3912 @cindex moving objects to current layer
3913 @item MoveToCurrentLayer(Object|SelectedObjects)
3914 The function moves a single object at the cross hair location or all selected
3915 objects to the current layer. Elements are not movable by this function.
3916 They have to be deleted and replaced on the other side.
3917 If a line segment is moved and the movement would result in a loss of
3918 connectivity to another segment then via(s) are automatically added to
3919 maintain the connectivity.
3920 @example
3921 None<Key>m:       MoveToCurrentLayer(Object)
3922 !Shift<Key>m:     MoveToCurrentLayer(SelectedObjects)
3923 @end example
3925 @findex New()
3926 @cindex layout, start a new
3927 @cindex starting a new layout
3928 @item New()
3929 Clear the current layout and starts a new one after entering its name.
3930 Refer to the resource @emph{backup} for more information.
3931 No defaults.
3933 @findex PasteBuffer()
3934 @cindex buffer, selecting a
3935 @cindex pastebuffer, selecting a
3936 @cindex selecting a buffer
3937 @cindex rotating a buffer
3938 @cindex cutting objects
3939 @cindex copying objects
3940 @item PasteBuffer(AddSelected|Clear|1..5)
3941 @itemx PasteBuffer(Rotate, 1..3)
3942 @itemx PasteBuffer(Convert)
3943 This action routine controls and selects the pastebuffer as well as all
3944 cut-and-paste operations. Passing a buffer number selects one in of the
3945 range 1..5. The statusline is updated with the new number.
3946 @emph{Rotate} performs a number of 90 degree counter clockwise rotations
3947 of the buffer contents. @emph{AddSelected} as first argument copies all
3948 selected and visible objects into the buffer. Passing @emph{Clear} removes
3949 all objects from the currently selected buffer. @emph{Convert} causes
3950 the contents of the buffer (lines, arc, vias) to be converted into an
3951 element definition. Refer to @ref{Pastebuffer}
3952 for examples.
3953 Default:
3954 @example
3955 !Ctrl<Key>x:       PasteBuffer(Clear) PasteBuffer(AddSelected)
3956                    Mode(PasteBuffer)
3957 !Shift Ctrl<Key>x: PasteBuffer(Clear) PasteBuffer(AddSelected)
3958                    RemoveSelected() Mode(PasteBuffer)
3959 !Mod1<Key>c:       PasteBuffer(Clear) PasteBuffer(AddSelected)
3960 !Mod1<key>x:       PasteBuffer(Clear) PasteBuffer(AddSelected)
3961                    RemoveSelected()
3962 !Shift<Key>1:      PasteBuffer(1)
3963 !Shift<Key>2:      PasteBuffer(2)
3964 !Shift<Key>3:      PasteBuffer(3)
3965 !Shift<Key>4:      PasteBuffer(4)
3966 !Shift<Key>5:      PasteBuffer(5)
3967 None<Key>F3:       Mode(PasteBuffer)
3968 @end example
3970 @findex Polygon()
3971 @cindex polygon, closing a
3972 @cindex polygon point, go back to previous
3973 @cindex closing a polygon
3974 @item Polygon((Close|PreviousPoint)
3975 Polygons need a special action routine to make life easier. Calling
3976 @emph{Polygon(PreviousPoint)} resets the newly entered corner to the
3977 previous one. The Undo action will call Polygon(PreviousPoint)
3978 when appropriate to do so.  @emph{Close} creates the final
3979 segment of the polygon.  This may fail if clipping to 45 degree
3980 lines is switched on, in which case a warning is issued.
3981 Default:
3982 @example
3983 None<Key>p:             Polygon(Close)
3984 !Shift<Key>p:           Polygon(Close)
3985 @end example
3987 @findex Print()
3988 @cindex layout, printing a
3989 @cindex printing a layout
3990 @item Print()
3991 Pops up a print control box that lets you select the output
3992 device, scaling and many more options. Each run creates all
3993 files that are supported by the selected device. These are
3994 mask files as well as drilling files, silk screens and so on. The table
3995 shows the filenames for all possible files:
3996 @example
3997         POSIX (extension)             8.3 filename
3998                 ---------------------------------------------
3999                 *_componentmask.*             cmsk.*
4000                 *_componentsilk.*             cslk.*
4001                 *_soldermask.*                smsk.*
4002                 *_soldersilk.*                sslk.*
4003                 *_drill.*                     dril.*
4004                 *_groundplane.*               gpl.*
4005                 *_group[1..8].*     [..8].*
4006 @end example
4007 The output may be sent to a post-processor by starting the filename with the
4008 @emph{pipe} @code{("|")} character. Any @code{"%f"} in a command is replaced
4009 with the current filename. The function is available from the @emph{file} menu.
4010 There are no defaults.
4012 @findex Quit()
4013 @cindex quit
4014 @cindex exit
4015 @item Quit()
4016 Quits the application after confirming the operation.
4017 Default:
4018 @example
4019 <Message>WM_PROTOCOLS: Quit()
4020 @end example
4022 @findex Redo()
4023 @cindex redo
4024 @cindex recover
4025 @item Redo()
4026 This routine allows you to recover from the last undo command.
4027 You might want to do this if you thought that undo was going to
4028 revert something other than what it actually did (in case you
4029 are confused about which operations are un-doable), or if you
4030 have been backing up through a long undo list and over-shoot
4031 your stopping point.  Any change that is made since the undo
4032 in question will trim the redo list.  For example if you add
4033 ten lines, then undo three of them you could use redo to put
4034 them back, but if you move a line on the board before performing
4035 the redo, you will lose the ability to "redo" the three "undone" lines.
4036 Default:
4037 @example
4038 !Shift<Key>r:   Redo()
4039 @end example
4041 @findex RemoveSelected()
4042 @cindex removing selected objects
4043 @cindex selected object, removing an
4044 @item RemoveSelected()
4045 This routine removes all visible and selected objects.
4046 There are no defaults.
4048 @findex Report()
4049 @cindex report
4050 @cindex information about objects
4051 @cindex drill
4052 @item Report(Object|DrillReport)
4053 This routine pops up a dialog box describing the various
4054 characteristics of an object (or piece of an object such as a pad or pin)
4055 in the layout at the cursor position, or a report about all of the
4056 drill holes in the layout.
4057 There are no defaults.
4059 @findex RouteStyle()
4060 @cindex routing style
4061 @cindex size of lines and vias
4062 @item RouteStyle(1|2|3|4)
4063 This routine copies the sizes corresponding to the numbered route style
4064 into the active line thickens, via diameter, and via drill size.
4065 Defaults:
4066 @example
4067 !Ctrl<Key>1: RouteStyle(1)
4069 !Ctrl<Key>NUM_STYLES: RouteStyle(NUM_STYLES)
4070 @end example
4071 The variable @code{NUM_STYLES} is set at compile time in
4072 @file{globalconfig.h}.
4074 @findex Save()
4075 @cindex saving files
4076 @cindex saving connections
4077 @item Save(Layout|LayoutAs)
4078 @itemx Save(AllConnections|AllUnusedPins|ElementConnections)
4079 Passing @emph{Layout} saves the layout using the file from which it was
4080 loaded or, if it is a new layout, calls @emph{Save(LayoutAs)} which queries
4081 the user for a filename.
4082 The values: @emph{AllConnections}, @emph{AllUnusedPins} and
4083 @emph{ElementConnections} start a connection scan and save all connections,
4084 all unused pins or the connections of a single element to a file.
4085 There are no defaults.
4087 @findex Select()
4088 @cindex selection
4089 @cindex selecting objects
4090 @item Select(All|Block|Connection|ToggleObject)
4091 @itemx Select(ElementByName|ObjectByName|PadByName|PinByName)
4092 @itemx Select(TextByName|ViaByName)
4093 Toggles either the selection flag of the object at the cross hair position
4094 (@emph{ToggleObject}) or selects all visible objects, all inside a
4095 rectangle or all objects which have been found during the last connection
4096 scan. The @emph{ByName} functions use a @ref{Regular Expressions} search,
4097 always case insensitive, to select the objects.
4098 Default:
4099 @example
4100 None<Btn3Down>:  Select(ToggleObject)
4101 None<Btn3Down>,None<Btn3Motion>: See resource file - this is complex
4102 @end example
4104 @findex SetFlag()
4105 @cindex flags, setting
4106 @cindex octagonal flag, setting
4107 @cindex square flag, setting
4108 @cindex thermal flag, setting
4109 @itemx SetFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square)
4110 Sets the indicated flag.  This adds thermals, sets the flag
4111 which indicates a pin/pad should be square, or sets the flag which
4112 indicates a pin/pad should be octagonal.
4113 @example
4114 :SetFlag(Selected,thermal)
4115 @end example
4117 @findex SetValue()
4118 @cindex change settings
4119 @cindex zoom, setting of
4120 @cindex grid, setting of
4121 @cindex drilling hole, setting of initial size
4122 @cindex vias, setting of initial size
4123 @cindex lines, setting of initial size
4124 @item SetValue(Grid|LineSize|TextScale|ViaDrillingHole|ViaSize|Zoom, value)
4125 Some internal values may be changed online by this function.
4126 The first parameter specifies which data has to be changed. The other one
4127 determines if the resource is set to the passed value, if @emph{value} is
4128 specified without sign, or increments/decrements if it is specified with
4129 a plus or minus sign.
4130 The function doesn't change any existing object only the initial values of
4131 new objects.  Use the @emph{ChangeSize()} and @emph{ChangeDrillSize()}
4132 to change existing objects.
4133 Default:
4134 @example
4135 None<Key>g:        SetValue(Grid, +5)
4136 !Shift<Key>g:      SetValue(Grid, -5)
4137 None<Key>l:        SetValue(LineSize, +5)
4138 !Shift<Key>l:      SetValue(LineSize, -5)
4139 None<Key>t:        SetValue(TextScale, +10)
4140 !Shift<Key>t:      SetValue(TextScale, -10)
4141 None<Key>v:        SetValue(ViaSize, +5)
4142 !Shift<Key>v:      SetValue(ViaSize, -5)
4143 !Mod1<Key>v:       SetValue(ViaDrillingHole, +5)
4144 !Mod1 Shift<Key>v: SetValue(ViaDrillingHole, -5)
4145 None<Key>z:        SetValue(Zoom, -1)
4146 !Shift<Key>z:      SetValue(Zoom, +1)
4147 @end example
4149 @findex SwapSides()
4150 @cindex change viewing side
4151 @cindex viewing side, changing of
4152 @item SwapSides()
4153 This routine changes the board side you are viewing.
4154 Default:
4155 @example
4156 None<Key>Tab:      SwapSides()
4157 @end example
4159 @findex SwitchDrawingLayer()
4160 @cindex change drawing layer
4161 @cindex layer, change active
4162 @item SwitchDrawingLayer(value)
4163 Makes layer number 1..MAX_LAYER the current one.
4164 Default:
4165 @example
4166 None<Key>1:        SwitchDrawingLayer(1)
4168 None<Key>MAX_LAYER:        SwitchDrawingLayer(MAX_LAYER)
4169 @end example
4171 @findex ToggleHideName()
4172 @cindex hide element name
4173 @cindex element name, hiding
4174 @cindex element name, removing from silk-screen
4175 @item ToggleHideName(Object|SelectedElements)
4176 Toggles whether the element's name is displayed or hidden. If it
4177 is hidden you won't see it on the screen and it will not appear
4178 on the silk layer when you print the layout.
4179 @example
4180 None<Key>h:     ToggleHideName(Object)
4181 !Shift<Key>h:   ToggleHideName(SelectedElements)
4182 @end example
4184 @findex ToggleVendor()
4185 @cindex vendor map, toggling
4186 @cindex vendor drill table, toggling
4187 @item ToggleVendor()
4188 Toggles automatic drill size mapping to the loaded vendor drill table.
4189 @example
4190 ToggleVendor()
4191 @end example
4193 @findex ToggleVisibility()
4194 @cindex toggle layer visibility
4195 @cindex layer visibility, toggling
4196 @item ToggleVisibility(Layer)
4197 Toggles the visibility of the layer.
4198 @example
4199 Mod1<Key>1:     ToggleVisibility(1)
4200 Mod1<Key>2:     ToggleVisibility(2)
4201 Mod1<Key>3:     ToggleVisibility(3)
4202 Mod1<Key>4:     ToggleVisibility(4)
4203 @end example
4205 @findex Undo()
4206 @cindex undo
4207 @cindex recover
4208 @item Undo()
4209 @itemx Undo(ClearList)
4210 The unlimited undo feature of @code{Pcb} allows you to recover
4211 from most operations that materially affect you work.
4212 Calling @emph{Undo()} without any parameter recovers
4213 from the last (non-undo) operation. @emph{ClearList} is used to release the
4214 allocated memory. @emph{ClearList} is called whenever a new layout is started
4215 or loaded. See also @emph{Redo}.
4216 Default:
4217 @example
4218 None<Key>u:        Undo()
4219 !Shift Ctrl<Key>u: Undo(ClearList)
4220 @end example
4222 @findex UnloadVendor()
4223 @cindex vendor map, unloading
4224 @cindex vendor drill table, unloading
4225 @item UnloadVendor()
4226 Unloads the loaded vendor drill table.
4227 @example
4228 UnloadVendor()
4229 @end example
4231 @findex Unselect()
4232 @cindex selection
4233 @cindex unselect objects
4234 @item Unselect(All|Block|Connection)
4235 Unselects all visible objects, all inside a rectangle or all objects which
4236 have been found during the last connection scan.
4237 Default:
4238 @example
4239 !Shift <Btn3Down>: Mode(Save) Mode(None) Unselect(Block)
4240 !Shift <Btn3Up>:   Unselect(Block) Mode(Restore)
4241 @end example
4243 @end table
4246 @node Translations
4247 @section Default Translations
4248 @cindex translations
4249 @cindex default translations
4250 @cindex X11 default translations
4252 This section covers some default translations of key and button events as
4253 defined in the shipped default application resource file. Most of them have
4254 already been listed in @ref{Actions}. @code{Pcb} makes use of a nice @code{X11}
4255 feature; calling several action routines for one event.
4257 @table @samp
4259 @cindex removing objects
4260 @cindex removing connections
4261 @cindex object, removing an
4262 @cindex connection, removing an
4263 @item  None<Key>BackSpace:
4264 @item  None<key>Delete:
4265 @itemx !Shift<Key>BackSpace:
4266 @itemx !Shift Ctrl<Btn1>:
4267 The object at the cursor location is removed by @emph{None<Key>BackSpace} or
4268 @emph{Shift Ctrl<Btn1>} whereas @emph{Shift<Key>BackSpace} also removes
4269 all other objects that are fully-connected to the one at the cursor location.
4271 @cindex scrolling
4272 @item  !Mod1 Ctrl<Key>Left:
4273 @itemx !Mod1 Ctrl<Key>Right:
4274 @itemx !Mod1 Ctrl<Key>Up:
4275 @itemx !Mod1 Ctrl<Key>Down:
4276 Scroll one page in one of the four directions.
4278 @cindex scrolling
4279 @item  None<Key>Left:, !Shift<Key>Left:
4280 @itemx None<Key>Right:, !Shift<Key>Right:
4281 @itemx None<Key>Up:, !Shift<Key>Up:
4282 @itemx None<Key>Down:, !Shift<Key>Down:
4283 Move cross hair either one or ten points in grid.
4285 @cindex user input
4286 @item None<Key>Return:
4287 Finished user input, selects the 'default' button of dialogs.
4289 @cindex user input
4290 @item None<Key>Escape:
4291 @emph{Mode(Reset)}, aborts user input, selects the 'abort' button of
4292 dialogs or resets all modes.
4294 @cindex element, move name of
4295 @cindex object, move an
4296 @cindex object, copy an
4297 @cindex move an object
4298 @cindex copy an object
4299 @item None<Btn2Down>, Btn2<Motion>, None<Btn2Up>:
4300 @itemx !Mod1<Btn2Down>, Btn2<Motion>, !Mod1<Btn2Up>:
4301 The first sequence moves the object or element name at the cursor location.
4302 The second one copies the objects. Copying isn't available for
4303 element names.
4305 @end table
4308 @c --------------------------- chapter 6 -------------------------------
4309 @node File Formats
4310 @chapter File Formats
4311 @cindex file formats
4312 @cindex ASCII files, format of
4314 All files used by @code{Pcb} are read from the standard output of a command
4315 or written to the standard input of one as plain seven bit @code{ASCII}. This
4316 makes it possible to use any editor to change the contents of a layout file.
4317 It is the only way for element or font description files to be created.
4318 To do so you'll need to study the example files @file{example/*} and
4319 @file{default_font} which are shipped with @code{Pcb}.
4320 For an overview refer to @ref{Intro}.
4322 @vindex elementCommand
4323 @vindex fileCommand
4324 @vindex fontCommand
4325 @vindex libraryCommand
4326 @vindex libraryContentsCommand
4327 @vindex saveCommand
4328 The following sections provide the necessary information about the syntax of
4329 the files.
4330 Netlist files are not created by @code{Pcb}, but it does use them. For information
4331 on the format of a netlist file see the @emph{:rn},
4332 @ref{User Commands}. Rat lines are added on the current layer using the current
4333 The commands described allow you to add almost any additional
4334 functionality you may need. Examples are compressed read and write access as
4335 well as archives. The commands themselves are defined by the resources
4336 @emph{elementCommand}, @emph{fileCommand}, @emph{fontCommand},
4337 @emph{libraryCommand}, @emph{libraryContentsCommand} and @emph{saveCommand}.
4338 Note that the commands are not saved along with the data.
4339 It is considered an advantage to have the layout file contain all necessary
4340 information, independent of any other files.
4342 One thing common to all files is they may include comments, newlines,
4343 and carriage returns at any place except within quoted strings.
4345 @menu
4346 * Pad and Line Representation::
4347 * Layout File::
4348 * Element File::
4349 * Font File::
4350 * Netlist File::
4351 * Library Contents File::
4352 * Library File::
4353 * File Syntax::
4354 * Object Flags::
4355 * PCBFlags::
4356 @end menu
4360 @node Pad and Line Representation
4361 @section Pad and Line Representation
4362 @cindex pad specification
4363 @cindex file formats, pads and lines
4365 Pads and lines (copper traces, silk screen lines, etc) are represented by the
4366 line end points and the aperture used to draw the line.  It is important to 
4367 understand this when creating the pads for a new footprint.  The following figure
4368 illustrates a pad or line which is drawn using a square aperture.  The end
4369 points (X0,Y0), (X1,Y1) specify the center of the aperture.  The size parameter
4370 specifies the size of the aperture.
4372 @center @image{pad,,,Pad Layout,png}
4374 Pads and lines are represented in this way because this is how lines are 
4375 specified in RS-274X (Gerber) files which are used for creating
4376 the masks used in board manufacturing.  In fact, older mask making
4377 equipment created lines in precisely this fashion.  A physical aperture was
4378 used to pass light through onto a photosensitive film.
4380 @node Layout File
4381 @section Layout File Format
4382 @cindex layout files, format of
4383 @cindex format of layout files
4384 @cindex file format, layout data
4386 The layout file describes a complete layout including symbols, vias,
4387 elements and layers with lines, rectangles and text. This is the most
4388 complex file of all.  As @code{Pcb} has evolved, the file format has
4389 changed several times to accommodate new features.  @code{Pcb} has
4390 always been able to read all older versions of the @code{.pcb} file.
4391 This allows the migration of older designs to newer versions of the
4392 program.  Obviously older versions of @code{Pcb} will not be able
4393 to properly read layout files stored in newer versions of the file
4394 format.
4396 In practice it is very common for footprint libraries to contain
4397 elements which have been defined in various versions of the @code{Pcb}
4398 file format.  When faced with trying to understand an element file or
4399 layout file which includes syntax not defined here, the best approach
4400 is to examine the file @file{src/parse_y.y} which is the definitive
4401 definition of the file format.
4403 The PCB layout file contains the following contents, in this order (individual items
4404 are defined in @ref{File Syntax}:
4406 @table @code
4408 @item PCB
4409 This names the board and sets its size
4411 @item Grid
4412 Optional.
4414 @item Cursor
4415 Optional.
4417 @item Flags
4418 Optional.
4420 @item Groups
4421 Optional.
4423 @item Styles
4424 Optional.
4426 @item Symbols
4427 Optional.
4429 @item Vias, Rats, Layers, and Elements
4430 These may occur in any order, at this point in the file.
4432 @item Netlists
4433 Optional.
4435 @end table
4437 @node Element File
4438 @section Element File Format
4439 @cindex element, file format
4440 @cindex format of element files
4441 @cindex file format, element data
4443 Element files are used to describe one component which then may be used
4444 several times within one or more layouts. You will normally split the
4445 file into two parts, one for the pinout and one for the package description.
4446 Using @code{m4} allows you to define pin names as macros in one file and
4447 include a package description file which evaluates the macros. See
4448 the resource @emph{elementCommand} for more information. The pins (and pads)
4449 must appear in sequential order in the element file (new in 1.5) so that
4450 pin 1 must be the first PIN(...) in the file.
4452 Doing things this way makes it possible to use one package file for several
4453 different circuits. See the sample files @file{dil*}.
4455 The lowest x and y coordinates of all sub-objects of an element are
4456 used as an attachment point for the cross hair cursor of the main
4457 window, unless the element has a mark, in which case that's the
4458 attachment point.
4462 @node Font File
4463 @section Font File Format
4464 @cindex font file, format of
4465 @cindex format of font files
4466 @cindex file format, font data
4468 A number of user defined Symbols are called a font. There is only one per
4469 layout. All symbols are made of lines. See the file @file{default_font}
4470 as an example.
4472 The lowest x and y coordinates of all lines of a font are transformed to (0,0).
4474 @node Netlist File
4475 @section Netlist File Format
4476 @cindex netlist, file format
4477 @cindex netlist, reading
4479 Netlists read by @code{Pcb} must have this simple text form:
4481 @example
4482 netname [style] NAME-PINNUM NAME2-PINNUM2 NAME3-PINNUM3 ... [\]
4483 @end example
4485 @exdent for each net on the layout.
4486 where "netname" is the name of the net which must be unique for each
4487 net, [style] is an optional route-style name,
4488 NAME is the layout-name name given to an element,
4489 and PINNUM is the (usually numeric)
4490 pin number of the element that connects to the net
4491 (for details on pin numbering see @ref{Element Objects}).
4492 Spaces or tabs separate the fields.
4493 If the line ends with a "\" the
4494 net continues on the next line and the "\" is treated exactly as if it
4495 were a space.  If a NAME ends with a lower-case letter,
4496 all lower-case letters are stripped from the end of the NAME to determine the
4497 matching layout-name name.  For example:
4499 @example
4500      Data U1-3 U2abc-4 FLOP1a-7 Uabc3-A9
4501 @end example
4503 specifies that the net called "Data" should have
4504 pin 3 of U1 connected to pin 4 of U2, to pin 7 of
4505 FLOP1 and to pin A9 of Uabc3.  Note that element name and
4506 pin number strings are case-sensitive.
4507 It is up to you to name the elements so that their layout-name names
4508 agrees with the netlist.
4510 @node Library Contents File
4511 @section Library Contents File Format
4512 @cindex library contents file, format of
4513 @cindex format of library contents
4514 @cindex file format, library contents
4516 There is nothing like a special library format. The ones that have been
4517 introduced in 1.4.1 just use some nice (and time consuming) features of GNU
4518 @code{m4}. The only predefined format is the one of the contents file
4519 which is read during startup. It is made up of two basic line types:
4521 @example
4522 menu entry      = "TYPE="name
4523 contents line   = template":"package":"value":"description
4524 name            = String
4525 template        = String
4526 package         = String
4527 value           = String
4528 description     = String
4529 String          = <anything except ":", "\n" and "\r">
4530 @end example
4532 No leading white spaces or comments are allowed in this file. If you need
4533 either one, define a command that removes them before loading. Have a look
4534 to the @emph{libraryContentsCommand} resource.
4536 The menu entry will appear in the selection menu at the top and of the
4537 library window.
4539 @node Library File
4540 @section Library File Format
4541 @cindex library file, format of
4542 @cindex format of libraries
4543 @cindex file format, libraries
4545 This section provides an overview about the existing @code{m4} definitions
4546 of the elements. There are basically two different types of files. One
4547 to define element specific data like the pinout, package and so on, the
4548 other to define the values. For example the static RAM circuits 43256 and
4549 62256 are very similar. They therefore share a common definition in the
4550 macro file but are defined with two different value labels.
4552 The macro file entry:
4553 @example
4554 define(`Description_43256_dil', `SRAM 32Kx8')
4555 define(`Param1_43256_dil', 28)
4556 define(`Param2_43256_dil', 600)
4557 define(`PinList_43256_dil', ``pin1', `pin2', ...')
4558 @end example
4560 And the list file:
4561 @example
4562 43256_dil:N:43256:62256
4563 @end example
4565 The macro must define a description, the pin list and up to two additional
4566 parameters that are passed to the package definitions. The first one is
4567 the number of pins whereas the second one defines for example the width
4568 of a package.
4570 It is very important to select a unique identifier for each macro. In
4571 the example this would be @emph{43256_dil} which is also the templates name.
4572 It is required by some low-level macros that
4573 @emph{Description_, Param1_, Param2_} and @emph{PinList_} are perpended.
4575 The list file uses a syntax:
4576 @example
4577 template:package:value[:more values]
4578 @end example
4580 This means that the shown example will create two element entries with the
4581 same package and pinout but with different names.
4583 A number of packages are defined in @file{common.m4}. Included are:
4585 @example
4586 DIL packages with suffix D, DW, J, JD, JG, N, NT, P
4587 PLCC
4589 generic connectors
4590 DIN 41.612 connectors
4591 zick-zack (SD suffix)
4592 15 pin multiwatt
4593 @end example
4595 If you are going to start your own library please take care about @code{m4}
4596 functions. Be aware of quoting and so on and, most important check your
4597 additional entry by calling the macro:
4599 @example
4600 CreateObject(`template', `value', `package suffix')
4601 @end example
4603 If quoting is incorrect an endless loop may occur (broken by a out-of-memory
4604 message).
4606 The scripts in the @file{lib} directory handle the creation of libraries
4607 as well as of their contents files. Querying is also supported.
4609 I know quite well that this description of the library implementation is
4610 not what some out there expect. But in my opinion it's much more useful to
4611 look at the comments and follow the macros step by step.
4613 @node File Syntax
4614 @section File Syntax
4615 @cindex File sytax
4616 @cindex Syntax, file
4618 @include pcbfile.texi
4620 @c --------------------------- chapter 7 -------------------------------
4621 @node Library Creation
4622 @chapter Library Creation
4623 @cindex library creation
4625 This chapter provides a detailed look at how footprint libraries are
4626 created and used.  The chapter is split into two section, the first
4627 section covers the "old" style libraries which use the @code{m4} macro
4628 processor and the second section covers the "new" style libraries.
4630 Despite the names "old" and "new", both styles of libraries are useful
4631 and the "old" style should not be discounted because of its name.  The
4632 advantage of the old style libraries is that one can define a family of
4633 footprints, say a DIP package, and then quickly produce all the members
4634 of that family.  Because the individual packages make use of a base
4635 definition, corrections made to the base definition propagate to all the
4636 members of a family.  The primary drawback to using this library
4637 approach is that the effort to create a single footprint is more than a
4638 graphical interface and may take even longer if the user has not used
4639 the @code{m4} macro language previously.
4641 The new style of footprint libraries stores each footprint in its own
4642 file.  The footprints are created graphically by placing pads and then
4643 converting a group of pads to a component.  This library method has the
4644 advantage of being quick to learn and it is easily to build single
4645 footprints quickly.  If you are building a family of parts, however, the
4646 additional effort in creating each one individually makes this approach
4647 undesirable.  In addition, creating a part with a large pin count
4648 can be quite tedious when done by hand.
4651 @section Old Style (m4) Libraries
4652 The old style libraries for pcb use the @code{m4} macro processor to
4653 allow the definition of a family of parts.  There are several files
4654 associated with the old style library.  The file @file{common.m4} is the
4655 top level file associated with the library.  @file{common.m4} defines a
4656 few utility macros which are used by other portions of the library,
4657 and then includes a predefined set of library files (the lines like
4658 @code{include(geda.inc)}).
4660 @subsection Overview of Oldlib Operation
4661 The big picture view of the old style library system is that the library
4662 is simply a collection of macro definitions.  The macros are written in
4663 the @code{m4} macro language.  An example of a macro and what it expands
4664 to is the following.  One of the predefined footprints in the library
4665 which comes with PCB is the @code{PKG_SO8} macro.  Note that all the
4666 footprint macros begin with @code{PKG_}.  For this particular example,
4667 @code{PKG_SO8} is a macro for an 8-pin small outline surface mount
4668 package.  All of the footprint macros take 3 arguments.  The first is the
4669 canonical name of the footprint on the board.  In this case "SO8" is an
4670 appropriate name.  The second argument is the reference designator on
4671 the board such as "U1" or "U23".  The third and final argument is the
4672 value.  For an integrated circuit this is usually the part number such
4673 as "MAX4107" or "78L05" and for a component such as a resistor or
4674 capacitor it is the resistance or capacitance.  The complete call to the
4675 macro in our example is @samp{PKG_SO8(SO8, U1, MAX4107)}.  When
4676 processed by @code{m4} using the macros defined in the PCB library, this
4677 macro expands to
4678 @example
4679 Element(0x00 "SO8" "U1" "MAX4107" 146 50 3 100 0x00)
4681         Pad(10 25 38 25 20 "1" 0x00)
4682         Pad(10 75 38 75 20 "2" 0x100)
4683         Pad(10 125 38 125 20 "3" 0x100)
4684         Pad(10 175 38 175 20 "4" 0x100)
4685         Pad(214 175 242 175 20 "5" 0x100)
4686         Pad(214 125 242 125 20 "6" 0x100)
4687         Pad(214 75 242 75 20 "7" 0x100)
4688         Pad(214 25 242 25 20 "8" 0x100)
4689         ElementLine(0 0 151 0 10)
4690         ElementArc(126 0 25 25 0 180 10)
4691         ElementLine(101 0 252 0 10)
4692         ElementLine(252 0 252 200 10)
4693         ElementLine(252 200 0 200 10)
4694         ElementLine(0 200 0 0 10)
4695         Mark(29 25)
4697 @end example
4698 which is the actual definition of the footprint that the PCB program
4699 works with.  As a user of PCB the only time you will need or want to run
4700 @code{m4} directly is when you are debugging a new library addition.  In
4701 normal operation, the calls to @code{m4} are made by helper scripts that
4702 come with PCB.
4704 Tools such as @code{gsch2pcb} (used to interface the gEDA schematic
4705 capture program to PCB layout) will call @code{m4} to produce an initial
4706 PCB layout that includes all the components on a schematic.  In
4707 addition, when manually instantiating parts from within PCB, @code{m4}
4708 will be called by PCB's helper scripts to produce the footprints.
4710 @subsection The Library Scripts
4711 There are several scripts that are used for processing the m4
4712 libraries.  This section briefly describes these scripts and details how
4713 they are used by PCB.
4715 @subsubsection Scripts Used During Compilation
4716 The scripts described in this section are used during compilation of
4717 PCB.  They are run automatically by the build system, but are described
4718 here to help document the complete library processing that occurs.
4719 During the build of PCB, the following actions are taken.  The
4720 @code{CreateLibrary.sh} script is run to produce an M4 "frozen file".
4721 This frozen file is simply a partially processed M4 input file which can
4722 be loaded by M4 more quickly than the original input file.
4724 A typical call to @code{CreateLibrary.sh} used during the compilation of
4725 PCB is:
4726 @example
4727 ./CreateLibrary.sh -I . pcblib ./common.m4 TTL_74xx_DIL.m4
4728 connector.m4 crystal.m4 generic.m4 genericsmt.m4 gtag.m4
4729 jerry.m4 linear.m4 logic.m4 lsi.m4 memory.m4 optical.m4 pci.m4
4730 resistor_0.25W.m4 resistor_adjust.m4 resistor_array.m4
4731 texas_inst_amplifier.m4 texas_inst_voltage_reg.m4
4732 transistor.m4 geda.m4
4733 @end example
4734 The @samp{-I .} says to search in the current directory for the
4735 @file{.m4} files.  The output frozen file is @file{pcblib}.  The main
4736 @file{common.m4} file is listed as well as all of the @file{*.m4} files
4737 which define the components in the library.
4739 In addition, a library contents file is created during the build with
4740 the @code{CreateLibraryContents.sh} script.
4741 A typical call to @code{CreateLibrary.sh} used during the compilation of
4742 PCB is:
4743 @example
4744 ./CreateLibraryContents.sh -I . ./common.m4 TTL_74xx_DIL.list
4745 connector.list crystal.list generic.list genericsmt.list gtag.list
4746 jerry.list linear.list logic.list lsi.list memory.list optical.list
4747 pci.list resistor_0.25W.list resistor_adjust.list resistor_array.list
4748 texas_inst_amplifier.list texas_inst_voltage_reg.list transistor.list
4749 geda.list > pcblib.contents
4750 @end example
4752 The @file{pcblib.contents} file is used by the PCB program to define the
4753 libraries and components which will be displayed when you bring up
4754 the library window from within PCB.  An example of part of the
4755 @file{pcblib.contents} file is:
4756 @example
4757 TYPE=~TTL 74xx DIL
4758 7400_dil:N:7400:4 dual-NAND
4759 7401_dil:N:7401:4 dual-NAND OC
4760 7402_dil:N:7402:4 dual-NOR
4761 TYPE=~geda
4762 geda_DIP6:DIP6:DIP6:Dual in-line package, narrow (300 mil)
4763 geda_DIP8:DIP8:DIP8:Dual in-line package, narrow (300 mil)
4764 geda_DIP14:DIP14:DIP14:Dual in-line package, narrow (300 mil)
4765 geda_ACY300:ACY300:ACY300:Axial non-polar component,
4766 @end example
4767 The @code{TYPE=} lines define the library name that will show up in the
4768 library window in PCB.  The other lines define the actual components in
4769 the library.
4771 @subsubsection Scripts Used by PCB at Runtime
4772 When PCB is first executed, it makes a call to the
4773 @code{ListLibraryContents.sh} script.  This script provides the PCB
4774 program with the contents of the library contents file created when PCB
4775 was compiled.  A typical call to @code{ListLibraryContents.sh} is
4776 @example
4777 ../lib/ListLibraryContents.sh .:/tmp/pcb-20030903/src/../lib pcblib
4778 @end example
4779 This command says to search the path
4780 @samp{.:/tmp/pcb-20030903/src/../lib} for a file called
4781 @file{pcblib.contents} (the @file{.contents} part is added
4782 automatically) and display the contents of the file.
4783 PCB parses this output and generates the library window entries.
4785 When you pick a library component from the library window, PCB calls the
4786 @code{QueryLibrary.sh} script to actually pull the footprint into the
4787 layout.  For example, when the ACY300 component is selected from the
4788 @code{~geda} library, the generated call may be:
4790 @example
4791 /tmp/pcb-20030903/src/../lib/QueryLibrary.sh
4792 .:/tmp/pcb-20030903/src/../lib pcblib geda_ACY300 ACY300
4793 ACY300
4794 @end example
4795 If you were to run this command by hand you would see the PCB code for
4796 the element:
4797 @example
4798 Element(0x00 "Axial non-polar component," "" "ACY300" 245 70 0 100 0x00)
4800         Pin(0 25 50 20 "1" 0x101)
4801         Pin(300 25 50 20 "2" 0x01)
4803         ElementLine(0 25 75 25 10)
4804         ElementLine(225 25 300 25 10)
4806         ElementLine(75 0 225 0 10)
4807         ElementLine(225 0 225 50 10)
4808         ElementLine(225 50 75 50 10)
4809         ElementLine(75 50 75 0 10)
4811 #       ElementArc(X1 Y 50 50 270 180 10)
4812 #       ElementArc(X2 Y 50 50 90 180 10)
4814         Mark(75 25)
4816 @end example
4818 @subsection Creating an Oldlib Footprint
4819 This section provides a complete example of defining a family of
4820 footprints using the M4 style library.  As a vehicle for this example, a
4821 family of footprints for surface mount resistors and capacitors will be
4822 developed.   The file @file{example.inc} should have been installed on
4823 your system as @file{$prefix/share/examples/oldlib/example.inc} where
4824 @file{$prefix} is often times @file{/usr/local}.
4826 The @file{example.inc} file defines a macro called
4827 @code{COMMON_PKG_RCSMT} which is a generic definition for a surface
4828 mount footprint with two identical, rectangular pads.  This macro will
4829 be called with different parameters to fill out the family of parts.
4830 The arguments to the @code{COMMON_PKG_RCSMT} are:
4831 @example
4832 # -------------------------------------------------------------------
4833 # the definition for surface mount resistors and capacitors
4834 # $1: canonical name
4835 # $2: name on PCB
4836 # $3: value
4837 # $4: pad width   (in direction perpendicular to part)
4838 # $5: pad length  (in direction parallel with part)
4839 # $6: pad spacing (center to center)
4840 # $7: distance from edge of pad to silk (in direction
4841 #     perpendicular to part)
4842 # $8: distance from edge of pad to silk (in direction parallel
4843 #     with part)
4844 # $9: Set to "no" to skip silk screen on the sides of the part
4845 @end example
4847 @example
4848 define(`COMMON_PKG_RCSMT',
4849         `define(`XMIN', `eval( -1*`$6'/2 - `$5'/2 - `$8')')
4850         define(`XMAX', `eval(  `$6'/2 + `$5'/2 + `$8')')
4851         define(`YMIN', `eval(-1*`$4'/2 - `$7')')
4852         define(`YMAX', `eval(   `$4'/2 + `$7')')
4853 Element(0x00 "$1" "$2" "$3" eval(XMIN+20) eval(YMAX+20) 0 100 0x00)
4855         ifelse(0, eval($4>$5),
4856         # Pads which have the perpendicular pad dimension less
4857         # than or equal to the parallel pad dimension
4858         Pad(eval(-1*(   $6 + $5 - $4)/2) 0
4859             eval((-1*$6 + $5 - $4)/2) 0 eval($4) "1" 0x100)
4860         Pad(eval(-1*(-1*$6 + $5 - $4)/2) 0
4861             eval((   $6 + $5 - $4)/2) 0 eval($4) "2" 0x100)
4862         ,
4863         # Pads which have the perpendicular pad dimension greater
4864         # than or equal to the parallel pad dimension
4865         Pad(eval(-1*$6/2) eval(-1*($4 - $5)/2)
4866             eval(-1*$6/2)  eval(($4 - $5)/2) eval($5) "1" 0x100)
4867         Pad(eval(   $6/2) eval(-1*($4 - $5)/2)
4868             eval(   $6/2)  eval(($4 - $5)/2) eval($5) "2" 0x100)
4869         )
4871         # silk screen
4872         # ends
4873         ElementLine(XMIN YMIN XMIN YMAX 10)
4874         ElementLine(XMAX YMAX XMAX YMIN 10)
4875         # sides
4876 ifelse($9,"no",
4877         #skip side silk
4878         ,
4879         ElementLine(XMIN YMIN XMAX YMIN 10)
4880         ElementLine(XMAX YMAX XMIN YMAX 10)
4882         Mark(0 0)
4884 @end example
4885 Note that the part has been defined with the mark located at
4886 @code{(0,0)} and that the pads have been placed with the mark at the
4887 common centroid of the footprint.  While not a requirement, this is
4888 highly desirable when developing a library that will need to interface
4889 with a pick and place machine used for factory assembly of a board.
4891 The final part of @file{example.inc} defines particular versions of the
4892 generic footprint we have created.  These particular versions correspond
4893 to various industry standard package sizes.
4894 @example
4895 # 0402 package
4897 # 30x30 mil pad, 15 mil metal-metal spacing=>
4898 # 15 + 15 + 15 = 45 center-to-center
4899 define(`PKG_RC0402',
4900   `COMMON_PKG_RCSMT(`$1', `$2', `$3', 30, 30, 45, 0, 10, "no")')
4902 # 0603 package
4904 # 40x40 mil pad, 30 mil metal-metal spacing=>
4905 #  30 + 20 + 20 = 70 center-to-center
4906 define(`PKG_RC0603',
4907   `COMMON_PKG_RCSMT(`$1', `$2', `$3', 40, 40, 70, 10, 10)')
4909 # 1206 package
4911 # 40x60 mil pad, 90 mil metal-metal spacing=>
4912 #  90 + 20 + 20 = 130 center-to-center
4913 define(`PKG_RC1206',
4914   `COMMON_PKG_RCSMT(`$1', `$2', `$3', 60, 40, 130, 10, 10)')
4915 @end example
4917 At this point, the @file{example.inc} file could be used by third party
4918 tools such as @code{gsch2pcb}.  However to fully integrate our
4919 footprints into PCB we need to create the @file{example.m4} and
4920 @file{example.list} files.  The @file{example.m4} file defines
4921 descriptions for the new footprints.
4922 @example
4923 define(`Description_my_RC0402',
4924   ``Standard SMT resistor/capacitor (0402)'')
4925 define(`Description_my_RC0603',
4926   ``Standard SMT resistor/capacitor (0603)'')
4927 define(`Description_my_RC1206',
4928   ``Standard SMT resistor/capacitor (1206)'')
4929 @end example
4930 Finally we need to create the @file{example.list} file.
4931 @example
4932 my_RC0402:RC0402:RES0402
4933 my_RC0402:RC0402:CAP0402
4934 my_RC0603:RC0603:RES0603
4935 my_RC0603:RC0603:CAP0603
4936 my_RC1206:RC1206:RES1206
4937 my_RC1206:RC1206:CAP1206
4938 @end example
4939 The first field in the list file has the name corresponding to the
4940 Description definitions in @file{example.m4}.  The second field is the
4941 template name which corresponds to the macros @code{PKG_*} we defined in
4942 @file{example.inc} with the leading @code{PKG_} removed.  It is the
4943 second field which controls what footprint will actually appear on the
4944 board.  The final
4945 field is the name of the part type on the board.  The first line in our
4946 @file{example.list} file will produce a menu entry in the library window
4947 that reads:
4948 @example
4949 CAP0402, Standard SMT resistor/capacitor (0402)
4950 @end example
4951 The @code{CAP0402} portion comes directly from the third field in
4952 @code{example.list} and the longer description comes from descriptions
4953 macros in @code{example.m4}.  Please note that any extra white space
4954 at the end of a line in the @file{.list} files will cause them to
4955 not work properly.
4957 @subsection Troubleshooting Old Style Libraries
4959 A powerful technique to help debug problems with libraries is to invoke
4960 the @code{m4} processor directly.  This approach will provide error
4961 output which is not visible from within PCB.  The following example
4962 shows how one might try to debug an 8 pin small outline (SO8) package.  The
4963 macro name for the package is PKG_SO8.  In this example, the
4964 canonical name that is to be associated with the part is SO8, the
4965 reference designator is U1, and the value is MAX4107 (the part number).
4967 @example
4968 echo "PKG_SO8(SO8, U1, MAX4107)" | \
4969    gm4 common.m4 - | \
4970    awk '/^[ \t]*$/ @{next@} @{print@}' | \
4971    more
4972 @end example
4973 The @code{awk} call simply removes blank lines which make the output
4974 hard to read.
4976 For this particular example, the output is:
4977 @example
4978 Element(0x00 "SO8" "U1" "MAX4107" 146 50 3 100 0x00)
4980         Pad(10 25 38 25 20 "1" 0x00)
4981         Pad(10 75 38 75 20 "2" 0x100)
4982         Pad(10 125 38 125 20 "3" 0x100)
4983         Pad(10 175 38 175 20 "4" 0x100)
4984         Pad(214 175 242 175 20 "5" 0x100)
4985         Pad(214 125 242 125 20 "6" 0x100)
4986         Pad(214 75 242 75 20 "7" 0x100)
4987         Pad(214 25 242 25 20 "8" 0x100)
4988         ElementLine(0 0 151 0 10)
4989         ElementArc(126 0 25 25 0 180 10)
4990         ElementLine(101 0 252 0 10)
4991         ElementLine(252 0 252 200 10)
4992         ElementLine(252 200 0 200 10)
4993         ElementLine(0 200 0 0 10)
4994         Mark(29 25)
4996 @end example
4998 @section New Style Libraries
4999 Footprints for the new style library are created graphically using the
5000 PCB program.  A single footprint is saved in each file.
5002 @subsection Creating Newlib Footprints
5003 To create
5004 @enumerate
5005 @item Start PCB with an empty layout.
5006 @item Make the component layer active.
5007 @item For a leaded part, select the via tool and place vias where the
5008 pads for the part should go.  For surface mount pads, draw line
5009 segments.  Note that until the footprint is completed, the surface
5010 mount pads will remain rounded.  Currently a rectangle or polygon
5011 may not be used as a pad.
5012 @item For each via and line segment which will become a pad, select it
5013 and press 'n' to be able to enter a name.  Enter
5014 the pin number and press enter.
5015 @item Make the silk layer active.
5016 @item Using the line and arc tools, draw a silk screen outline for the
5017 part.
5018 @item Using the selection tool, select all of the pins and silk screen
5019 for the part.
5020 @item Place the pointer above the reference point for the part.  This is
5021 typically the common centroid.  Keeping the pointer there, shift-right-click
5022 to bring up the popup menu and choose "convert
5023 selection to element".
5024 @item At this point, the vias, line segments, and silk screen will have
5025 been converted to an element.  To change any of the line segments to
5026 have square ends rather than round ends, select the pads by holding
5027 down the shift key and clicking each pad with the center mouse button.
5028 Now under the Select menu, "Change square-flag of selected objects"
5029 section, choose "Pins".
5030 @item Select the element, shift-right-click to bring up the popup menu, and
5031 choose "Copy Selection to Buffer".  Now left-click on the center of 
5032 the new element.
5033 @item Under the buffer menu, choose "save buffer elements to file" to
5034 save the new footprint to a file.
5035 @item Press ESC to exit from buffer mode.
5036 @end enumerate
5038 @subsection Modifying Newlib Footprints
5039 @enumerate
5040 @item In the @code{Pcb} program, instantiate the footprint you wish to modify.
5041 @item Using the selection tool, select the footprint.
5042 @item Now left-click on the selected element, this brings up a popup menu, choose
5043 "Cut Selection to Buffer" from the popup menu.
5044 @item Under the buffer menu, choose "break buffer element to pieces",
5045 and then left-click to place the broken apart footprint to an open area of
5046 the layout.  Note that you must use the items under the buffer menu, the
5047 items with the same names in the popup menu do not work.
5048 @item Make your desired modifications to the footprint and then convert
5049 the pieces back to an element using the same procedure as when starting
5050 from scratch on a new footprint.
5051 @end enumerate
5054 @c --------------------------- chapter 8 -------------------------------
5055 @node Schematic Frontends
5056 @chapter Schematic Capture for PCB
5057 @cindex schematic capture
5058 @cindex schematic frontend
5060 When designing a circuit board of any complexity, a schematic capture
5061 front-end for the design is highly desired.  Any schematic capture
5062 program which is able to generate a netlist in a user defined format as
5063 well as a bill of materials can be made to work with PCB.  Currently, we
5064 are aware of two freely available schematic capture programs which can
5065 interface with PCB.  This chapter shows how a design can be taken from
5066 start to finish using either of these two tools for schematic capture
5067 and PCB for layout.
5069 @menu
5070 * gEDA::          Interfacing with GNU EDA (gEDA).
5071 * xcircuit::      Interfacing with xcircuit.
5072 @end menu
5074 @node gEDA
5075 @section gEDA
5076 @cindex gschem, how to interface with
5077 @cindex gEDA, how to interface with
5079 This section shows how to use gEDA as the schematic capture front-end for
5080 a PCB design.  This section is not intended to be complete documentation
5081 on gEDA and it is assumed that the user has at least some familiarity
5082 with the gEDA suite of programs.
5084 The basic steps in a gEDA + PCB design flow are:
5085 @enumerate
5086 @item Set up project directories
5087 @item Set up gEDA (gschem/gnetlist) config files
5088 @item Set up gsch2pcb config files
5089 @item Capture schematics using @code{gschem} (part of gEDA)
5090 @item Create any unique PCB footprints needed for the design
5091 @item Generate initial PCB design using @code{gsch2pcb} (part of gEDA)
5092 @item Layout circuit board using @code{pcb}
5093 @item Make any additional schematic changes with @code{gschem} and
5094 forward annotate to PCB with @code{gsch2pcb}
5095 @item Generate photoplot files (RS-274X, also known as "Gerber") for
5096 board vendor
5097 @end enumerate
5099 @subsection Set Up Project Directories
5100 Although not required, a typical project directory will contain the
5101 schematics and board layout at the top level.
5102 Schematic symbols and circuit board footprints which are unique to this
5103 project are stored in subdirectories.  For this example, @file{sym}
5104 contains the project specific schematic symbols and @file{pkg} contains
5105 the project specific footprints.  Set up the project subdirectory and
5106 subdirectories by executing:
5107 @example
5108 mkdir ~/myproj
5109 cd ~/myproj
5110 mkdir sym
5111 mkdir pkg
5112 mkdir pkg/newlib
5113 mkdir pkg/m4
5114 @end example
5116 @subsection Set Up gEDA Config Files
5117 The gEDA tools, specifically @code{gschem} and @code{gnetlist}, use
5118 configuration files to set the search path for symbol libraries in
5119 addition to other user preferences.  Create a file in the top level
5120 project directory called @file{gschemrc}.  Add the following lines to
5121 that file:
5122 @example
5124 ;; list libraries here.  Order matters as it sets the
5125 ;; search order
5126 (component-library "./sym")
5128 @end example
5129 This sets the local search path for the schematic capture program
5130 @code{gschem}.  Now the netlister, @code{gnetlist}, must also be
5131 configured.  This can be done by copying the file @file{gschemrc} to
5132 @file{gnetlistrc} by running @samp{cp gschemrc gnetlistrc}.
5133 Alternatively, you can create a soft link so only a single file needs to
5134 be updated if additional symbol paths are added.  The link is created by
5135 running @samp{ln -s gschemrc gnetlistrc}.
5137 @subsection Set Up @code{gsch2pcb} Config Files
5138 The program @code{gsch2pcb}, not to be confused with the older
5139 @code{gschem2pcb} script, is used to link the schematic to layout.
5140 @code{gsch2pcb} is responsible for creating the netlist used to provide
5141 connectivity information to PCB as well creating an initial layout with
5142 all components instantiated in the design.  Forward annotation of
5143 schematic changes to the layout is also done using @code{gsch2pcb}.
5144 @code{gsch2pcb} uses a project file to set up the schematic file names,
5145 PCB library locations, and output file names.  Create a project file
5146 called @file{project} using the following as an example:
5147 @example
5149 # List all the schematics to be netlisted
5150 # and laid out on the pc board.
5151 schematics      first.sch second.sch third.sch
5153 # For an output-name of foo, gsch2pcb generates files
5154 # foo.net, foo.pcb, and foo.new.pcb.  If there is no
5155 # output-name specified, the file names are derived from
5156 # the first listed schematic, i.e. first.net, etc.
5157 output-name  preamp
5159 @end example
5162 @subsection Capture Schematics Using @code{gschem}
5163 This section is fairly brief and assumes familiarity with using the
5164 @code{gschem} schematic capture program.  As you are creating your
5165 schematics, be sure to observe the following rules:
5166 @itemize
5167 @item Make sure that each component in the schematic has a
5168 @code{footprint} attribute that corresponds to a footprint in the PCB
5169 library or a footprint you plan on creating.
5170 @item Make sure all reference designators are unique.  One way to ensure
5171 this is to run the @code{refdes_renum} script (part of gEDA) after the
5172 schematics are created.
5173 @end itemize
5175 @subsection Create Any Unique PCB Footprints
5176 Create the new footprints you design needs using either the m4 style or
5177 newlib style of PCB libraries.  Refer to @ref{Library Creation} for details on this
5178 process.  For m4 style footprints, store them in the @file{pkg/m4}
5179 subdirectory and for newlib footprints, store them in the
5180 @file{pkg/newlib} subdirectory.
5182 @subsection Generate Initial PCB Design Using @code{gsch2pcb}
5183 The @code{gsch2pcb} program connects the schematic and layout.  It basic
5184 operation is to call @code{gnetlist} to generate the connectivity
5185 netlist that PCB used to verify connectivity and to instantiate all
5186 elements found in the schematic to a new layout.
5187 The default, as of @code{gsch2pcb} version 0.9,  is to use any found  m4
5188 style parts first and then search for newlib style if no old style part
5189 was found.  By using the @code{--use-files} or @code{-f} flag to @code{gsch2pcb}
5190 priority is given to newlib style parts even if m4 style are found.  You
5191 may wish to verify this in the @code{gsch2pcb} documentation in case
5192 this changes in the future.
5193 To start your layout,
5194 run @samp{gsch2pcb project} where @file{project} is the project file
5195 created previously.  This will create a new netlist file,
5196 @file{preamp.net}, and a new layout file, @file{preamp.pcb}.
5199 @subsection Layout Circuit Board
5200 Run PCB on the new layout by running @samp{pcb preamp.pcb}.
5201 Load the netlist file by selecting "load netlist file" from the "file"
5202 menu.  In the file selection dialog box, choose @file{preamp.net}.  This
5203 loads connectivity information into PCB.
5205 Using the selection tool, grab and move apart the various footprints
5206 with the middle mouse button.  Once the parts are moved apart from each
5207 other, choose "optimize rats-nest" from the "Connects" menu.  This menu
5208 choice will display and optimize the rats nest.  Use the rats nest to
5209 help guide placement of the parts.  You may wish to re-run the "optimize
5210 rats-nest" command after moving parts around.
5212 After the placement is complete, use the line tool to add traces to the
5213 board.  As traces are added, the corresponding rats line will disappear.
5215 @section Forward Annotation of Schematic Changes
5216 If schematic changes are made after the layout has started,
5217 @code{gsch2pcb} can be used to forward annotate these changes to the
5218 layout.  To forward annotate schematic changes, run @samp{gsch2pcb
5219 project}.  This command will create the files @file{preamp.new.pcb},
5220 @file{preamp.net}, and modify the file @file{preamp.pcb}.  The
5221 modifications to @file{preamp.pcb} include forward annotation of
5222 schematic component value changes, adds any new components, and removes
5223 any deleted components.
5225 @subsection Generate Photoplot Files (RS-274X)
5226 After the layout is complete, choose "edit layer-groupings" from the
5227 "Settings" menu.  The LayerGroups form lets you specify which layers
5228 will appear in each output layer group.  For example, in the default
5229 form, layer group 1 has "front" and "front side" in it.  The
5230 output file @file{1.gbr} if DOS file names are used, or
5231 @file{somename_front.gbr} if long file names are used will contain the
5232 "front" and "front side" layers in it.  Usually the defaults are
5233 sufficient, but this form is still a useful reference.
5235 Choose "print layout..." from the "File" menu.  In the print dialog box,
5236 select "Gerber/RS-274X" for the device
5237 driver.  Select the "outline", "alignment", and "drillhelper" options.
5238 To get DOS compatible file names, select the "DOS (8.3) names" option,
5239 otherwise enter "preamp" for the filename.  Press "OK".
5241 The following output files should have been created in the project directory.
5242 The names in parentheses correspond to the DOS compatible output file names.
5243 @table @file
5244 @item preamp_frontsilk.gbr (csilk.gbr)
5245 Top side silk screen.
5246 @item preamp_frontmask.gbr (cmask.gbr)
5247 Top side soldermask relief.
5248 @item preamp_front.gbr (1.gbr)
5249 Top copper.
5250 @item preamp_backmask.gbr (smask.gbr)
5251 Bottom side soldermask relief.
5252 @item preamp_back.gbr (2.gbr)
5253 Bottom Copper.
5254 @item preamp_fab.gbr (fab.gbr)
5255 Fabrication drawing.  Also known as the drill drawing.  This drawing is
5256 used for reference by the board vendor but is not directly used in the
5257 fabrication process.
5258 @item preamp_plated-drill.cnc (pdrill.cnc)
5259 NC Drill format file for the plated through holes.
5260 @item preamp_unplated-drill.cnc (udrill.cnc)
5261 NC Drill format file for the unplated through holes.
5262 @item preamp_bom.txt (bom.txt)
5263 A bill of materials for the layout.
5264 @item preamp_xy.txt (xy.txt)
5265 Centroid (X-Y) data for driving automated assembly equipment.
5266 @end table
5268 @comment to include an image:
5269 @comment @image{geda1, 6in, 4in, geda schematic, png}
5271 @node xcircuit
5272 @section xcircuit
5273 @cindex xcircuit, how to interface with
5274 @cindex xcircuit, how to interface with
5276 If anyone cares to contribute this section, it will get added.  Please
5277 submit changes to the bug tracking system at the sourceforge project
5278 page for PCB which can be found from the PCB homepage at
5279 @url{http://pcb.sourceforge.net}.
5281 @c --------------------------- Appendix A -------------------------------
5283 @node Installation
5284 @appendix Installation and Troubleshooting
5286 Compiling and installing the package should be straightforward. If any problems
5287 occur, please contact the author @email{Thomas.Nau@@rz.uni-ulm.de}, or the
5288 current maintainer @email{haceaton@@aplcomm.jhuapl.edu} to find
5289 a solution and include it into the next release.
5291 @menu
5292 * compiling::     Compiling and installing.
5293 * problems::      Troubleshooting.
5294 @end menu
5297 @node compiling
5298 @section Compiling and Installing
5299 @cindex install, how to
5300 @cindex compile, how to
5302 This section covers the steps which are necessary to compile the package.
5304 @menu
5305 * quickstart::                 Quick start.
5306 * running configure::          Customizing Pcb with Configure
5307 @end menu
5309 @node quickstart
5310 @subsection Quick Start
5311 @cindex GNU build system
5313 Starting with version 2.0, @code{Pcb} has switched to a GNU
5314 autoconf/automake build system.  Installation of @code{Pcb} consists of
5315 three steps:  configuration, building, and installing.
5316 In a typical installation, these steps are as simple as
5317 @example
5318 ./configure
5319 make
5320 make install
5321 @end example
5323 @node running configure
5324 @subsection Running the configure Script
5325 @cindex GNU configure script
5326 @cindex configure
5328 The @code{configure} script accepts all of the standard GNU configure
5329 options.  For a complete list of configuration options, run
5330 @code{./configure --help}.
5333 @table @samp
5334 @vindex INFOLIBDIR
5335 @item INFOLIBDIR
5336 must be set to the directory where your GNU info files are located.
5338 @vindex PCBLIBDIR
5339 @item PCBLIBDIR
5340 is the path of a directory where the font files will be installed.
5342 @vindex DEFAULTFONT
5343 @item DEFAULTFONT
5344 the name of the default font file.
5346 @vindex DEFAULTLIBRARY
5347 @item DEFAULTLIBRARY
5348 the name of the default library.
5350 @vindex GNUM4
5351 @item GNUM4
5352 the name of GNUs m4 version.
5354 @vindex BTNMOD
5355 @item BTNMOD
5356 If your window manager has already bound @emph{Mod1} together with some
5357 function keys you may want to change this setting. This is true for HP-VUE.
5360 @end table
5362 If you find things which must be changed to compile on your system,
5363 please add the appropriate autoconf tests (if you are familiar with
5364 that) and mail a copy to the maintainer, harry eaton,  at
5365 @email{haceaton@@aplcomm.jhuapl.edu}.
5368 If you do not have the appropriate permissions you should run
5369 @file{./pcbtest.sh} in the @file{src} directory to run @code{Pcb} from
5370 the installation directory.
5373 @node problems
5374 @section Troubleshooting
5375 @cindex problems
5376 @cindex troubleshooting
5378 There are some known problems. Most of them are related to
5379 missing parts of a standard @code{X11} distribution. Some others are caused by
5380 third party applications such as @code{X} servers. To make this list more
5381 complete please mail your problems and, if available, solutions to the author.
5382 The mail address may be found at the beginning of this chapter.
5383 In any case, read @ref{X11}.
5385 By the way, you @code{MUST HAVE AN ANSI COMPILER} to make @code{Pcb} work.
5388 Another source of problems are older versions of @code{flex} and @code{bison}.
5389 @code{Pcb} definitely works with @code{flex-2.4.7} and @code{bison-1.22} or
5390 later. The problems will result in a @emph{syntax error} while parsing files.
5391 This should only be a problem if you have modified the @code{flex} or
5392 @code{bison} input files.
5394 The following list gives you just an idea because I'm not able to test
5395 all @code{Pcb} releases on all platforms.
5397 @menu
5398 * HP::              Hewlett-Packard series 700 and 800 running HP-UX 10.*
5399 * Sun::             Sun, Solaris 2.5
5400 * SGI::             SGI, IRIX 5.3 and 6.*
5401 * DEC Alpha::       DEC Alpha, DEC UNIX 3.2c and 4.0
5402 * SCO::             SCO Unix ODT 3.0, PC hardware
5403 * Linux::           Linux 0.99pl14 and later
5404 * BSD::             FreeBSD, NetBSD ...
5405 * X11::             Refers to @code{X11R4}, @code{X11R5}, and @code{OpenWindows}
5406 * TeX and Manuals:: Problems creating the @file{pcb.dvi}
5407 @end menu
5409 @node HP
5410 @subsection HP Series 700 and 800
5411 @cindex architecture
5412 @cindex HP
5413 @cindex Hewlett Packard
5415 You have to install several @code{X11} include files
5416 or, better, install a complete @code{X11R5} release. Hewlett-Packard doesn't
5417 support the Athena Widgets. So the header files and libraries are missing
5418 from the application media, but they are available as a patch.
5419 They also do not ship the @code{ANSI} compiler with the normal operating
5420 system release so you have to buy one or use @code{GCC}.
5421 Some of the tools are available as patches.
5423 In addition, @code{Pcb} has been successfully tested on these platforms with
5424 @code{HPUX 9.*, 10.*} running self-compiled @code{X11R5}.
5427 @node Sun
5428 @subsection Sun SPARC architecture
5429 @cindex architecture
5430 @cindex Sun
5431 @cindex Solaris
5432 @cindex OpenWindows
5434 There are no known problems with Sun machines if they use @code{X11R5} instead
5435 of @code{OpenWindows}. @code{Pcb} compiled successfully with all kinds of
5436 SPARCstations @code{Solaris-2.[345]}.
5438 For problems with @code{OpenWindows} refer to @ref{X11}.
5440 @node SGI
5441 @subsection Silicon Graphics
5442 @cindex architecture
5443 @cindex Silicon Graphics
5444 @cindex SGI
5446 @code{Pcb} has been tested on some boxes running either @code{IRIX-4.0.5} or
5447 @code{IRIX-5.3}. The former one uses a @code{X11R4} server.
5448 There are no problems.
5449 For known problems
5450 with @code{X11R4}, see @ref{X11}.
5453 @node DEC Alpha
5454 @subsection DEC Alpha
5455 @cindex architecture
5456 @cindex DEC
5457 @cindex Alpha
5459 @code{Pcb} compiled and runs without problems on @code{DEC UNIX V3.2c}.
5462 @node SCO
5463 @subsection SCO Unix
5464 @cindex architecture
5465 @cindex SCO
5466 @cindex PC UNIX
5468 John DuBois <spcecdt@@deeptht.armory.com> wrote:
5469 @example
5470 @code{SCO-ODT-3.0} requires the latest version of tls003, the Athena
5471 widget library (available from sosco.sco.com). The main problems
5472 I have encountered are it core dumps fairly often, especially
5473 while loading/dropping elements...
5474 @end example
5475 I'll see what I am able to do as soon as I have access to an @code{SCO} system.
5478 @node Linux
5479 @subsection Linux
5480 @cindex architecture
5481 @cindex Linux
5482 @cindex PC UNIX
5484 Since the @code{X11} version of @code{Pcb} has been developed on a Linux
5485 system here are no known problems.
5488 @node BSD
5489 @subsection FreeBSD and NetBSD
5490 @cindex FreeBSD
5491 @cindex NetBSD
5492 @cindex PC UNIX
5494 @code{Pcb} has been tested on NetBSD and works without any problems.
5495 You may also be able to find a NetBSD package at
5496 @url{ftp://ftp.netbsd.org/pub/NetBSD/packages/cad/pcb/README.html} or a
5497 FreeBSD port at
5498 @url{http://www.freebsd.org/cgi/url.cgi?ports/cad/pcb/pkg-descr}.
5500 @node X11
5501 @subsection Problems related to X11
5502 @cindex X11, problems
5504 There are a some problems related to @code{X11R4} or systems derived from
5505 @code{X11} such as @code{OpenWindows}. @xref{Sun}. You at least have to change
5506 all occurances of @emph{baseTranslations} in the resource files to
5507 @emph{translations} if you are using a @code{X11R4} server. Look at the
5508 @code{X11R5} @emph{Intrinsics} manual for details.
5510 The panner widget (print dialog box) appears only in release @code{X11R5} and
5511 later. It really simplifies adjusting the offsets.
5512 With earlier releases the printout will always appear in the center of the
5513 page.
5515 You may have some problems in a mixed @code{X11-OpenWindows}
5516 environment.
5518 @code{Pcb} has been tested successfully with @code{X11R6} under Linux 1.1.59
5519 and later.
5522 @node TeX and Manuals
5523 @subsection Problems related to TeX
5524 @cindex TeX, problems
5526 If your @code{TeX} installation complains about a missing @file{texinfo.tex}
5527 file copy the one included in this release (directory @file{doc}
5528 to your @code{TeX} macro directory.
5529 Note, there are probably newer versions of this file available from some
5530 FTP sites.
5531 @code{TeX-3.0} failed, @code{TeX-3.14} worked just fine. Check our FTP server
5532 @emph{ftp.uni-ulm.de} for ready-to-print versions of the manuals.
5535 @c --------------------------- Appendix B -------------------------------
5537 @node Custom Menus
5538 @appendix Customizing the Menus
5540 The menu system is driven off a data file that contains
5541 @dfn{resources}.  A resource is a hierarchical description of a data
5542 tree which, in this case, is mapped to the hierarchical menus used by
5543 Pcb.
5545 @menu
5546 * Resource Syntax::          What a resource file looks like.
5547 * Menu Definitions::         Using a resource to define a menu.
5548 * Menu Files and Defaults::  Where Pcb looks for its menu resource.
5549 @end menu
5551 @node Resource Syntax
5552 @section Resource Syntax
5554 A resource file is a simple text file.  It contains curly braces to
5555 group things, spaces between things, and double quotes when strings
5556 need to include spaces.  There are four fundamental ways of adding
5557 data to a resource.
5559 First, a string (either a single word or a quoted string with spaces,
5560 we call both ``strings'' in this appendix) can be added all by itself,
5561 to add a string resource to the current resource.  This is used, for
5562 example, to define the string printed on a menu button.  In this
5563 example, four strings are added to the @var{File} resource:
5565 @example
5566 File = @{
5567   Sample
5568   "longer sample"
5569   some text
5571 @end example
5573 Second, a named string may be added by giving two strings separated by
5574 an equals sign.  This is used to specify X resources and a few other
5575 optional parameters of menus, for example.  Note that a string all by
5576 itself is thus an ``unnamed'' string.
5578 @example
5579 @{"Layer groups" foreground=red sensitive=false@}
5580 @end example
5582 Third, an unnamed subresource may be added.  This is used to create
5583 submenus and menu buttons.  To add a subresource, simply group other
5584 things in curly braces.  This example describes a resource containing
5585 one string and three subresources:
5587 @example
5588 @{File
5589   @{New do_new()@}
5590   @{Save do_save()@}
5591   @{Quit do_quit()@}
5593 @end example
5595 Lastly, a named subresource may be added by prefixing an unnamed
5596 subresource with a string and an equals sign, just as when naming
5597 strings.  This syntax is used to name the resources used for the main
5598 menu and popup menus:
5600 @example
5601 MainMenu = @{
5602   @dots{}
5603   @}
5604 @end example
5606 Additionally, the menu parser allows for ``hooks'' whereby portions of
5607 the menu system can be programmatically created at runtime by the
5608 application.  These hooks are invoked by a single word proceeded by an
5609 at sign, such as this example where most of the Sizes menu is created
5610 automatically:
5612 @example
5613 @{Sizes
5614     @@sizes
5615     @{"Adjust active sizes ..." AdjustStyle(0)@}
5616     @}
5617 @end example
5619 In addition to all that, any unquoted pound sign (@code{#}) begins a
5620 comment.  Commented text continues until the end of the containing
5621 line.  Comments may begin at the beginning of a line, or after other
5622 text on the line:
5624 @example
5625 # This is a comment
5626 MainMenu = @{ # This is also a comment
5627 @end example
5629 @node Menu Definitions
5630 @section Menu Definitions
5632 To best understand this section, you should find the
5633 @file{pcb-menu.res} file that your Pcb uses and refer to it for
5634 examples (@pxref{Menu Files and Defaults}).
5636 A resource defines a menu when it meets certain semantic requirements.
5637 The menu hierarchy is reflected as a hierarchy of unnamed
5638 subresources, with the first string of each subresource defining the
5639 label used for the menu button.  A subresource that itself contains
5640 subresources becomes a submenu, a subresource that does not becomes a
5641 button.
5643 A submenu should only contain subresources for the buttons or submenus
5644 within that submenu.  Two exceptions are allowed: an initial string
5645 sets the label, and the string ``-'' (a single dash) will create a
5646 separator.
5648 A button should not contain subresources, but will contain many
5649 strings, named and unnamed.  The first member shall be an unnamed
5650 string which is the label for the button.  Any other unnamed strings
5651 within the button's resource will be used as actions (much like the
5652 .Xdefaults action strings), which are functions that will be called
5653 when the button is pressed (or popped up, or created, depending on the
5654 action).  As a convenience, if a left parenthesis is seen, the current
5655 ``word'' will continue at least until the matching right parenthesis.
5656 This allows you to pass strings with spaces as arguments to actions
5657 without needing to quote the action.
5659 Named resources in button resources will be used as X resources.  Such
5660 resources can be used to set the font, color, and spacing of buttons.
5661 As a convenience, ``fg'' can be used as an abbreviation for ``foreground''.
5663 Within the menu's resource file, Pcb will look for a few key named
5664 subresources.  At the moment, the only one it looks for is one called
5665 @code{MainMenu}.  This will be used for the main menu bar.  In the
5666 future, other named subresources will be used for popup resources.
5668 Given all this, a small sample @file{pcb-menu.res} would be:
5670 @example
5671 MainMenu = @{
5672   @{File
5673     @{"Load layout" Load(Layout)@}
5674     -
5675     @{"Quit Program" Quit() fg=red font=10x20@}
5676   @}
5678 @end example
5680 Within the Pcb sources are specially crafted comments that mark all
5681 the actions, flags, menu hooks, and whatnot that Pcb offers.  Read the
5682 file @file{src/gather-actions} in the Pcb source tree for
5683 documentation for these comments.
5685 @node Menu Files and Defaults
5686 @section Menu Files and Defaults
5688 Pcb will look for a file which defines its menus, trying the following
5689 names:
5691 @example
5692 ./pcb-menu.res
5693 $HOME/.pcb-menu.res
5694 $PCBLIBDIR/pcb-menu.res
5695 <internal>
5696 @end example
5698 Note that @var{pcblibdir} defaults to @file{/usr/local/share/pcb}
5699 (hence, @file{/usr/local/share/pcb/pcb-menu.res}).  The
5700 @file{<internal>} entry refers to a menu definition within the Pcb
5701 application itself.  The master file for all this is the file
5702 @file{src/pcb-menu.res} in the Pcb source tree.  This master source is
5703 used to create the internal menu definition as well as being installed
5704 in @file{$pcblibdir}.
5706 You can view the internal menu definition (the default) by running
5707 @file{pcb} with the @code{-dumpmenu} option, like this:
5709 @example
5710 pcb -dumpmenu
5711 @end example
5713 @c --------------------------- Appendix C -------------------------------
5714 @node Regular Expressions
5715 @appendix Element Search/Regular Expressions
5716 @cindex Element Search
5717 @cindex Regular Expressions
5718 @vindex Element Search
5719 @vindex Regular Expressions
5721 @section Element Search/Regular Expressions
5722 @code{Pcb}'s search is based on POSIX 1003.2 Regular Expressions.  Full POSIX
5723 Regular Expressions are supported by @code{Pcb} if the regex library was
5724 available when @code{Pcb} was built.  One difference from the regular
5725 expressions found in tools like awk or grep is that PCB implicitly
5726 adds a ``^'' to the begining of a regular expression and ``$'' to the
5727 end of the regular expression.  For example if you enter ``C1'', the
5728 actual regular expression used internally is ``^C1$''.  
5729 It is easier to show by example how to search than explain POSIX 1003.2.  The following table shows the most common
5730 Regular Expression characters used to find elements in @code{Pcb}:
5732 @table @samp
5733 @item \
5734 Indicates next character should not be interpreted literally if it
5735 normally is, and should be interpreted literally if it normally isn't.
5736 @item *
5737 Matches 0 or more instances of preceding character.
5738 @item +
5739 Matches 1 or more instances of preceding character.
5740 @item ?
5741 Matches 0 or 1 instances of preceding character.
5742 @item .
5743 Matches any single character other than the newline character.
5745 @end table
5747 The following examples illustrate how regular expressions are used to
5748 specify element names (reference designators) to search for.
5749 @table @samp
5751 @item Search for the element whose name is exactly ``C1''.
5752 Enter ``C1''.
5754 @item Search for all elements that start with ``C'', such as capacitors:
5755 Enter ``C.*''.
5757 @item Search for all elements that start with ``C'' and end with ``1'', such as ``C1'', or ``C51'':
5758 Enter ``C.*1''.
5760 @item Search for only R1 or R10, will not match R100:
5761 Enter ``R10?''.
5763 @item Search for all parts starting with ``R12'' and ending with the number eight, or eighty-eight etc:
5764 Enter ``R128+''.
5766 @item Search for all terminal blocks having a one digit designator
5767 such as ``TB1'', ``TB2'', or ``TBx'':
5768 "TB.".
5770 @item Search for all terminal blocks having a two digit designator such as TB21 or TB15:
5771 "TB..".
5773 @end table
5776 @c --------------------------- Appendix -- drill sizes -------------------------------
5777 @node Standard Drill Sizes
5778 @appendix Standard Drill Size Tables
5779 @cindex drill sizes, list of standard
5780 @cindex standard drill sizes
5782 @section American Standard Wire Size Drills
5783 @include wire_size.texi
5785 @section American Standard Letter Size Drills
5786 @include letter_size.texi
5788 @section Fractional Inch Size Drills
5789 @include fractional_size.texi
5791 @section Metric Drills
5792 @include metric_size.texi
5794 @c --------------------------- Appendix -- Centroid File Format ----------------------
5795 @node Centroid File Format
5796 @appendix Centroid (X-Y) File Format
5797 @cindex centroid file format
5798 @cindex x-y file format
5800 @section Overview
5802 @section File Format
5803 The centroid output file is in a standard comma seperated values (CSV)
5804 format.  Comment lines begin with a ``#''.  The output file contains a
5805 header with an RCS Id tag (useful for those who will check the file
5806 into a version control system), a version number for the file format,
5807 some comments containing the author and title of the board, and a
5808 comment describing the remainder of the file format.
5810 An example centroid file is shown below.
5812 @example
5814 # @verb{ $ }Id@verb{ $ }
5815 # PcbXY Version 1.0
5816 # Date: Fri Jul 22 03:40:08 2005 UTC
5817 # Author: PCB User
5818 # Title: MyBoard - PCB X-Y
5819 # RefDes, Description, Value, X, Y, rotation, top/bottom
5820 # X,Y in mils.  rotation in degrees.
5821 # --------------------------------------------
5822 R61,"0603","10",2610.00,3560.00,90,top
5823 J5,"AMPHENOL_ARFX1231","unknown",2390.00,4220.00,180,top
5824 C13,"0402","0.01u",2340.00,3014.00,270,top
5826 @end example
5828 @section Computation of Centroid and Rotation
5829 @cindex centroid file, algorithms
5830 @cindex x-y file, algorithms
5831 The center of each element is found by averaging the (X,Y) coordinates
5832 for the center of each pin and pad in the element.  For example if an
5833 element has 2 pins, 1 at (1,0) and another at (1,4) then the centroid
5834 will be at (1,2).
5836 The calculation of rotation is a bit more complex.  Currently a
5837 rotation is not stored for each element but rather the rotated element
5838 is stored.  In other words if the element from the library has a pin
5839 at (0,0) and (0,2) and it has been rotated by 90 degrees, then the
5840 @file{.pcb} file will store (0,0) and (2,0) for the pin locations with
5841 no indication that they have been rotated from the original.
5843 In the event that the element has only 1 pin, then the rotation is set
5844 to zero.  If the element has only one pad (as opposed to a
5845 through-hole pin), then the rotation of the pad is used.
5847 When the element has multiple pins, the location of pin #1 is placed
5848 in the coordinate system which has the centroid of the part at (0,0).
5849 Then which quadrant pin #1 falls in determines the rotation.  Zero
5850 degrees of rotation is defined as pin #1 being in the upper left
5851 quadrant.  Increasing angles correspond to counterclockwise rotation so a
5852 rotation of 90 degrees places pin #1 in the lower left quadrant.
5853 Currently, the only allowed rotations are 0, 90, 180, and 270 degrees.
5855 If pin #1 happens to be at the centroid of the part, then pin #2 is
5856 examined to see which quadrant it is located in.  The same rules apply
5857 for the definitions of rotation.  In other words, when pin #1 is at
5858 the centroid of the part and pin #2 is in the upper left quadrant, the
5859 rotation is declared to be zero degrees.
5861 @c --------------------------- Appendix -- Actions ----------------------
5862 @node Action Reference
5863 @appendix Action Reference
5864 @cindex action reference
5866 @include actions.texi
5868 @c --------------------------- Appendix -- Glossary ----------------------
5869 @node Glossary
5870 @appendix Glossary
5871 @cindex glossary
5872 @cindex terminology
5873 @cindex index of terms
5875 @table @asis
5877 @item Footprint
5878 The pattern of metal, silkscreen, soldermask relief, and drills which
5879 defines where you place a component on a circuit board.
5880 Footprints are the placed by the user onto the PC board during the
5881 placement phase of PCB layout.
5883 @item Gerber File
5884 The file format used in the industry to convey a board database to the
5885 manufacturer is RS-274X (which replaces the now obsolete RS-274D
5886 format).  This file format was originally developed by Gerber for
5887 their photo plotters and thus RS-274D and RS-274X format files 
5888 are often times refered to as ``Gerber'' files.
5890 @item Thermal, Thermal Relief
5891 A thermal relief is a way of connecting a pin to a ground
5892 or power plane.  Instead of directly connecting to the plane, small "spokes"
5893 are used to increase the thermal resistance between the pin and the plane.
5894 Often times these connections are refered to as simply a thermal.  By increasing
5895 the thermal resistance to the plane, it becomes easier to solder to the
5896 pin.  The drawing below shows an example of a thermal relief.
5898 @center @image{thermal,,,Example of a thermal relief,png}
5900 @end table
5902 @c ---------------------------------------------------------------------
5903 @node Index
5904 @unnumbered Index of Resources
5905 @printindex vr
5907 @unnumbered Index of Actions, Commands and Options
5908 @printindex fn
5910 @unnumbered Index of Concepts
5911 @printindex cp
5913 @contents
5914 @bye