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