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