action.c: UpdatePackage() reloads from disk
[geda-pcb/whiteaudio.git] / doc / pcb.texi
blobf9bd0d37a7a1698615973fb01ad41cd42550a853
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}
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...} pops up a printer control dialog.
788 Several output formats are available from the @samp{Export...} menu item.
789 Presently @emph{PostScript}, @emph{encapsulated PostScript},
790 and @emph{GerberX} are some of the supported filetypes.
791 The @emph{GerberX} driver produces
792 all of the files necessary to have the board professionally manufactured.
793 The connection saving features in the @b{File} menu produce outputs in an
794 arcane format that is not too useful. They do @emph{not} produce netlist
795 files.
797 @cindex Edit, popup menu
798 @cindex undo
799 @cindex redo
800 @item Edit
801 The @b{Edit} menu provides the usual cut, copy, paste
802 which work on selections. To learn how to
803 create complex selections, see @ref{Arrow Tool}.
804 The @b{Edit} menu also
805 provides access to Undo and Redo of the last operation. These
806 can also be accomplished with the @emph{U} key and @emph{Shift-R}
807 key.  Finally, the @b{Edit} menu allows you to change the names
808 of: the layout, the active layer, or text objects on the layout.
810 @cindex Route Styles, popup menu
811 @item Routes Style
812 The @b{Edit} menu allows you to select a group of line thickness, via diameter, via drill
813 size, and clearance (keepaway) (collectively called a "routing style") to be copied to the "active" sizes.
814 You can also change the names given to the routing styles and adjust their values from
815 this menu.  The "active" sizes are also adjustable from this menu.
816 The "active" sizes are shown in the status-line and control the initial size of new vias,
817 drilling holes, lines, clearances, text-objects and also the maximum dimensions of the
818 board layout.
820 @cindex View, popup menu
821 @cindex displaying element names
822 @cindex element, display names of
823 @cindex grid, display
824 @cindex grid, alignment
825 @cindex zoom, setting
826 @item View
827 The @b{View} menu supports most functions related to
828 the whole Layout area. There are various entries to change the grid to some popular
829 values, the zoom factor, and which kind of element name is displayed.
830 You can also re-align the grid origin and turn on and off the display
831 of the grid.
832 Before changing the grid alignment, I recommend that you zoom in as close as
833 possible so that you're sure the grid
834 points appear exactly where you want them.
836 @cindex solder mask, viewing and editing
837 The @b{View} menu also allows you to turn on and off the
838 visibility of the solder-mask layer. When the solder-mask layer
839 is made visible it obscures most of the layout, so only turn
840 this on when you really want to know what the solder-mask will
841 look like. The solder-mask that you see belongs to the
842 side of the board you are viewing, which can be changed with
843 the @samp{Flip up/down} option, also found in the @b{View} menu.
844 When the solder-mask is displayed, the pin and pad clearance adjustments
845 (@pxref{Line Objects}) alter the size of mask cut-outs.
847 @cindex Settings, popup menu
848 @cindex unique names
849 @cindex rubber band
850 @cindex snap to pins
851 @cindex clearance, for new lines
852 @item Settings
853 The @b{Settings} menu controls several operating configuration
854 parameters. The @samp{all-direction lines} entry controls
855 the clipping of lines to 45-degree angles. You can also control
856 whether moving individual objects causes the attached lines to
857 "rubber band" with the move or not from the @b{Settings} menu. Another
858 entry controls whether the starting clip angle for the two-line
859 mode (@pxref{Line Objects}) alternates every other line. You can
860 also control whether element names must be unique from the @b{Settings}
861 menu.  When unique element names are enforced, copying a new element
862 will automatically create a unique @samp{layout-name} name for it
863 provided that the name originally ended with a digit (@emph{e.g.}
864 U7 or R6). The @b{Settings} menu allows you to control
865 whether the cross hair will snap to pins and pads even when they
866 are off-grid. Finally you can control whether new lines and
867 arcs touch or clear intersecting polygons from this menu.
869 @cindex Select, popup menu
870 @cindex selected objects, removing
871 @cindex selected objects, changing sizes
872 @item Select
873 This menu covers most of the operations that work with selected objects.
874 You may either (un)select all visible objects on a layout or only the ones
875 which have been found by the last connection scan see
876 @c DRM: not sure where this was suppose to xfef to.
877 @c @ref{find connections}
879 You can delete all selected objects from this menu.
880 Other entries in the @b{Select} menu change the sizes of selected objects.
881 Note that a select action only affects those objects that are
882 selected @emph{and} have their visibility turned on in the Layer Control
883 panel. The @b{Select} menu also provides a means for selecting objects
884 by name using unix @ref{Regular Expressions}.
886 @cindex Buffer, popup menu
887 @cindex pastebuffer, popup menu
888 @cindex element, editing
889 @item Buffer
890 From the @b{Buffer} menu you may select one out of five
891 buffers to use, rotate or clear its contents or save the buffer contents
892 to a file. You can also use the @samp{break buffer elements to pieces} entry
893 to de-compose an element into pieces for editing.
894 Note: only objects with visibility turned on are pasted to the layout. If
895 you have something in a buffer, then change which side of the board you
896 are viewing, the contents of the buffer will automatically be mirrored
897 for pasting on the side you are viewing. It is not necessary to clear
898 a buffer before cutting or copying something into it - it will automatically
899 be cleared first.
901 @cindex Connects, popup menu
902 @cindex auto-router
903 @cindex design rule checker, invoking
904 @item Connects
905 The entries available through the @b{Connects} menu allow you to find
906 connections from objects and to manipulate these.
907 You can also optimize or erase rat's nests from this menu. Finally,
908 the @samp{auto-route all rats} entry allows you to auto-route
909 all connections show by the rat's nest. The auto-router will use
910 any visible copper layer for routing, so turn off the visibility of any
911 layers you don't want it to use. The auto-router will automatically
912 understand and avoid any traces that are already on the board, but
913 it is not restricted to the grid. Finally,
914 the auto-router routes using the active sizes (except for nets that
915 have a route-style defined). @pcb{} always knows which tracks
916 were routed by the auto-router, and you can selectively remove them
917 without fear of changing tracks that you have manually routed
918 with the @samp{rip-up all auto-routed tracks} entry in the @b{Connects}
919 menu.  The @samp{design rule checker} entry runs a check for copper
920 areas that are too close together, or connections that touch too
921 tenuously for reliable production. The DRC stops when the first
922 problem is encountered so after fixing a problem be sure to
923 run it again until no problems are found.
924 @display
925 @emph{Warning:} @b{COPPER TEXT IS IGNORED BY THE DRC CHECKER}.
926 @end display
928 @cindex Info, popup menu
929 @cindex report
930 @cindex object report
931 @cindex drill report
932 @item Info
933 The @samp{generate object report} entry from the @b{Info} menu
934 provides a way to get detailed information
935 about an object, such as its coordinates, dimensions, etc.
936 You can also get a report summarizing all of the drills
937 used on the board with @samp{generate drill summary}. Lastly,
938 you can get a list of all pins, pads and vias that were
939 found during a connection search.
941 @cindex Window, popup menu
942 @item Window
943 The @b{Window} menu provides a way to bring each of @code{Pcb's}
944 windows to the front. The @emph{Library} window is used to
945 bring elements from the library into the paste-buffer. The
946 @emph{Message Log} window holds the various messages that
947 @pcb{} sends to the user. The @emph{Netlist} window shows
948 the list of connections desired.
950 @end table
952 Now that you're familiar with the various menus, it's time
953 to try some things out. From the @b{File} menu choose
954 @samp{Open...}, navigate to the tutorial folder, then
955 load the file @samp{tut1.pcb}.
958 @node Status-line and Input-field
959 @subsection The Status-line and Input-field
960 @cindex status information
961 @cindex displaying status information
962 @cindex input-field, position of
964 The status-line is located at the bottom edge of the main window.
965 During normal operation the status information is visible there.
966 When a selected menu operation requires an additional button click, the
967 status-line is replaced by a message telling you to position the cursor
968 and click.
969 When a text input is required, the status-line is replaced by the
970 Input-field which has a prompt for typing the input.
972 The status-line shows, from left to right, the side of the board that you
973 are viewing (@emph{Tab} key changes this), the current grid values,
974 if new lines are restricted to 45 degrees,
975 which type of 45 degree line mode is active, whether rubberband move and
976 rotate mode is on (R), and the zoom factor.
977 This information is followed by the active line-width, via-size
978 and drilling hole, keepaway spacing, and text scaling. Last is the active buffer number and the
979 name of the layout. An asterisk appearing at the far left indicates that the
980 layout has been modified since the last save.
981 Note that the name of the layout is not the same
982 thing as the filename of the layout.
983 Change the grid factor to 1.0 mm from the @b{Screen} menu. Observe how the
984 status line shows the new grid setting. Except for the case of the metric
985 grid, all dimensions in the status line are in units of 0.001 inch (1 mil).
987 The input-field pops up (temporarily replacing the status-line) whenever user input
988 is required. Two keys are bound to the input field: the @emph{Escape} key
989 aborts the input, @emph{Return} accepts it. Let's change the name of a component
990 on the board to see how the input-field works. Position the cross hair over
991 R5, and press the @emph{N} key. The input field pops-up showing the name
992 for you to edit. Go ahead and change the name, then hit return. Notice the name
993 of the element changed. Now undo the change by pressing the @emph{U} key. You can
994 position the cross hair over the name, or the element before pressing the
995 @emph{N} key.
997 Now select @samp{realign grid} from the @b{Screen} menu. Notice that the
998 status line has been replaced with an instruction to position the cursor
999 where you want a grid point to fall. In this case, since the cross hair
1000 can only fall on a grid point, you must move the tip of the finger cursor
1001 to the place where you want a grid point to appear. Do not worry that
1002 the cross hair is not coincident with the cursor. Click @emph{Btn1} at
1003 your chosen location. See how the grid has shifted, and the status line
1004 has returned.
1006 The present cross hair position is displayed in the upper right corner of the window.
1007 Normally this position is an absolute coordinate, but you can anchor a marker at
1008 the cross hair location by pressing @emph{Ctrl-M} (try it now) and then the
1009 display will read both the absolute cross hair position as well as the difference
1010 between it and the marker. The numbers enclosed in < > are the X and Y distances
1011 between the cross hair and the mark, while the numbers enclosed in parenthesis
1012 are the distance and angle from the mark to the cross hair. The values displayed
1013 are always in units of 0.001 inch (1 mil).
1014 Pressing @emph{Ctrl-M} again turns the marker off.
1016 @node Layer Controls
1017 @subsection The Layer Controls
1018 @cindex layer controls
1019 @cindex layers, switching on/off
1020 @cindex layers, changing which is active
1021 @cindex change active layer
1023 The layer control panel, located in the upper left, is used to turn on
1024 and off the display of layer groups and to select the active drawing layer.
1025 If a layer hasn't been named, the label "@emph{(unknown)}" is used as the default.
1026 If this happens, it probably means the application resources are not installed
1027 properly.
1029 The upper buttons are used to switch layers on and off. Click
1030 @emph{<Btn1>} on one or more of them. Each click toggles the setting.
1031 If you turn off the currently active layer, another one that is visible
1032 will become active. If there are no others visible, you will not be
1033 able to turn off the active layer.
1034 When the layers are grouped, clicking on these buttons will toggle
1035 the visibility of all layers in the same group. This is a good idea because
1036 layers in the same group reside on the same physical layer of
1037 the actual board. Notice that this example has 2 groups each having
1038 3 layers, plus two other layers named @samp{unused}.
1039 Use the @samp{Edit layer groups} option in the @samp{Settings} menu to
1040 change the layer groupings in the lesstif GUI or the @samp{Preferences}
1041 dialog from the @samp{File} menu in the GTK+ GUI. Note that changing the
1042 groupings can radically alter the connectivity on the board.
1043 Grouping layers is only useful for helping you to color-code
1044 signals in your layout. Note that grouping layers actually reduces the number
1045 of different physical layers available for your board, so to make an eight
1046 layer board, you cannot group any layers.
1048 The @emph{far side} button turns on and off the visibility of elements
1049 (including SMD pads) on the opposite (to the side you're viewing)
1050 board side, as well as silk screening on that side. It does not
1051 hide the x-ray view of the other copper layers, these must be turned off
1052 separately if desired.  Use the @emph{tab} key to view the entire board from the other
1053 side.  To see a view of what the back side of the board will actually look like,
1054 make the solder layer the active layer then press @emph{tab} until the status
1055 line says "solder" on the right, then turn off the visibility of all layers
1056 except solder, pins/pads, vias, and silk. Now turn them all back on.
1058 The lowest button, named @emph{active}, is used to change the active
1059 drawing layer. Pressing @emph{<Btn1>} on it pops up a menu to select which
1060 layer should be active.
1061 Each entry is labeled with the layer's name and drawn in its color.
1062 The active layer is automatically made visible. The active layer is
1063 always drawn on top of the other layers, so the ordering of layers
1064 on the screen does not generally reflect the ordering of the manufactured
1065 board. Only the solder, component, silkscreen, and solder-mask layers
1066 are always drawn in their physical order. Bringing the active layer
1067 to the top makes it easier to select and change objects on the active layer.
1068 Try changing the active layer's name to @emph{ABC} by selecting
1069 @samp{edit name of active layer} from the @samp{Edit} menu.
1070 Changing the active layer can also be done by pressing keys
1071 @emph{1..MAX_LAYER}.
1073 Turn off the visibility of the component layer.
1074 Now make the component layer the active layer. Notice that it
1075 automatically became visible. Try setting a few
1076 other layers as the active layer. You should also experiment
1077 with turning on and off each of the layers to see what happens.
1079 The netlist layer is a special layer for adding connections to
1080 the netlist by drawing rat lines. This is not the recommended
1081 way to add to the netlist, but occasionally may be convenient.
1082 To learn how to use the netlist layer see @ref{Net Objects}.
1085 @node Tool Selectors
1086 @subsection The Tool Selectors
1087 @cindex mode selection
1088 @cindex tool selection
1089 @cindex selecting a new tool
1091 The tool selector buttons reside below the layer controls.
1092 They are used to select which layout tool to use in the drawing
1093 area. Each tool performs its function when @emph{Btn1} is pressed.
1094 Every tool gives the cursor a unique shape that identifies it.
1095 The tool selector buttons themselves are icons that illustrate their function.
1096 Each layout tool can also be selected from the keyboard:
1097 @example
1098     @emph{F1} key       Via tool
1099     @emph{F2} key       Line tool
1100     @emph{F3} key       Arc tool
1101     @emph{F4} key       Text tool
1102     @emph{F5} key       Rectangle tool
1103     @emph{F6} key       Polygon tool
1104     @emph{F7} key       Buffer tool
1105     @emph{F8} key       Delete tool
1106     @emph{F9} key       Rotate tool
1107     @emph{Insert} key   Insert-point tool
1108     @emph{F10} key      Thermal tool
1109     @emph{F11} key      Arrow tool
1110     @emph{F12} key      Lock tool
1111 @end example
1113 Some of the tools are very simple, such as the Via tool.  Clicking
1114 @emph{Btn1} with the Via tool creates a via at the cross hair position.
1115 The via will have the diameter and drill sizes that are active,
1116 as shown in the status line.
1117 The Buffer tool is similar.  With it, @emph{<Btn1>} copies
1118 the contents of the active buffer to the layout, but only
1119 those parts that reside on visible layers are copied.
1120 The Rotate tool allows you to rotate elements, arcs, and text objects
1121 90 degrees counter-clockwise with each click. Holding the @emph{Shift}
1122 key down changes the Rotate tool to clockwise operation.
1123 Anything including groups of objects
1124 can be rotated inside a buffer using the rotate buffer menu option.
1126 The Line tool is explained in detail in @ref{Line Objects}. Go read
1127 that section if you haven't already.
1128 Activate the Line tool. Set the active layer to the solder layer.
1129 Try drawing some lines. Use the @emph{U} key to undo some of the
1130 lines you just created. Zoom in a bit closer with the @emph{Z} key.
1131 Draw some more lines. Be sure to draw some separate lines by starting
1132 a new anchor point with @emph{Ctrl-Btn1}. Change the @samp{crosshair snaps to pin/pads}
1133 behavior in the @b{Settings} menu. Now draw a line. Notice that
1134 the new line points must now always be on a grid point. It might not
1135 be able to reach some pins or pads with this setting. Increase the active line thickness
1136 by pressing the @emph{L} key. Note that the status line updates
1137 to reflect the new active line thickness. Now draw another line. Before completing the
1138 next line, make the component layer active by pressing the @emph{4} key.
1139 Now finish the line. Notice that a via was automatically placed where
1140 you switched layers. @pcb{} does not do any checks to make sure that
1141 the via could safely be placed there. Neither does it interfere with
1142 your desire to place lines haphazardly. It is up to you to place
1143 things properly when doing manual routing with the Line tool.
1145 The Arc tool is explained in detail in @ref{Arc Objects}. Its
1146 use is very similar to the Line tool.
1148 The Rectangle tool, Polygon tool and Thermal tool are explained in detail in
1149 @ref{Polygon Objects}. Go read that section.
1150 Remember that the Thermal tool will only create and destroy thermals
1151 to polygons on the active layer. Use the Rectangle tool to make a
1152 small copper plane on the component layer. Now place a via in the
1153 middle of the plane. Notice that it does not touch the plane, and
1154 they are not electrically connected. Use the Thermal tool to make
1155 the via connect to the plane. Thermals allow the via or pin to
1156 be heated by a soldering iron without having to heat the entire
1157 plane. If solid connections were made to the plane, it could be
1158 nearly impossible to solder. Shift-click on the via with the Thermal
1159 tool to change the style of thermal used or to make the connection
1160 solid.  Click on the via again with the Thermal tool to remove the
1161 connection to the plane.
1163 The Insert-point tool is an editing tool that allows you to add
1164 points into lines and polygons.  The
1165 Insert-point tool enforces the 45 degree line
1166 rule.  You can force only the shorter line segment to 45
1167 degrees by holding the @emph{Shift} key down while inserting the point.
1168 Try adding a point into one of the lines you created. Since line
1169 clipping is turned on, you may need to move the cross hair quite far
1170 from the point where you first clicked on the line. Turn off the
1171 line clipping by selecting @samp{all-direction lines} from the
1172 @b{Settings} menu (or hit
1173 the @emph{Period} key). Now you can place an inserted point anywhere.
1174 Try adding a point to the rectangle you made earlier. Start by clicking
1175 somewhere along an edge of the rectangle, then move the pointer to
1176 a new location and click again.
1178 The delete-mode deletes the object beneath the cursor with each
1179 @emph{Btn1} click.
1180 If you click at an end-point that two lines have in common, it will replace the two lines with a single line
1181 spanning the two remaining points.  This can be used to delete an "inserted"
1182 point in a line, restoring the previous line.  Now delete one of the original corner
1183 points of the polygon you were just playing with. To do this, place the cross hair over the
1184 corner and click on it with the Delete tool. You could also use the @emph{Backspace} key
1185 if some other tool is active. Try deleting some of
1186 the lines and intermediate points that you created earlier. Use undo
1187 repeatedly to undo all the changes that you've made. Use redo
1188 a few times to see what happens. Now add a new line. Notice that
1189 you can no longer use redo since the layout has changed since
1190 the last undo happened. The undo/redo tree is always pruned in this
1191 way (@emph{i.e.} it has a root, but no branches).
1193 The Arrow tool is so important, it has its own section: @ref{Arrow Tool}.
1194 Go read it now.
1196 The Lock tool allows you to lock objects on the layout. When an object
1197 is locked, it can't be selected, moved, rotated, or resized. This is
1198 useful for very large objects like ground planes, or board-outlines that
1199 are defined as an element. With such large objects, nearly anywhere you
1200 click with the Arrow tool will be on the large object, so it could be
1201 hard to draw box selections. If you lock an object, the Arrow tool will
1202 behave as if it didn't exist.  You cannot unlock an object with undo.
1203 You must click on it again with the Lock tool. If an object is locked,
1204 previous changes to it cannot be undone either. When you lock
1205 an object, a report message about it is popped up and will always tell
1206 you what object it is, and that it is locked if you just locked it.
1207 Other than noticing your inability to manipulate something, the only
1208 way to tell an object is locked is with a report from the @b{Info}
1209 menu. Use the Lock tool sparingly.
1212 @node Layout Area
1213 @subsection Layout Area
1214 @cindex grid
1216 The layout area is where you see the layout. The cursor shape depends
1217 on the active tool when the pointer is moved into the layout area.
1218 A cross hair follows the mouse pointer with respect to the grid setting.
1219 Select a new grid from the @emph{Screen} menu.
1220 The new value is updated in the status line.
1221 A different way to change the grid is
1222 @emph{Shift<Key>g} to decrease or @emph{<Key>g} to increase
1223 it, but this only works for English (integer mil) grids.
1224 The grid setting is saved along with the data when you save a pcb layout.
1225 For homemade layouts a value around 50 is a good setting.
1226 The cursor can also be moved in the layout area with the cursor (arrow) keys or, for larger
1227 distances, by pressing the @emph{Shift} modifier together with a cursor key.
1230 @node Log Window
1231 @section Log Window
1232 @cindex log window
1233 @cindex messages
1235 This optional window is used to display all kind of messages including
1236 the ones written to @emph{stderr} by external commands. The main advantage
1237 of using it is
1238 that its contents are saved in a scrolling list until the
1239 program exits. Disabling this feature by setting the resource
1240 @emph{useLogWindow} to @emph{false} will generate popup windows to display
1241 messages. The @emph{stderr} of external commands will appear on @pcb{}s
1242 @emph{stderr} which normally is the parent shell. I suggest you iconify
1243 the log window after startup for example by setting @emph{*log.iconic} to
1244 @emph{true} in the resource file. If @emph{raiseLogWindow} is set @emph{true},
1245 the window will deiconify and raise itself whenever new messages are to be
1246 displayed.
1249 @node Library Window
1250 @section Library Window
1251 @cindex library window
1253 The library window makes loading elements (or even partial layouts) easy.
1254 Just click the appropriate library from the list on the left. A list
1255 of its elements then appears on the right. Select an element
1256 from the list by clicking on its description. Selecting an element from the
1257 library will also automatically copy the element into
1258 the active buffer, then invoke the @emph{Buffer} tool so
1259 you can paste it to the layout. Elements in the old library should be
1260 taken with a grain of salt (@emph{i.e.} check them carefully before
1261 using).  The old library names all begin with ~ so you can easily distinguish between
1262 the old and new libraries.  All of the elements in the new library
1263 should  be thoroughly vetted, so you
1264 can use them with confidence. The new libraries are stored simply
1265 as directories full of element files, so making additions to the
1266 new library is easy since there is no need to learn @code{m4}.
1267 For details on the old libraries,
1268 check-out @ref{Library File} and @ref{Library Contents File}. For
1269 details on the format of an element file used for the new libraries,
1270 see @ref{Element File}.
1273 @node Netlist Window
1274 @section Netlist Window
1275 @cindex Netlist Window
1277 The netlist window is very similar to the library window. On the left
1278 is a list of all of the nets, on the right is the list of connections
1279 belonging to the chosen net. The chosen net is highlighted in the
1280 list and also shown on the second line of the window in red. If the
1281 net name has a star to the left of it then it is "disabled". A disabled
1282 net is treated as if it were not in the net list. This is useful, for
1283 example, if you plan to use a ground plane and don't want the ground
1284 net showing up in the rat's nest. You can enable/disable individual
1285 nets by double-clicking the net name. If you want to enable or disable
1286 all nets at once, there are two buttons at the top of the netlist
1287 window for this purpose.
1289 The button labeled @samp{Sel Net On Layout}
1290 can be used to select (on the layout) everything that is connected
1291 (or is supposed to be connected) to the net. If you click on a
1292 connection in the connection list, it will select/deselect
1293 the corresponding pin or pad in the layout and also center the layout
1294 window where it is located. If you "Find" (@samp{lookup connection} in the @b{Connects} menu [also @emph{F} key]), a pin
1295 or pad it will also choose the net and connection in the netlist window
1296 if it exists in the netlist.
1298 If no netlist exists for the layout, then the netlist window does not
1299 appear. You can load a netlist from a file from the @b{File} menu. The
1300 format for netlist files is described in @ref{Netlist File}.
1303 @node Drawing and Removing
1304 @section Drawing and Removing Basic Objects
1305 @cindex drawing objects
1306 @cindex removing objects
1307 @cindex erasing objects
1308 @cindex object, drawing and removing
1310 hace begging gutting here, and do a real-world tutorial example.
1312 There are several ways of creating new objects: you can draw them yourself,
1313 you can copy an existing object (or selection), or you can load an element from a file or
1314 from the Library window. Each type of object has a particular tool for creating it.
1316 The active tool can be selected from the tool selectors in the bottom
1317 left corner or by one of the function keys listed earlier in this chapter.
1318 Each @emph{<Btn1>} press with the tool tells the application to create
1319 or change the appropriate object or at least take
1320 the first step to do so. Each tools causes the cursor to take
1321 on a unique shape and also causes the corresponding
1322 tool selector button to be highlighted. You can use either cue
1323 to see which tool is active.
1325 Insert mode provides the capability of inserting new points into existing
1326 polygons or lines. The 45 degree line clipping is now enforced when selected.
1327 Press and hold the shift key while positioning the new point to only clip
1328 the line segment to the nearer of the two existing points to 45 degrees.
1329 You can also toggle the 45-degree clipping in the middle of a point
1330 insertion by pressing the @emph{<Key>.}
1331 If the shift key is not depressed and the 45 degree line clipping mode
1332 is on, both new line segments must be on 45 degree angles - greatly
1333 restricting where the new point may be placed. In some cases this can cause
1334 confusion as to whether an insertion has been started since the two new
1335 lines may be forced to lie parallel on top of the original line until the
1336 pointer is moved far from the end points.
1338 Removing objects, changing their size or moving them only applies to objects
1339 that are visible when the command is executed.
1341 @menu
1342 * Common::           Keystrokes common to some objects.
1343 * Lines::
1344 * Arcs::
1345 * Polygons::         Drawing polygons and rectangles.
1346 * Text::
1347 * Vias::
1348 * Elements::
1349 * Pastebuffer::      A multi-purpose buffer.
1350 @end menu
1352 @node Common
1353 @subsection Common Drawing and Removing Methods
1354 @cindex creating objects
1355 @cindex object, creating an
1356 @cindex removing objects
1357 @cindex object, removing an
1358 @cindex thickness of objects
1359 @cindex object, changing the size of an
1361 There are several keystrokes and button events referring to an @emph{object}
1362 without identifying its type. Here's a list of them:
1364 @emph{<Btn1>} creates (or deletes)  an object depending on the
1365 current mode.
1367 @emph{<Key>BackSpace} or @emph{<Key>Delete} removes the visible
1368 object at the cursor location. When more than one object exists at the
1369 location, the order of removal is: via, line, text, polygon and
1370 element. The drawn layer order also affects the search - whatever is
1371 top - most (except elements) is affected before lower items.  Basically
1372 all this means that what is removed is probably just what you expect.
1373 If for some reason it isn't, undo and try again.
1374 Only one object is removed for each keystroke. If two or more
1375 of the same type match, the newest one is removed.
1377 Use @emph{<Key>s} and @emph{Shift<Key>s} to change the size (width)
1378 of lines, arcs, text objects, pins, pads and vias, or to toggle the style
1379 of polygons (whether pins and vias automatically have clearances).
1381 @emph{<Key>n} changes the name of pins, pads, vias, the
1382 string of a text object, or the currently displayed label of an element.
1384 @emph{<Key>m} moves the line, arc, or polygon under the cross hair to the
1385 active layer if it wasn't on that layer already.
1387 @emph{<Key>u} (undo) recovers from an unlimited number of operations
1388 such as creating, removing, moving, copying, selecting etc. It works like
1389 you'd expect even if you're in the midst of creating something.
1391 @emph{Shift<Key>r} restores the last undone operation provided no other
1392 changes have been made since the undo was performed.
1394 @emph{<Key>tab} changes the board side you are viewing.
1396 For a complete list of keystrokes and button events see @ref{Translations}.
1399 @node Lines
1400 @subsection Lines
1401 @cindex lines, an example
1402 @cindex example of line handling
1404 To draw new lines you have to be in @emph{line-mode}. Get there either by
1405 selecting it from the @emph{Tool palette} or by pressing @emph{<Key>F2}.
1406 Each successive @emph{notify} event creates a new line. The
1407 adjustment to 45 degree lines is done automatically if it is selected from the
1408 @emph{Display} menu. You can toggle the 45 degree mode setting by
1409 pressing the @emph{<Key>.} (That is the period key). When 45 degree enforcement
1410 is turned on there are three distinct modes of line creation: a single
1411 line on the closest 45 degree vector towards the cross hair (but not necessarily
1412 actually ending at the cross hair), two lines created such that the first leaves
1413 the start point on a 90 degree vector and the second arrives at the cross hair
1414 on a 45 degree vector, and finally two lines created such that the first leaves
1415 the start point on a 45 degree vector and the second arrives at the cross hair
1416 on a 90 degree vector.  These last two modes always connect all the way from
1417 the start and end points, and all lines have angles in 45 degree multiples.
1418 The @emph{<Key>/} cycles through the three modes.  The status line shows a
1419 text icon to indicate which of the modes is active and the lines following
1420 the cross hair motion show the outline of the line(s) that will actually be created.
1421 Press @emph{<Key>Escape} to leave line-mode.
1423 @emph{<Key>l}, @emph{Shift<Key>l} and the entries in the
1424 @emph{Sizes} menu change the initial width of new lines.  This width is also
1425 displayed in the status line.
1428 @node Arcs
1429 @subsection Arcs
1430 @cindex arc, an example
1432 An Arc is drawn  with the @emph{arc-tool}. Get there either by selecting it
1433 from the @emph{Tool palette} or by pressing @emph{<Key>F8}. Press @emph{Btn1} to
1434 define the starting point for the arc.  Drag the mouse towards the desired
1435 end point along the path you want the arc to follow.  The outline of the arc that
1436 will be created is shown on the screen as you move the mouse.  Arcs are always
1437 forced to be 90 degrees and have symmetrical length and width ( i.e. they are
1438 a quarter circle).  The next @emph{Btn1} click creates the arc.  It will have
1439 the same width as new lines (displayed in the status line) and appear on the
1440 active layer. The arc leaves the starting point towards the cross hair along
1441 the axis whose distance from the cross hair is largest.  Normally this means that
1442 if you drag along the path you want the arc to follow, you'll get what you
1443 want.  If the grid is set to the arc radius, then the two distances will be
1444 equal and you won't be able to get all of the possible directions.  If this
1445 is thwarting your desires, reduce the grid spacing (@emph{!Shift<Key>G}) and
1446 try again.
1449 @node Polygons
1450 @subsection Polygons and Rectangles
1451 @cindex polygon, an example
1452 @cindex example of polygon handling
1453 @cindex rectangle, an example
1454 @cindex example of rectangle handling
1456 A polygon is drawn by defining all of its segments as a series of
1457 consecutive line segments. If the first point matches a new one and if
1458 the number of points is greater than two, then the polygon is closed.
1459 Since matching up with the first point may be difficult, you may use
1460 @emph{Shift<Key>p} to close the polygon. The @emph{Shift<Key>p} won't
1461 work if clipping to 45 degree lines is selected
1462 and the final segment cannot match this condition.
1463 I suggest you create simple convex polygons in order to avoid a strong
1464 negative impact on the performance of the connection scanning routines.
1465 The @emph{rectangle-mode} is just an easy way to generate rectangular polygons.
1466 @emph{Polygon-mode} also is selected by @emph{<Key>F6} whereas
1467 @emph{rectangle-mode} uses @emph{<Key>F4}.
1468 Pressing a @emph{<Btn1>} at two locations creates a rectangle by
1469 defining two of its corners.
1470 @emph{<Key>Insert} brings you to @emph{insert-point-mode} which lets you
1471 add additional points to an already existing polygon.
1472 Single points may be removed by moving the cross hair to them and selecting
1473 one of the delete actions @emph{(remove-mode, BackSpace, or Delete}. This only works
1474 if the remaining polygon will still have three or more corners.
1475 Pressing @emph{<Key>u}  or @emph{<Key>p} while entering a new polygon
1476 brings you back to the previous corner. Removing a point does not
1477 force clipping to 45 degree angles (because it's not generally possible).
1478 Newly created polygons will not connect to pins or vias
1479 that pierce it unless you create a thermal (using the thermal mode) to make
1480 the connection. If the edge of a polygon gets too close to a pin or via that
1481 lies outside of it, a warning will be issued and the pin will be given a
1482 special color. Increasing the distance between them will remove the warning
1483 color.
1486 @node Text
1487 @subsection Text
1488 @cindex text, an example
1489 @cindex strings, an example
1490 @cindex example of text handling
1492 Pressing @emph{<Key>F5} or clicking one of the text selector buttons
1493 changes to @emph{text-mode}.
1494 Each successive notify event (@emph{<Btn1>})
1495 pops up the input line at the bottom and queries for a string.
1496 Enter it and press @emph{<Key>Return} to confirm or
1497 @emph{<Key>Escape} to abort.
1498 The text object is created with its upper left corner at the current pointer
1499 location.
1500 The initial scaling is changed by @emph{<Key>t} and
1501 @emph{Shift<Key>t} or from the @emph{Sizes} menu.
1503 Now switch to @emph{rotate-mode} and press
1504 @emph{<Btn1>} at the text-objects location. Text objects
1505 on the solder side of the layout are automatically mirrored and
1506 flipped so that they are seen correctly when viewing the solder-side.
1508 Use @emph{<Key>n} to edit the string.
1510 @b{TEXT OBJECTS ON COPPER LAYERS CREATE COPPER LINES BUT THEY ARE NOT SCANNED FOR
1511 CONNECTIONS}. If they are moved to the silkscreen layer, they
1512 no longer create copper.
1515 @node Vias
1516 @subsection Vias
1517 @cindex vias, an example
1518 @cindex example of via handling
1520 The initial size of new vias may be changed by @emph{<Key>v} and
1521 @emph{Shift<Key>v} or by selecting the appropriate entry from the
1522 @emph{Sizes} menu. @emph{Mod1<Key>v} and @emph{Mod1 Shift<Key>v} do
1523 the same for the drilling hole of the via.
1524 The statusline is updated with the new values.
1525 Creating a via is similar to the other objects. Switch to @emph{via-mode}
1526 by using either the selector button or @emph{<Key>F1} then press
1527 @emph{<Key>]} or @emph{<Btn1>} to create one.
1528 @emph{<Key>n} changes the name of a via. If you want to create a mounting
1529 hole for your board, then you can place a via where you want the hole to
1530 be then convert the via into a hole.  The conversion is done by pressing
1531 @emph{!Ctrl<Key>h} with the cross hair over the via.  Conceptually it is
1532 still a via, but it has no copper annulus.  If you create such a hole in
1533 the middle of two polygons on different layers, it will short the layers.
1534 Theoretically you could arrange for such a hole not to be plated, but a
1535 metal screw inserted in the hole would still risk shorting the layers.
1536 A good rule is to realize that holes in the board really are vias between
1537 the layers and so place them where they won't interfere with connectivity.
1538 You can convert a hole back into a normal via with the same keystroke used
1539 to convert it in the first place.
1541 @node Elements
1542 @subsection Elements
1543 @cindex element, an example
1544 @cindex example of element handling
1546 Some of the functions related to elements only work if both the package
1547 layer and the pin layer are switched on.
1549 Now that you're familiar with many of the basic commands, it is
1550 time to put the first element on the layout.
1551 First of all, you have to load data into the paste buffer.
1552 There are four ways to do this:
1553 @example
1554    1) load the data from a library
1555    2) load the data from a file
1556    3) copy data from an already existing element
1557    4) convert objects in the buffer into an element
1558 @end example
1559 We don't have any elements on the screen yet nor anything in the
1560 buffer, so we use number one.
1562 @cindex example files
1563 @cindex m4, preprocessing example files
1564 Select @emph{lsi} from the menu in the library window press
1565 @emph{<Btn1>} twice at the appropriate text-line to get
1566 the MC68030 CPU.
1567 The data is loaded and the mode is switched to @emph{pastebuffer-mode}.
1568 Each notify event now creates one of these beasts. Leave the mode
1569 by selecting a different one or by @emph{<Key>Escape} which resets
1570 all modes..
1571 The cross hair is located at the @emph{mark} position as defined by
1572 the data file. Rotating the buffer contents is done by selecting
1573 the @emph{rotate} entry of the @emph{Buffer} menu or by pressing
1574 @emph{Shift<Key>F3}. The contents of the buffer
1575 are valid until new data is loaded into it either by a cut-to-buffer
1576 operation, copy-to-buffer operation or by loading a new data file.
1577 There are 5 buffers
1578 available  (possibly more or less if changed at compile time
1579 with the @code{MAX_BUFFER} variable in @file{globalconfig.h}).
1580 Switching between them is done by selecting a menu entry or
1581 by @emph{Shift<Key>1..MAX_BUFFER}.
1582 Each of the two board sides has its own buffers.
1584 The release includes all data files for the circuits that are used
1585 by the demo layout. The elements in the LED example are not found in the library,
1586 but you can lift them from the example itself if you want.
1587 If you have problems with the color of the cross hair, change the resource
1588 @emph{cross hairColor} setting to a different one.
1590 @cindex example of loading an element file
1591 @cindex pins, an example
1592 @cindex example of pin handling
1593 Now load a second circuit, the MC68882 FPU for example.
1594 Create the circuit as explained above. You now have two different unnamed
1595 elements. Unnamed means that the layout-name of the element
1596 hasn't been set yet. Selecting @emph{description} from the @emph{Display}
1597 menu displays the description string of the two circuits which
1598 are CPU and FPU. The values of the circuits are set to MC68030 and MC68882.
1599 Each of the names of an element may be changed
1600 by @emph{<Key>n} at the elements location and editing the old name in
1601 the bottom input line. Naming pins and vias is similar to elements.
1602 You can hide the element name so that it won't appear on the board
1603 silkscreen by pressing @emph{<key>h} with the cursor over the element.
1604 Doing so again un-hides the element name.
1606 Entering @kbd{:le} and selecting an element data file is
1607 the second way to load circuits.
1609 The third way to create a new element is to copy an existing one.
1610 Please refer to @ref{Moving and Copying}.
1612 @cindex example of creating an element
1613 @cindex element, creating a new package
1614 @cindex pastebuffer, convert contents to element
1615 @cindex buffer, convert contents to element
1616 The fourth way to create a new element is to convert a buffer's contents
1617 into an element.  Here's how it's done: Select the Via-tool from the
1618 @emph{Tool pallet}.  Set the grid spacing to something appropriate for
1619 the element pin spacing.  Now create a series of vias where the pins
1620 go.  Create them in pin number order. It is often handy to place a reference
1621 point (@emph{!Ctrl<Key>m}) in the center of the first pin in order to measure
1622 the location of the other pins.  Next make a solder-side layer the active
1623 layer from the @emph{active-layer} popup menu.  Now draw the outline of
1624 the element using lines and arcs.  When you're done, select everything that
1625 makes up the element with a box selection (@emph{<Btn3Down> drag,
1626 <Btn3Up>}). Now select "cut to buffer" from the @emph{Buffer}
1627 menu. Position the cursor over the center of pin 1 and press the left
1628 button to load the data into the buffer.
1629 Finally select "convert buffer to element" from the @emph{Buffer} menu.
1630 You'll only want to create elements this way if they aren't already in the
1631 library.  It's also probably a good idea to do this before starting any of
1632 the other aspects of a layout, but it isn't necessary.
1634 To display the pinout of a circuit move to it and press @emph{Shift<Key>d}
1635 or select @emph{show pinout} from the @emph{Objects} menu. A new window
1636 pops up and displays the complete pinout of the element. This display can
1637 be difficult to read if the component has been rotated 90 degrees :-(
1638 therefore, the new window will show an un-rotated view so the pin names
1639 are readable.
1640 @emph{<Key>d} displays the name of one or all pins/pads inside the
1641 Layout area, this is only for display on-screen, it has no effect on any
1642 printing of the layout.
1644 You also may want to change a pin's or pad's current size by pressing
1645 @emph{<Key>s} to increase or @emph{Shift<Key>s} to decrease it. While
1646 this is possible, it is not recommended since care was probably taken
1647 to define the element structure in the first place. You can also change the thickness
1648 of the element's silkscreen outline with the same keys. You can
1649 change whether a pin or SMD pad is rounded or square with the @emph{<Key>q}.
1650 SMD pads should usually have squared ends. Finally, you can change whether
1651 the non-square pins are round or octagonal with the @emph{!Ctrl<Key>o}.
1653 SMD elements and silkscreen objects are drawn in the "invisible object"
1654 color if they are located on the opposite side of the board.
1656 For information on element connections refer to @ref{Connection Lists}.
1659 @node Pastebuffer
1660 @subsection Pastebuffer
1661 @cindex pastebuffer, an example
1662 @cindex example of pastebuffer handling
1663 @cindex buffer, an example
1664 @cindex example of buffer handling
1666 The line-stack and element-buffer of former releases have been replaced
1667 by 5 (possibly more or less if changed at compile time
1668 with the @code{MAX_BUFFER} variable in @file{globalconfig.h})
1669 multi-purpose buffers that are selected by
1670 @emph{Shift<Key>1..MAX_BUFFER}. The status line shows which buffer is
1671 the active one.
1672 You may load data from a file or layout into them.
1673 Cut-and-paste works too.
1674 If you followed the instructions earlier in this chapter you should
1675 now have several objects on the screen. Move the cross hair to one of them
1676 and press @emph{<Btn3Down>} to toggle its selection flag. (If you drag the
1677 mouse while the button is down, a box selection will be attempted instead
1678 of toggling the selection.)  The object
1679 is redrawn in a different color. You also may want to try
1680 moving the pointer while holding the third button down and
1681 release it on a different location. This selects all objects inside the
1682 rectangle and unselects everything else.  If you want to add a box selection
1683 to an existing selection, drag with @emph{Mod1<Btn3Down>} instead.
1684 Dragging @emph{Shift Mod1<Btn3Down>} unselects objects in a box.
1685 Now change to @emph{pastebuffer-mode} and select some operations from the
1686 @emph{Buffer} menu. Copying objects to the buffer is available as
1687 @emph{Mod1<Key>c} while cutting them uses @emph{Mod1<Key>x} as
1688 shortcut. Both clear the buffer before new data is added.
1689 If you use the menu entries, you have to supply a cross hair position by
1690 pressing a mouse button. The objects are attached to the pastebuffer
1691 relative to that cross hair location.
1692 Element data or PCB data may be merged into an existing layout by loading
1693 the datafiles into the pastebuffer. Both operations are available from
1694 the @emph{File} menu or as user commands.
1696 @node Moving and Copying
1697 @section Moving and Copying
1698 @cindex moving, an example
1699 @cindex copying, an example
1700 @cindex example of moving
1701 @cindex example of copying
1703 All objects can be moved including element-names, by
1704 @emph{<Btn2Down>}, dragging the pointer while holding the button down
1705 and releasing it at the new location of the object. If you use
1706 @emph{Mod1<Btn2Down>} instead, the object is copied. Copying does not work for
1707 element-names of course. You can move all selected objects with
1708 @emph{Shift <Btn1>}.  This uses the Pastebuffer, so
1709 it will remove whatever was previously in the Pastebuffer.
1710 Please refer to @ref{Pastebuffer}.
1711 If you want to give a small nudge to an object, but you don't think
1712 that the mouse will give you the fine level of control that you want,
1713 you can position the cursor over the object, press @emph{<Key>[},
1714 move it with the arrow keys, then press @emph{<Key>]} when it's at the
1715 desired position.  Remember that all movements are forced onto grid coordinates, so
1716 you may want to change the grid spacing first.
1718 @cindex moving, traces to a different layer
1719 @cindex changing layers
1720 To move a trace or group of traces to a different layer, first select
1721 the tracks to be moved.  It's easiest to do this if you shut off everything
1722 but that layer first (i.e. silk, pins, other layers, etc).
1723 Now set the current layer to be the new layer.  
1724 Press Shift-M to move all the selected tracks to the current layer.
1725 See the @emph{MoveToCurrentLayer} action for more details.
1727 @node Loading and Saving
1728 @section Loading and Saving
1729 @cindex loading, an example
1730 @cindex saving, an example
1731 @cindex example of saving
1732 @cindex example of loading
1734 After your first experience with @pcb{} you will probably want to save
1735 your work. @kbd{:s name} passes the data to an external program which
1736 is responsible for saving it. For details see @emph{saveCommand} in
1737 @ref{Resources}.
1738 Saving also is available from the @emph{File} menu, either with or
1739 without supplying a filename. @pcb{} reuses the last
1740 filename if you do not pass a new one to the save routine.
1742 To load an existing layout either select @emph{Open...} from the
1743 @emph{File} menu or use @kbd{:l filename}. A file select box pops up if you
1744 don't specify a filename. Merging existing layouts into the new one is
1745 supported either by the @emph{File} menu or by @kbd{:m filename}.
1747 @cindex backup
1748 @cindex saving layouts
1749 @cindex preventing loss of data
1750 @cindex /tmp
1751 @cindex directory /tmp
1752 @cindex temporary files
1753 @pcb{} saves a backup of the current layout at a user specified interval.
1754 The backup filename is created by appending a dash, "-", to the @file{.pcb} filename.
1755 For example, if you are editing the layout in @file{projects/board.pcb} then the
1756 backup file name will be @file{projects/board.pcb-}.  If the layout is new and
1757 has not been saved yet, then the backup file name is @file{PCB.####.backup} where the "####"
1758 will be replaced by the process ID of the currenting running copy of @pcb{}.
1759 This default backup file name may be changed at compilation time via the
1760 @code{BACKUP_NAME}
1761 variable in @file{globalconfig.h}).  During critical
1762 sections of the program or when data would be lost it is saved as
1763 @file{PCB.%i.save}.  This file name may be changed at compile time
1764 with the @code{SAVE_NAME} variable in @file{globalconfig.h}.
1767 @node Printing
1768 @section Printing
1769 @cindex printing, an example
1770 @cindex example of printing
1772 @pcb{} now has support for device drivers,
1773 @code{PostScript}, @emph{encapsulated PostScript},
1774 and @emph{Gerber RS-274X} drivers are
1775 available so far.  The @emph{Gerber RS-274X}
1776 driver additionally generates a numerical control (NC) drill file for
1777 automated drilling,
1778 a bill of materials file to assist in materials procurement and
1779 inventory control, and a centroid (X-Y) file which includes the
1780 centroid data needed
1781 by automatic assembly (pick and place) machines.
1782  I recommend the use of @code{GhostScript} if you
1783 don't have a @code{PostScript} printer for handling the PostScript
1784 output. Printing always generates
1785 a complete set of files for a specified driver.
1786 See the page about
1787 the @emph{Print()} action for additional information about the filenames.
1788 The control panel offers a number of options. Most of them are not available
1789 for Gerber output because it wouldn't make sense, for example,  to scale the gerber output
1790 (you'd get an incorrectly made board!)  The options are:
1792 @table @samp
1793 @cindex device, selecting an output
1794 @cindex output device
1795 @item device
1796 The top menu button selects from the available device drivers.
1798 @cindex rotating printout
1799 @item rotate
1800 Rotate layout 90 degrees counter-clockwise before printing (default).
1802 @cindex mirroring printout
1803 @item mirror
1804 Mirror layout before printing. Use this option depending
1805 on your production line.
1807 @cindex color printout
1808 @item color
1809 Created colored output. All colors will be converted to black if this option
1810 is inactive.
1812 @cindex outline printout
1813 @item outline
1814 Add a board outline to the output file. The size is determined by the
1815 maximum board size changeable from the @emph{sizes} menu. The outline appears
1816 on the top and bottom sides of the board, but not on the internal layers.
1817 An outline can be useful for determining where to shear the board from the
1818 panel, but be aware that it creates a copper line.  Thus it has the potential
1819 to cause short circuits if you don't leave enough room from your wiring
1820 to the board edge.  Use a viewer to see what the output outline looks like
1821 if you want to know what it looks like.
1823 @cindex alignment targets
1824 @item alignment
1825 Additional alignment targets are added to the output. The distances between
1826 the board outline is set by the resource @emph{alignmentDistance}.  Alignment
1827 targets should only be used if you know for certain that YOU WILL BE USING
1828 THEM YOURSELF.  It is extremely unlikely that you will want to have alignment
1829 targets if you send gerber files to a commercial pcb manufacture to be made.
1831 @cindex scaling a printout
1832 @item scaling
1833 It's quite useful to enlarge your printout for checking the layout.
1834 Use the scrollbar to adjust the scaling factor to your needs.
1836 @cindex print media
1837 @cindex media, size of
1838 @item media
1839 Select the size of the output media from this menu. The user defined size
1840 may be set by the resource @emph{media} either from one of the well known
1841 paper sizes or by a @code{X11} geometry specification.
1842 This entry is only available if you use @code{X11R5} or later.
1843 For earlier releases the user defined size or, if not available, @emph{A4}
1844 is used.
1845 Well known size are:
1846 @display
1847         A3
1848         A4
1849         A5
1850         letter
1851         tabloid
1852         ledger
1853         legal
1854         executive
1855 @end display
1857 @cindex offset of printout
1858 @cindex print offset
1859 @item offset
1860 Adjust the offsets of the printout by using the panner at the right side
1861 of the dialog box.
1862 This entry is only available if you use @code{X11R5} or later. A zero
1863 offset is used for earlier releases.
1865 @cindex DOS filenames
1866 @item 8.3 filenames
1867 Select this button to generate DOS compatible filenames for the output files.
1868 The @emph{command} input area will disappear if selected.
1870 @cindex print command
1871 @item commandline
1872 Use this line to enter a command (starts with @kbd{|}) or a filename.
1873 A %f is replaced by the current filename.
1874 The default is set by the resource @emph{printCommand}.
1876 @end table
1878 The created file includes some labels which are guaranteed to stay unchanged
1879 @table @samp
1880 @item PCBMIN
1881 identifies the lowest x and y coordinates in mil.
1883 @item PCBMAX
1884 identifies the highest x and y coordinates in mil.
1886 @item PCBOFFSET
1887 is set to the x and y offset in mil.
1889 @item PCBSCALE
1890 is a floating point value which identifies the scaling factor.
1892 @item PCBSTARTDATA
1893 @itemx PCBENDDATA
1894 all layout data is included between these two marks. You may use them with an
1895 @code{awk} script to produce several printouts on one piece of paper by
1896 duplicating the code and putting some @code{translate} commands in front.
1897 Note, the normal @code{PostScript} units are 1/72 inch.
1898 @end table
1900 @node Exporting
1901 @section Exporting a layout
1902 @cindex Exporting a layout
1903 @vindex Exporting a layout
1905 To export a layout choose @emph{Export layout} from the @emph{File} menu, then
1906 select the desired exporter.
1908 @menu
1909 * bom::                Bill of materials.
1910 * gcode::              G-code.
1911 * gerber::             Gerber.
1912 * nelma::              Nelma.
1913 * png::                Image.
1914 * ps::                 Postscript.
1915 * eps::                Eps.
1916 @end menu
1918 @node bom
1919 @subsection Bill of materials (bom)
1920 @cindex bom
1921 @cindex bill of materials
1923 Produces a bill of materials (BOM) file and a centroid (XY) file.
1925 @node gcode
1926 @subsection G-code (gcode)
1927 @cindex gcode
1928 @cindex g-code
1929 @cindex cnc
1931 The gcode exporter can generate RS274/NGC G-CODE files to be used with a CNC mill to
1932 produce pcb's by mechanically removing copper from the perimeter of all elements.
1934 The elements are enlarged in order to compensate for the cutting tool size so
1935 that the remaining copper corresponds to the original size; however all
1936 polygons are left unchanged and will end up being a little smaller; this is not a
1937 problem because the electrical connection is done with traces, which are correctly
1938 enlarged.
1940 A .cnc file is generated for every copper layer, with the bottom layer mirrored so
1941 that the milling is done right; of course it's not possible to produce directly
1942 multi-layer (more than 2) pcb's with this method, but the cnc files for
1943 intermediate layers are generated anyways.
1945 A drill file is also generated, and it contains all drills regardless of the hole
1946 size; the drilling sequence is optimized in order to require the least amount of
1947 movement.
1949 The export function generates an intermediate raster image before extracting the contour
1950 of copper elements, and this image is saved as well (in .png format) for inspection.
1952 When the spacing between two elements is less than the tool diameter they will merge
1953 and no isolation will be cut between them; the control image should be checked for
1954 this behaviour.
1956 Possible workarounds are: increasing spacing, decreasing the tool size, increasing
1957 the intermediate image resolution.
1959 To maximize the chance of producing correct pcb's it would be better to increase
1960 the DRC clearance to at least the tool diameter and use traces as thick as possible;
1961 the rule is: use the largest element that will not prevent the isolation cut.
1963 The exporter parameters are:
1965 @table @b
1966 @item basename
1967 base name for generated files
1969 @item dpi
1970 intermediate image resolution; affects precision when extracting contours
1972 @item mill depth
1973 should be the copper depth
1975 @item safe z
1976 Z value when moving between polygons
1978 @item tool radius
1979 copper elements are enlarged by this amount
1981 @item drill depth
1982 depth of drills
1984 @item measurement unit
1985 for all parameters above, can be mm,um,inch,mil; g-code is always mm or inch
1986 @end table
1988 All .cnc files specify Z values as parameters, so that it's easy to
1989 change them without the need to run the exporter again.
1991 Operation was verified with the EMC2 g-code interpreter.
1993 Following is a sample layout that is converted with default settings:
1994 @center @image{gcode,,,Sample Layout,png}
1996 The control image shows that the spacing is sufficient:
1997 @center @image{gcode_control_img,,,Control Image,png}
1999 The final tool path follows the perimeter of all elements:
2000 @center @image{gcode_tool_path,,,Resulting Tool Path,png}
2002 @node gerber
2003 @subsection Gerber (gerber)
2004 @cindex gerber
2006 Produces RS274-X (a.k.a. gerber) photo plot files and Excellon drill files.
2008 @node nelma
2009 @subsection Nelma (nelma)
2010 @cindex nelma
2012 Numerical analysis package export.
2014 @node png
2015 @subsection Image (png)
2016 @cindex png
2017 @cindex image export
2019 Produces GIF/JPEG/PNG image files.
2021 @node ps
2022 @subsection Postscript (ps)
2023 @cindex ps
2024 @cindex postscript
2026 Export as postscript.
2027 Can be later converted to pdf.
2029 @node eps
2030 @subsection Encapsulated Postscript (eps)
2031 @cindex eps
2032 @cindex encapsulated postscript
2034 Export as eps (encapsulated postscript) for inclusion in other documents.
2035 Can be later converted to pdf.
2038 @node Connection Lists
2039 @section Connection Lists
2040 @cindex example of connection lists
2041 @cindex connections, creating list of
2043 After completing parts of your layout you may want to check if all drawn
2044 connections match the ones you have in mind. This is probably best done
2045 in conjunction with a net-list file: see @ref{Rats Nest}.
2046 The following examples give more rudimentary ways to examine
2047 the connections.
2048 @example
2049     1) create at least two elements and name them
2050     2) create some connections between their pins
2051     3) optionally add some vias and connections to them
2052 @end example
2054 Now select @emph{lookup connection} from the @emph{Connections} menu,
2055 move the cursor to a pin or via and press any mouse button. @pcb{}
2056 will look for all other pins and/or vias connected to the one you have
2057 selected and display the objects in a different color.
2058 Now try some of the reset options available from the same menu.
2060 There also is a way to scan all connections of one element. Select
2061 @emph{a single element} from the menu and press any button at the
2062 element's location. All connections of this element will be saved
2063 to the specified file.
2064 Either the layout name of the element or its canonical name is used to
2065 identify pins depending on the one which is displayed on the screen
2066 (may be changed by @emph{Display} menu).
2068 An automatic scan of all elements is initiated by choosing
2069 @emph{all elements}. It behaves in a similar fashion to scanning a single
2070 element except the resource @emph{resetAfterElement}
2071 is used to determine if connections should be reset before a new element is
2072 scanned. Doing so will produce very long lists because the power lines are
2073 rescanned for every element. By default the resource is set to @emph{false}
2074 for this reason.
2076 To scan for unconnected pins select @emph{unused pins} from the same
2077 menu.
2080 @node Arrow Tool
2081 @section Arrow Tool
2082 @cindex selecting, using the arrow tool
2083 @cindex moving objects
2084 @cindex arrow tool
2085 @cindex tool, arrow
2087 Some commands mentioned earlier in this chapter also are able to operate on all
2088 selected and visible objects. The Arrow tool is used to select/deselect
2089 objects and also to move objects or selections.  If you click and release
2090 on an object with the Arrow tool, it will unselect everything else and
2091 select the object. Selected objects change color to reflect that
2092 they are selected. If you @emph{Shift} click, it will add the object to
2093 (or remove) the object from the existing selection. If you drag with
2094 the mouse button down with the Arrow tool, one of several things could
2095 happen: if you first pressed the button on a selected object, you
2096 will be moving the selection to where you release the button. If you
2097 first pressed the button on an unselected object, you will be moving
2098 that object. If you first pressed the button over empty space, you
2099 will be drawing a box to select everything inside the box. The @emph{Shift}
2100 key works the same way with box selections as it does with single objects.
2102 Moving a single un-selected object is different from moving a selection.
2103 First of all, you can move the end of line, or a point in a polygon this
2104 way which is impossible by moving selections. Secondly, if rubber banding
2105 is turned on, moving a single object will rubber-band the attached lines.
2106 Finally, it is faster to move a single object this way since there is no need
2107 to select it first.
2109 You can select any visible object unless it is locked. If you select an
2110 object, then turn off its visibility with the Layer controls, it won't
2111 be moved if you move the remaining visible selection.
2113 If you have not configured to use strokes in the @pcb{} user interface, then
2114 the middle mouse button is automatically bound to the arrow tool, regardless
2115 of the active tool (which is bound to the first mouse button). So using
2116 the middle button any time is just like using the first mouse button
2117 with the Arrow tool active.
2119 The entries of the @emph{Selection} menu are hopefully self-explanatory.
2120 Many of the @emph{Action Commands} can take various key words that make
2121 them function on all or some of the selected items.
2123 @node Rats Nest
2124 @section Rats Nest
2125 @cindex rats nest
2126 @cindex netlist
2127 @cindex rat-line
2129 If you have a netlist that corresponds to the layout you are working on, you
2130 can use the rats-nest feature to add rat-lines to the layout.
2131 First you will need to load a netlist file (see @emph{:rn},
2132 @ref{User Commands}).
2133 @emph{<Key>w} adds rat-lines on the active layer using the current
2134 line thickness shown in the status line (usually you'll want them to be thin lines).
2135 Only those rat-lines that fill in missing connectivity (since you have
2136 probably routed some connections already) are added.
2137 If the layout is already completely wired, nothing will be added, and you will
2138 get a message that the wiring is complete.
2140 Rat-lines are lines having the special property that they only connect to pins and
2141 pads at their end points.  Rat-lines may be drawn differently to other lines
2142 to make them easier to identify since they have special behavior and cannot
2143 remain in a completed layout.
2144 Rat-lines are added in the minimum length straight-line tree pattern
2145 (always ending on pins or pads) that satisfies the missing connectivity in the circuit.
2146 Used in connection with moves and rotates of the elements, they are extremely useful for
2147 deciding where to place elements on the board. The rat-lines will always automatically
2148 rubberband to the elements whether or not the rubberband mode is on. The only way for
2149 you to move them is by moving the parts they connect to.
2150 This is because it is never desirable to have the rat-lines disconnected from
2151 their element pins.  Rat-lines will normally criss-cross
2152 all over which gives rise to the name "rats nest" describing a layout connected with
2153 them.  If a SMD pad is unreachable on the active layer, a warning will be issued
2154 about it and the rat-line to that pad will not be generated.
2156 A common way to use rats nests is to place some
2157 elements on the board, add the rat-lines, and then use a series of moves/rotates of the
2158 elements until the rats nest appears to have minimum tangling.  You may want to iterate this step
2159 several times. Don't worry if the layout looks messy - as long as you can get a sense for whether
2160 the criss-crossing is better or worse as you move things, you're fine.
2161 After moving some elements around, you may want to optimize the rats nest @emph{<Key>o}
2162 so that the lines are drawn between the closest points (this can change once you've moved components).
2163 Adding rat-lines only to selected pads/pins (@emph{Shift<Key>w})
2164 is often useful to layout a circuit a little bit at a time.
2165 Sometimes you'll want to delete all the rat-lines (@emph{<Key>e}) or
2166 selected rat-lines (@emph{Shift<Key>e}) in order to reduce confusion.
2167 With a little practice you'll be able to achieve a near optimal component placement with
2168 the use of a rats nest.
2170 Rat-lines are not only used for assisting your element placement, they can also help
2171 you to route traces on the board.
2172 Use the @emph{<Key>m} to convert a rat-line under the cursor into
2173 a normal line on the active layer.
2174 Inserting a point into a rat-line will also cause the two new lines to be normal lines
2175 on the board.
2176 Another way that you can use rat-lines is to
2177 use the @emph{<Key>f} with the cursor over a pad or pin.  All of the pins and
2178 pads and rat-lines belonging to that net will be highlighted. This is a helpful way to
2179 distinguish one net from the rest of the rats nest.  You can then route those tracks,
2180 turn off the highlighting (@emph{Shift<Key>f}) and repeat the process. This will work even
2181 if the layer that the rat-lines reside on is made invisible - so only the pins and pads
2182 are highlighted.
2183 Be sure to erase the rat-lines (@emph{<Key>e} erases them all) once you've
2184 duplicated their connectivity by adding your own lines.
2185 When in doubt, the @emph{<Key>o} will delete only those
2186 rat-lines that are no longer needed.
2188 If connections exist on the board that are not listed in the netlist when
2189 @emph{<Key>w} is pressed, warning messages are issued and the affected pins and
2190 pads are drawn in a special @emph{warnColor} until the next @emph{Notify()} event.
2191 If the entire layout agrees completely with the netlist, a message informs you that
2192 the layout is complete and no rat-lines will be added (since none are needed).
2193 If the layout is complete, but still has rat-lines then you will be warned
2194 that rat-lines remain. If you get no message at all it's probably because some
2195 elements listed in the net list can't be found and where reported in an earlier
2196 message.
2197 There shouldn't be any rat-lines left in a completed layout, only normal lines.
2199 The @emph{Shift<Key>w} is used to add rat-lines to only those missing connections among
2200 the selected pins and pads.  This can be used to add rat-lines in an incremental
2201 manner, or to force a rat-line to route between two points that are not the
2202 closest points within the net. Often it is best to add the rats nest in an incremental fashion, laying
2203 out a sub-section of the board before going further. This is easy to accomplish since
2204 new rat-lines are never added where routed connectivity already makes the necessary
2205 connections.
2207 @node Design Rule Checking
2208 @section Design Rule Checking
2209 @cindex design rule checking
2210 @cindex drc
2211 @cindex spacing, minimum
2212 @cindex overlap, minimum
2214 After you've finished laying out a board, you may want to check
2215 to be certain that none of your interconnections are too closely
2216 spaced or too tenuously touching to be reliably fabricated. The design
2217 rule checking (DRC) function does this for you. Use the command ":DRC()" (without
2218 the quotes of course) to invoke the checker.  If there are no problem areas,
2219 you'll get a message to that effect.  If any problem is encountered, you will get
2220 a message about it and the affected traces will be highlighted. One part of the
2221 tracks of concern will be selected, while the other parts of concern will have the
2222 "FindConnection" highlighting. The screen will automatically be centered in the
2223 middle of the object having the "FindConnection" (Green) highlighting.  The middle of
2224 the object is also the coordinates reported to be "near" the problem.  The actual trouble
2225 region will be somewhere on the boundary of this object.  If the two parts are
2226 from different nets then there is some place where they approach each
2227 other closer than the minimum rule.  If the parts are from the same net, then
2228 there is place where they are only barely connected. Find that place and connect
2229 them better.
2231 After a DRC error is found and corrected you must run the DRC again because
2232 the search for errors is halted as soon as the first problem is found. Unless you've
2233 been extremely careless there should be no more than a few design rule errors
2234 in your layout.  The DRC checker does not check for minimum spacing rules to
2235 copper text, so always be very careful when adding copper text to a layout.
2236 The rules for the DRC are specified in the application resource file.  The minimum
2237 spacing value (in mils) is given by the @emph{Settings.Bloat} value. The default
2238 is 7 mils. The minimum touching overlap (in mils) is given by the
2239 @emph{Settings.Shrink} value. This value defaults to 5 mils. Check with your
2240 fabrication process people to determine the values that are right for you.
2242 If you want to turn off the highlighting produced by the DRC, perform an
2243 undo (assuming no other changes have been made).  To restore the highlighting,
2244 use redo.  The redo will restore the highlighting quickly without re-running
2245 the DRC checker.
2247 @node Trace Optimizer
2248 @section Trace Optimizer
2249 @cindex trace optimizer
2250 @cindex optimizer
2252 PCB includes a flexible trace optimizer.  The trace optimizer can be run
2253 after auto routing or hand routing to clean up the traces.
2255 @table @b
2256 @item Auto-Optimize
2257 Performs debumpify, unjaggy, orthopull, vianudge, and viatrim, in that
2258 order, repeating until no further optimizations are performed.
2260 @item Debumpify
2261 Looks for U shaped traces that can be shortened or eliminated.
2263 @item Unjaggy
2264 Looks for corners which could be flipped to eliminate one or more
2265 corners (i.e. jaggy lines become simpler).
2267 @item Vianudge
2268 Looks for vias where all traces leave in the same direction. Tries to
2269 move via in that direction to eliminate one of the traces (and thus a
2270 corner).
2272 @item Viatrim
2273 Looks for traces that go from via to via, where moving that trace to a
2274 different layer eliminates one or both vias.
2276 @item Orthopull
2277 Looks for chains of traces all going in one direction, with more traces
2278 orthogonal on one side than on the other. Moves the chain in that
2279 direction, causing a net reduction in trace length, possibly eliminating
2280 traces and/or corners.
2282 @item SimpleOpts
2283 Removing unneeded vias, replacing two or more trace segments in a row
2284 with a single segment. This is usually performed automatically after
2285 other optimizations.
2287 @item Miter
2288 Replaces 90 degree corners with a pair of 45 degree corners, to reduce
2289 RF losses and trace length.
2291 @end table
2293 @node Searching for elements 
2294 @section Searching for elements
2295 @cindex Searching for elements
2296 @vindex Searching for elements
2298 To locate text or a specific element or grouping of similar elements
2299 choose @samp{Select by name} from the @b{Select} menu, then choose the
2300 appropriate subsection.  At the bottom of the screen the prompt
2301 @emph{pattern:} appears.  Enter the text or @ref{Regular Expressions}
2302 of the text to be found.  Found text will be highlighted.
2304 @node Measuring distances
2305 @section Measuring distances
2306 @cindex Measuring distances
2307 @vindex Measuring distances
2309 To measure distances, for example the pin-to-pin pitch of a part to
2310 validate a footprint, place the cursor at the starting
2311 measurement point, then press @emph{!Ctrl<Key>m}.  This marks the
2312 current  location with a @emph{X}. The @emph{X} mark is now the zero point
2313 origin for the relative cursor position display.  The cursor display
2314 shows both absolute position and position relative to the mark as
2315 the mouse is moved away from the mark.  If a mark is already present,
2316 the mark is removed and the cursor display stops displaying relative
2317 cursor coordinates.
2319 @node Vendor drill mapping
2320 @section Vendor Drill Mapping
2321 @cindex Vendor rules
2322 @cindex Vendor mapping
2323 @cindex Drill table
2324 @cindex Vendor drill table
2326 @pcb{} includes support for mapping drill holes to a specified set
2327 of sizes used by a particular vendor.  Many PCB manufacturers have a
2328 prefered set of drill sizes and charge extra when others are used.
2329 The mapping can be performed on an existing design and can also be
2330 enabled to automatically map drill holes as vias and elements are
2331 instantiated. 
2333 The first step in using the vendor drill mapping feature is to create
2334 a resource file describing the capabilities of your vendor.  The file
2335 format is the resource file format described in @ref{Resource Syntax}.
2336 A complete example is given below.
2338 @example
2339 # Optional name of the vendor
2340 vendor = "Vendor Name"
2342 # units for dimensions in this file.
2343 # Allowed values:  mil/inch/mm
2344 units = mil
2346 # drill table
2347 drillmap = @{
2348    # When mapping drill sizes, select the nearest size
2349    # or always round up.  Allowed values:  up/nearest
2350    round = up
2352    # The list of vendor drill sizes.  Units are as specified
2353    # above.
2354    20
2355    28
2356    35
2357    38
2358    42
2359    52
2360    59.5
2361    86
2362   125   
2363   152
2365    # optional section for skipping mapping of certain elements
2366    # based on reference designator, value, or description
2367    # this is useful for critical parts where you may not
2368    # want to change the drill size.  Note that the strings
2369    # are regular expressions.  
2370    skips = @{
2371       @{refdes "^J3$"@}  # Skip J3.
2372       @{refdes "J3"@}  # Skip anything with J3 as part of the refdes.
2373       @{refdes "^U[1-3]$" "^X.*"@} # Skip U1, U2, U3, and anything starting with X.
2374       @{value "^JOHNSTECH_.*"@} # Skip all Johnstech footprints based on the value of a part.
2375       @{descr "^AMP_MICTOR_767054_1$"@} # Skip based on the description.
2376    @}
2379 # If specified, this section will change the current DRC
2380 # settings for the design.  Units are as specified above.
2381 drc = @{
2382    copper_space = 7
2383    copper_width = 7
2384    silk_width = 10
2385    copper_overlap = 4
2387 @end example
2389 The vendor resource is loaded using the @emph{LoadVendor} action.
2390 This is invoked by entering:
2391 @example
2392 :LoadVendor(vendorfile)
2393 @end example
2394 from within @pcb{}.  Substitute the file name of your vendor
2395 resource file for @samp{vendorfile}.  This action will load the vendor
2396 resource and modify all the drill holes in the design as well as the
2397 default via hole size for the various routing styles.
2399 Once a vendor drill map has been loaded, new vias and elements will
2400 automatically have their drill hole sizes mapped to the vendor drill
2401 table.  Automatic drill mapping may be disabled under the ``Settings''
2402 menu.  To re-apply an already loaded vendor drill table to a design,
2403 choose ``Apply vendor drill mapping'' from the ``Connects'' menu.
2405 See @ref{Actions} for a complete description of the actions associated
2406 with vendor drill mapping.
2408 Note that the expressions used in the @code{skips} section are regular
2409 expressions.  See @ref{Regular Expressions} for an introduction to
2410 regular expressions.  
2412 @c --------------------------- Autorouter Chapter -------------------------------
2413 @node Autorouter
2414 @chapter Autorouter
2415 @cindex autorouter
2417 @pcb{} includes an autorouter which can greatly speed up the
2418 layout of a circuit board.  The autorouter is a rectangle-expansion
2419 type of autorouter based on 
2420 ``A Method for Gridless Routing of Printed Circuit Boards'' by
2421 A. C. Finch, K. J. Mackenzie, G. J. Balsdon, and G. Symonds in the
2422 1985 Proceedings of the 22nd ACM/IEEE Design Automation Conference.
2423 This reference is available from the ACM Digital Library at
2424 @url{http://www.acm.org/dl} for those with institutional or personal
2425 access to it.  It's also available from your local engineering
2426 library.  The reference paper is not needed for using the autorouter.
2428 Before using the autorouter, all elements need to be loaded into the
2429 layout and placed and the connectivity netlist must be loaded.  Once
2430 the elements have been placed and the netlist loaded, the following
2431 steps will autoroute your design.
2433 @enumerate
2434 @item Turn off visibility of any layers that you don't want the router
2435 to use.
2437 @item Turn of via visibility if you don't want the router to use any
2438 new vias. 
2440 @item Use only plain rectangles for power/ground planes that you want
2441    the router to use [use the rectangle tool!]
2443 @item Make at least one connection from any plane you want the router to
2444    use to the net you want it to connect to.
2446 @item Draw continuous lines (on all routing layers) to outline keep-out
2447    zones if desired.
2449 @item Use routing styles in the netlist to have per-net routing styles.  
2450   Note that the routing style will be used for an entire net.  This means
2451   if you have a wide metal setting for a power net you will need to manually
2452   route breakouts from any fine pitch parts on their power pins because
2453   the router will not be able to change to a narrow trace to connect
2454   to the part.
2456 @item Set the current routing style to whatever you'd like the router to
2457    use for any nets not having a defined route style in the netlist.
2459 @item Disable any nets that you don't want the autorouter to route
2460    (double-click them in the  netlist window to add/remove the *)
2462          NOTE: If you will be manually routing these later not using
2463    planes, it is usually better to let the autorouter route them then rip
2464    them up yourself afterwards. If you plan to use a ground/power plane
2465    manually, consider making it from one or more pure rectangles and
2466    letting the autorouter have a go at it.
2468 @item Create a fresh rat's nest. ('E' the 'W')
2470 @item Select ``show autorouter trials'' in the settings menu if you want
2471    to watch what's happening
2473 @item Choose ``autoroute all rats'' in the connection menu.
2475 @item If you really want to muck with the router because you have a
2476    special design, e.g. all through-hole components you can mess with
2477    layer directional costs by editing the autoroute.c source file and
2478    changing the directional costs in lines 929-940. and try again. Even
2479    more mucking about with costs is possible in lines 4540-4569, but it's
2480    probably not such a good idea unless you really just want to
2481    experiment.
2483 @end enumerate
2485 After the design has been autorouted, you may want to run the trace
2486 optimizer.  See section @ref{Trace Optimizer} for more information on
2487 the trace optimizer.
2490 @c --------------------------- User Commands chapter -------------------------------
2491 @node User Commands
2492 @chapter User Commands
2494 @cindex user commands
2495 @cindex entering user commands
2496 The entering of user-commands is initiated by the action routine
2497 @emph{Command()} (normally bound to the @code{(":")} character) which
2498 replaces the bottom statusline with an input area or opens a separate
2499 command window.  It is finished by either @emph{<Key>Return} or
2500 @emph{<Key>Escape} to confirm or to abort. These two key-bindings
2501 cannot be changed from the resource file.  The triggering event,
2502 normally a key press, is ignored.
2504 Commands can be entered in one of two styles, command entry syntax:
2505 ``@emph{Command arg1 arg2}'' or action script syntax ``@emph{Action1(arg1,
2506 arg2); Action2(arg1, arg2);}''.  Quoting arguments works similar to
2507 bash quoting:
2509 @itemize
2510 @item A backslash (\) is the escape character.  It preserves the literal
2511 value of the next character that follows.  To get a literal '\' use
2512 "\\".
2514 @item Enclosing characters in single quotes preserves the literal value of
2515 each character within the quotes.  A single quote may not occur
2516 between single quotes, even when preceded by a blackslash.
2518 @item Enclosing characters in double quotes preserves the literal value of
2519 all characters within the quotes, with the exception of '\' which
2520 maintains its special meaning as an escape character.
2521 @end itemize
2523 There are simple @emph{usage} dialogs for each command and one for the
2524 complete set of commands.
2526 @table @samp
2528 @findex :l
2529 @cindex loading layouts
2530 @cindex layout, loading a
2531 @item l [filename]
2532 Loads a new datafile (layout) and, if confirmed, overwrites any existing unsaved data.
2533 The filename and the searchpath (@emph{filePath}) are passed to the
2534 command defined by @emph{fileCommand}.
2535 If no filename is specified a file select box will popup.
2537 @findex :le
2538 @cindex loading elements to buffer
2539 @cindex element, loading to buffer
2540 @item le [filename]
2541 Loads an element description into the paste buffer.
2542 The filename and the searchpath (@emph{elementPath}) are passed to the
2543 command defined by @emph{elementCommand}.
2544 If no filename is specified a file select box will popup.
2546 @findex :m
2547 @cindex loading a layout to buffer
2548 @cindex merging layouts
2549 @cindex layout, loading to buffer
2550 @cindex layout, merging a
2551 @item m [filename]
2552 Loads an layout file into the paste buffer.
2553 The filename and the searchpath (@emph{filePath}) are passed to the
2554 command defined by @emph{fileCommand}.
2555 If no filename is specified a file select box will popup.
2557 @findex :q
2558 @cindex exit
2559 @cindex quit
2560 @item q[!]
2561 Quits the program without saving any data (after confirmation).
2562 q! doesn't ask for confirmation, it just quits.
2564 @findex :s
2565 @cindex saving layouts
2566 @cindex layout files, saving of
2567 @item s [filename]
2568 Data and the filename are passed to the command defined by the resource
2569 @emph{saveCommand}. It must read the layout data from @emph{stdin}.
2570 If no filename is entered, either the last one is used
2571 again or, if it is not available, a file select box will pop up.
2573 @findex :rn
2574 @cindex rat's nest
2575 @cindex layout-name
2576 @item rn [filename]
2577 Reads in a netlist file.  If no filename is given
2578 a file select box will pop up.
2579 The file is read via the command defined by the
2580 @emph{RatCommand} resource. The command must send its output to @emph{stdout}.
2582 Netlists are used for generating rat's nests (see @ref{Rats Nest}) and for
2583 verifying the board layout (which is also accomplished by the @emph{Ratsnest}
2584 command).
2586 @findex :w[q]
2587 @cindex saving layouts
2588 @cindex layout files, saving of
2589 @item w[q] [filename]
2590 These commands have been added for the convenience of @code{vi} users and
2591 have the same functionality as @emph{s} combined with @emph{q}.
2593 @findex :actionCommand()
2594 @cindex action command
2595 @cindex Actions, initiating
2596 @item actionCommand
2597 Causes the actionCommand to be executed.  This allows you to initiate actions
2598 for which no bindings exist in the resource file.  It can be used to initiate any
2599 action with whatever arguments you enter.  This makes it possible to do things
2600 that otherwise would be extremely tedious.  For example, to change the drilling
2601 hole diameter of all vias in the layout to 32 mils, you could select everything using the
2602 selection menu, then type "@emph{:ChangeDrillSize(SelectedVias, 32)}".  (This will
2603 only work provided the via's diameter is sufficiently large to accommodate a 32 mil hole).
2604 Another example might be to set the grid to 1 mil by typing "@emph{:SetValue(Grid, 1)}".
2605 Note that some actions use the current cursor location, so be sure to place the cursor
2606 where you want before entering the command.  This is one of my favorite new
2607 features in 1.5 and can be a powerful tool. Study the @ref{Actions} section to
2608 see what actions are available.
2610 @end table
2613 @c --------------------------- chapter 4 -------------------------------
2614 @node Command-Line Options
2615 @chapter Command-Line Options
2616 @cindex starting @pcb{}
2617 @cindex command-line options
2619 The synopsis of the pcb command is:
2621 @code{pcb [OPTION ...] [LAYOUT-FILE.pcb]} to start the application in GUI mode,
2623 @noindent or
2625 @code{pcb [-h | -V | --copyright]} for a list of options, version, and copyright,
2627 @noindent or
2629 @code{pcb -p [OPTION ...] [LAYOUT-FILE.pcb]} to print a layout,
2631 @noindent or
2633 @code{pcb -x HID [OPTION ...] [LAYOUT-FILE.pcb]} to export.
2635 @noindent Possible values for the parameter @samp{HID} are:
2636  @table @samp
2637    @item bom
2638     Export a bill of materials
2639    @item gcode
2640     Export to G-Code
2641    @item gerber
2642     Export RS-274X (Gerber)
2643    @item nelma
2644     Numerical analysis package export
2645    @item png
2646     export GIF/JPEG/PNG
2647    @item ps
2648     export postscript
2649    @item eps
2650     export encapsulated postscript
2651 @end table
2653 @noindent There are several resources which may be set or reset in addition to the
2654 standard toolkit command-line options. For a complete list refer to
2655 @ref{Resources}.
2658 @include options.texi
2662 @c --------------------------- chapter 5 -------------------------------
2663 @node X11 Interface
2664 @chapter X11 Interface
2665 @cindex X11
2667 This chapter gives an overview about the additional @code{X11} resources which
2668 are defined by @pcb{} as well as the defined action routines.
2670 @menu
2671 * Resources::      Non-standard @code{X11} application resources.
2672 * Actions::        A list of available action routines.
2673 * Translations::   A list of the default key translations (as shipped).
2674 @end menu
2677 @node Resources
2678 @section Non-Standard X11 Application Resources
2679 @cindex resources
2680 @cindex X11 resources
2682 In addition to the toolkit resources, @pcb{} defines the
2683 following resources:
2685 @table @samp
2687 @vindex absoluteGrid
2688 @cindex grid
2689 @item absoluteGrid (boolean)
2690 Selects if either the grid is relative to the position where it has changed
2691 last or absolute, the default, to the origin (0,0).
2693 @vindex alignmentDistance
2694 @cindex alignment
2695 @item alignmentDistance (dimension)
2696 Specifies the distance between the boards outline to the alignment targets.
2698 @vindex allDirectionLines
2699 @cindex lines, clipping to 45 degree
2700 @cindex clipping lines to 45 degree
2701 @item allDirectionLines (boolean)
2702 Enables (default) or disables clipping of new lines to 45 degree angles.
2704 @vindex backgroundImage
2705 @cindex background
2706 @item backgroundImage (string)
2707 If specified, this image will be drawn as the background for the
2708 board.  The purpose of this option is to allow you to use a scan of an
2709 existing layout as a prototype for your new layout.  To do this, there
2710 are some limitations as to what this image must be.  The image must be
2711 a PPM binary image (magic number @samp{P6}).  It must have a maximum
2712 pixel value of 255 or less (i.e. no 16-bit images).  It must represent
2713 the entire board, as it will be scaled to fit the board dimensions
2714 exactly.  Note that it may be scaled unevenly if the image doesn't
2715 have the same aspect ratio of your board.  You must ensure that the
2716 image does not use more colors than are available on your system
2717 (mostly this is for pseudo-color displays, like old 8-bit displays).
2718 For best results, I suggest the following procedure using The Gimp:
2719 Load your image (any type).  Image->Scale if needed.
2720 Image->Colors->Curves and for each of Red, Green, and Blue channel
2721 move the lower left point up to about the 3/4 line (value 192).  This
2722 will make your image pale so it doesn't interfere with the traces
2723 you'll be adding.  Image->Mode->Indexed and select, say, 32 colors
2724 with Normal F-S dithering.  File->Save As, file type by extension,
2725 use @file{.ppm} as the extension.  Select Raw formatting.
2727 @vindex backupInterval
2728 @cindex backup
2729 @item backupInterval (int)
2730 @pcb{} has an automatic backup feature which saves the current data
2731 every n seconds. The default is @emph{300} seconds. A value of zero disables
2732 the feature. The backup file is named @file{/tmp/PCB.%i.backup} by
2733 default (this may have been changed at compilation time via the
2734 @code{BACKUP_NAME}
2735 variable in @file{globalconfig.h}).
2736 @emph{%i} is replaced by the process ID.
2737 See also, the command-line option @emph{--backup-interval}.
2739 @vindex bloat
2740 @cindex bloat
2741 @cindex drc
2742 @item Bloat (dimension)
2743 Specifies the minimum spacing design rule in mils.
2745 @vindex connectedColor
2746 @cindex colors
2747 @cindex connections, colors
2748 @item connectedColor (color)
2749 All pins, vias, lines and rectangles which are selected during a connection
2750 search are drawn with this color. The default value is determined by
2751 @emph{XtDefaultForeground}.
2753 @vindex cross hairColor
2754 @cindex colors
2755 @cindex cursor color
2756 @item cross hairColor (color)
2757 This color is used to draw the cross hair cursor. The color is a result of
2758 a @emph{XOR} operation with the contents of the Layout area. The result
2759 also depends on the default colormap of the @code{X11} server because only
2760 the colormap index is used in the boolean operation and @pcb{} doesn't
2761 create its own colormap. The default setting is @emph{XtDefaultForeground}.
2763 @vindex elementColor
2764 @vindex elementSelectedColor
2765 @cindex colors
2766 @cindex element, color
2767 @item elementColor (color)
2768 @itemx elementSelectedColor (color)
2769 The elements package part is drawn in these colors, for normal and selected
2770 mode, respectively, which both default to @emph{XtDefaultForeground}.
2772 @vindex elementCommand
2773 @cindex element, command
2774 @cindex element, files
2775 @cindex loading elements
2776 @cindex preprocessing element data
2777 @cindex unix command
2778 @cindex m4
2779 @item elementCommand (string)
2780 @pcb{} uses a user defined command to read element files. This resources
2781 is used to set the command which is executed by the users default shell.
2782 Two escape sequences are defined to pass the selected filename (%f) and the
2783 current search path (%p). The command must write the element data
2784 to its standard output. The default value is
2785 @example
2786     M4PATH="%p";export M4PATH;echo 'include(%f)' | m4
2787 @end example
2788 Using the GNU version of @code{m4} is highly recommended.
2789 See also, the command-line option @emph{--element-command}.
2791 @vindex elementPath
2792 @cindex searchpath for element files
2793 @cindex path for element files
2794 @cindex element, files
2795 @cindex loading elements
2796 @item elementPath (string)
2797 A colon separated list of directories or commands (starts with '|').
2798 The path is passed to the program specified in @emph{elementCommand} together
2799 with the selected element name. A specified command will be executed in order
2800 to create entries for the fileselect box. It must write its results to
2801 @emph{stdout} one entry per line.
2802 See also, the user-command @emph{le[!]}.
2804 @vindex fileCommand
2805 @cindex file load command
2806 @cindex layout files
2807 @cindex loading layouts
2808 @cindex preprocessing layout data
2809 @cindex unix command
2810 @cindex cat
2811 @item fileCommand (string)
2812 The command is executed by the user's default shell whenever existing layout
2813 files are loaded. Data is read from the command's standard output.
2814 Two escape sequences may be specified to pass the selected filename (%f)
2815 and the current search path (%p). The default value is:
2816 @example
2817     cat %f
2818 @end example
2819 See also, the command-line option @emph{--file-command}.
2821 @vindex filePath
2822 @cindex searchpath for layout files
2823 @cindex path for layout files
2824 @cindex layout files
2825 @cindex loading layouts
2826 @item filePath (string)
2827 A colon separated list of directories or commands (starts with '|').
2828 The path is passed to the program specified in @emph{fileCommand} together
2829 with the selected filename. A specified command will be executed in order
2830 to create entries for the fileselect box. It must write its results to
2831 @emph{stdout} one entry per line.
2832 See also, the user-command @emph{l[!]}.
2834 @vindex fontCommand
2835 @cindex font command
2836 @cindex font files
2837 @cindex loading fonts
2838 @cindex loading symbols
2839 @cindex preprocessing font data
2840 @cindex unix command
2841 @cindex cat
2842 @item fontCommand (string)
2843 Loading new symbol sets also is handled by an external command. You again
2844 may pass the selected filename and the current search path by passing
2845 %f and %p in the command string. Data is read from the commands standard
2846 output. This command defaults to
2847 @example
2848     cat %f
2849 @end example
2850 See also, the command-line option @emph{--font-command}.
2852 @vindex fontFile
2853 @cindex default font
2854 @cindex symbols
2855 @item fontFile (string)
2856 The default font for new layouts is read from this file which is searched
2857 in the directories as defined by the resource @emph{fontPath}.
2858 Searching is only performed if the filename does not contain a directory
2859 component.
2860 The default filename is @file{default_font}.
2862 @vindex fontPath
2863 @cindex searchpath for font files
2864 @cindex path for font files
2865 @cindex font files
2866 @cindex loading fonts
2867 @cindex loading symbols
2868 @item fontPath (string)
2869 This resource, a colon separated list of directories, defines the searchpath
2870 for font files. See also, the resource @emph{fontFile}.
2872 @vindex grid
2873 @cindex grid
2874 @cindex cursor steps
2875 @item grid (int)
2876 This resources defines the initial value of one cursor step. It defaults
2877 to @emph{100 mil} and any changes are saved together with the layout data.
2879 @vindex gridColor
2880 @cindex colors
2881 @cindex grid color
2882 @item gridColor (color)
2883 This color is used to draw the grid. The color is a result of
2884 a @emph{INVERT} operation with the contents of the Layout area. The result
2885 also depends on the default colormap of the @code{X11} server because only
2886 the colormap index is used in the boolean operation and @pcb{} doesn't
2887 create its own colormap. The default setting is @emph{XtDefaultForeground}.
2889 @vindex invisibleObjectsColor
2890 @cindex colors
2891 @cindex element, color
2892 @item invisibleObjectsColor (color)
2893 Elements located on the opposite side of the board are drawn in this color.
2894 The default is @emph{XtDefaultForeground}.
2896 @vindex layerColor
2897 @vindex layerSelectedColor
2898 @cindex colors
2899 @cindex layers, colors
2900 @item layerColor1..MAX_LAYER (color)
2901 @itemx layerSelectedColor1..MAX_LAYER (color)
2902 These resources define the drawing colors of the different layers in
2903 normal and selected state. All values are preset to @emph{XtDefaultForeground}.
2905 @vindex layerGroups
2906 @cindex layers, groups
2907 @cindex groups
2908 @item layerGroups (string)
2909 The argument to this resource is a colon separated list of comma separated
2910 layer numbers (1..MAX_LAYER). All layers within one group are switched on/off
2911 together. The default setting is @emph{1:2:3:...:MAX_LAYER} which means
2912 all layers are handled separately. Grouping layers one to three looks like
2913 @emph{1,2,3:4:...:MAX_LAYER}
2915 @vindex layerName
2916 @cindex layer, name of
2917 @item layerName1..MAX_LAYER (string)
2918 The default name of the layers in a new layout are determined by these
2919 resources. The defaults are empty strings.
2921 @vindex libraryCommand
2922 @cindex library command
2923 @cindex loading elements
2924 @cindex unix command
2925 @item libraryCommand (string)
2926 @pcb{} uses a command to read element data from libraries.
2927 The resources is used to set the command which is executed by the users
2928 default shell.  Three escape sequences are defined to pass the selected
2929 filename (%f), the current search path (%p) as well (%a) as the three
2930 parameters @emph{template}, @emph{value} and @emph{package} to the command.
2931 It must write the element data to its standard output. The default value is
2932 @example
2933     NONE/share/pcb/oldlib/QueryLibrary.sh %p %f %a
2934 @end example
2936 @vindex elementContentsCommand
2937 @cindex library contents command
2938 @cindex listing library contents
2939 @cindex unix command
2940 @item libraryContentsCommand (string)
2941 Similar to @emph{libraryCommand}, @pcb{} uses the command specified
2942 by this resource to list the contents of a library.
2943 @example
2944         NONE/share/pcb/oldlib/ListLibraryContents.sh %p %f
2945 @end example
2946 is the default.
2948 @vindex libraryFilename
2949 @cindex default library
2950 @cindex library name
2951 @item libraryFilename (string)
2952 The resource specifies the name of the library. The default value is
2953 @emph{pcblib} unless changed at compile time
2954 with the @code{LIBRARYFILENAME} variable in @file{globalconfig.h}.
2956 @vindex libraryPath
2957 @cindex searchpath for libraries
2958 @cindex path for libraries
2959 @cindex library searchpath
2960 @item libraryPath (string)
2961 A colon separated list of directories that will be passed to the commands
2962 specified by @emph{elementCommand} and @emph{elementContentsCommand}.
2964 @vindex lineThickness
2965 @cindex lines, size
2966 @cindex size of lines
2967 @cindex thickness of lines
2968 @item lineThickness (dimension)
2969 The value, in the range [1..250] (the range may be changed at compile
2970 time with the @code{MIN_LINESIZE} and @code{MAX_LINESIZE} variables in
2971 @file{globalconfig.h}), defines the
2972 initial thickness of new lines. The value is preset to @emph{ten mil}.
2974 @vindex media
2975 @cindex media
2976 @cindex media margin
2977 @cindex print media
2978 @item media (<predefined> | <width>x<height>+-<left_margin>+-<top_margin>)
2979 The default (user defined) media of the @code{PostScript} device. Predefined
2980 values are @emph{a3}, @emph{a4}, @emph{a5}, @emph{letter}, @emph{tabloit},
2981 @emph{ledger}, @emph{legal}, and @emph{executive}.
2982 The second way is to specify the medias width, height and margins in mil.
2983 The resource defaults to @emph{a4} size unless changed at compile time
2984 with the @code{DEFAULT_MEDIASIZE} variable in @file{globalconfig.h}.
2986 @vindex offLimitColor
2987 @cindex colors
2988 @cindex off limit color
2989 @item offLimitColor (color)
2990 The area outside the current maximum settings for width and height is drawn
2991 with this color. The default value is determined by @emph{XtDefaultBackground}.
2993 @vindex pinColor
2994 @vindex pinSelectedColor
2995 @cindex colors
2996 @cindex pin color
2997 @item pinColor (color)
2998 @itemx pinSelectedColor(color)
2999 This resource defines the drawing color of pins and pads in both states.
3000 The values are preset to @emph{XtDefaultForeground}.
3002 @vindex pinoutFont0..6
3003 @cindex font, used for pin names
3004 @cindex pinout, font to display pin names
3005 @item pinoutFont (string)
3006 This fonts are used to display pin names. There is one font for each zoom
3007 value. The values are preset to @emph{XtdefaultFont}.
3009 @vindex pinoutNameLength
3010 @cindex namelength of pins
3011 @cindex pin, name of
3012 @cindex length of a pin name
3013 @item pinoutNameLength (int)
3014 This resource limits the number of characters which are displayed for
3015 pin names in the pinout window. By default the string length is limited
3016 to @emph{eight} characters per name.
3018 @vindex pinoutOffsetX
3019 @vindex pinoutOffsetY
3020 @cindex offset of pinout
3021 @item pinoutOffsetX (int)
3022 @itemx pinoutOffsetY (int)
3023 These resources determine the offset in @emph{mil} of the circuit from the
3024 upper left corner of the window when displaying pinout information.
3025 Both default to @emph{100 mil}.
3027 @vindex pinoutTextOffsetX
3028 @vindex pinoutTextOffsetY
3029 @cindex offset of pinnames
3030 @item pinoutTextOffsetX (int)
3031 @itemx pinoutTextOffsetY (int)
3032 The resources determine the distance in mil between the drilling hole of a pin
3033 to the location where its name is displayed in the pinout window.
3034 They default to @emph{X:50} and @emph{Y:0}.
3036 @vindex pinoutZoom
3037 @cindex pinout, zoomfactor of display
3038 @cindex zoom of pinout window
3039 @item pinoutZoom (int)
3040 Sets the zoom factor for the pinout window according to the formula:
3041 scale = 1:(2 power value). Its default value is @emph{two} which results in
3042 a @emph{1:4} scale.
3044 @vindex printCommand
3045 @cindex printing
3046 @item printCommand (string)
3047 Default file for printouts. If the name starts with a '|' the output
3048 is piped through the command. A %f is replaced by the current filename.
3049 There is no default file or command.
3051 @vindex raiseLogWindow
3052 @cindex log window
3053 @cindex messages
3054 @item raiseLogWindow (boolean)
3055 The log window will be raised when new messages arrive if this resource
3056 is set @emph{true}, the default.
3058 @vindex ratCommand
3059 @cindex rats nest
3060 @cindex netlist
3061 @item ratCommand (string)
3062 Default command for reading a netlist. A %f is replaced by the netlist
3063 filename. Its default value is "@emph{cat %f}".
3065 @vindex ratPath
3066 @cindex rats nest
3067 @cindex netlist
3068 @item ratPath (string)
3069 Default path to look for netlist files. It's default value is "."
3071 @vindex resetAfterElement
3072 @cindex connections, reseting after element
3073 @cindex reseting found connections
3074 @item resetAfterElement (boolean)
3075 If set to @emph{true}, all found connections will be reset before a new
3076 element is scanned. This will produce long lists when scanning the whole
3077 layout for connections. The resource is set to @emph{false} by default.
3078 The feature is only used while looking up connections of all elements.
3080 @vindex ringBellWhenFinished
3081 @cindex keyboard bell
3082 @item ringBellWhenFinished (boolean)
3083 Whether to ring the bell (the default) when a possibly lengthy operation
3084 has finished or not.
3085 See also, the command-line option @emph{--ring-bell-finished}.
3087 @vindex routeStyle
3088 @cindex routing style
3089 @item routeStyle (string)
3090 Default values for the menu of routing styles (seen in the sizes menu).
3091 The string is a comma separated list of name, line thickness,
3092 via diameter, and via drill size.
3093 e.g. "Fat,50,100,40:Skinny,8,35,20:75Ohm,110,110,20"
3094 See also, the command-line option @emph{--route-styles} and @emph{Sizes Menu}
3096 @vindex rubberBandMode
3097 @cindex move
3098 @cindex rubberband
3099 @cindex rotate
3100 @item rubberBandMode (boolean)
3101 Whether rubberband move and rotate (attached lines stretch like
3102 rubberbands) is enabled (the default).
3104 @vindex saveCommand
3105 @cindex file save command
3106 @cindex layout files
3107 @cindex saving layouts
3108 @cindex postprocessing layout data
3109 @cindex unix command
3110 @cindex cat
3111 @item saveCommand (string)
3112 This command is used to save data to a layout file. The filename may be
3113 indicated by placing @code{%f} in the string. It must read the data from
3114 its standard input.  The default command is:
3115 @example
3116     cat - > %f
3117 @end example
3118 See also, the command-line option @emph{--save-command}.
3120 @vindex saveInTMP
3121 @cindex backup
3122 @cindex saving layouts
3123 @cindex preventing loss of data
3124 @cindex temporary files
3125 @cindex /tmp
3126 @cindex directory /tmp
3127 @item saveInTMP (boolean)
3128 Enabling this resource will save all data which would otherwise be lost
3129 in a temporary file @file{/tmp/PCB.%i.save}.  The file name may
3130 be changed at compile time
3131 with the @code{EMERGENCY_NAME} variable in @file{globalconfig.h}.
3133 @emph{%i} is replaced by the process ID.
3134 As an example, loading a new layout when the old one hasn't been saved would
3135 use this resource.
3136 See also, the command-line option @emph{--save-in-tmp}.
3138 @vindex saveLastCommand
3139 @cindex saving last entered user command
3140 @cindex inputfield, saving entered command-line
3141 @item saveLastCommand (boolean)
3142 Enables the saving of the last entered user command. The option is
3143 @emph{disabled} by default.
3144 See also, the command-line option @emph{--save-last-command}.
3146 @vindex shrink
3147 @cindex shrink
3148 @cindex drc
3149 @item Shrink (dimension)
3150 Specifies the minimum overlap (touching) design rule in mils.
3152 @vindex size
3153 @cindex default layout size
3154 @cindex layout, default size of
3155 @item size (<width>x<height>)
3156 Defines the width and height of a new layout. The default is
3157 @emph{7000x5000} unless changed at compile time
3158 with the @code{DEFAULT_SIZE} variable in @file{globalconfig.h}.
3161 @vindex stipplePolygons
3162 @cindex polygon
3163 @cindex display
3164 @item stipllePolygons (boolean)
3165 Determines whether to display polygons on the screen with a stippled
3166 pattern.  Stippling can create some amount of transparency so that
3167 you can still (to some extent) see layers beneath polygons.
3168 It defaults to False.
3170 @vindex textScale
3171 @cindex text, default scaling
3172 @cindex default text scaling
3173 @item textScale (dimension)
3174 The font scaling in percent is defined by this resource. The default is
3175 @emph{100} percent.
3177 @vindex useLogWindow
3178 @cindex log window
3179 @cindex messages
3180 @item useLogWindow (boolean)
3181 Several subroutines send messages to the user if an error occurs.
3182 This resource determines if they appear inside the log window or as a separate
3183 dialog box. See also, the resource @emph{raiseLogWindow} and the command line
3184 option @emph{-loggeometry}.
3185 The default value is @emph{true}.
3187 @vindex viaColor
3188 @vindex viaSelectedColor
3189 @cindex colors
3190 @cindex vias, color
3191 @item viaColor (color)
3192 @item viaSelectedColor (color)
3193 This resource defines the drawing color of vias in both states.
3194 The values are preset to @emph{XtDefaultForeground}.
3196 @vindex viaThickness
3197 @vindex viaDrillingHole
3198 @cindex vias, size
3199 @cindex size of vias
3200 @cindex thickness of vias
3201 @item viaThickness (dimension)
3202 @itemx viaDrillingHole (dimension)
3203 The initial thickness and drilling hole of new vias. The values must be in the
3204 range [30..400] (the range may be changed at compile
3205 time with the @code{MIN_PINORVIASIZE} and @code{MAX_PINEORVIASIZE} variables in
3206 @file{globalconfig.h}), with at least 20
3207 mil of copper.
3208 The default thickness is @emph{40 mil} and the default drilling hole is
3209 @emph{20 mil}.
3211 @vindex volume
3212 @cindex speaker volume
3213 @cindex volume of speaker
3214 @item volume (int)
3215 The value is passed to @code{XBell()} which sets the volume of the @code{X}
3216 speaker.
3217 The value lies in the range -100..100 and it defaults to the maximum volume of
3218 @emph{100}.
3220 @vindex warnColor
3221 @cindex colors
3222 @cindex color, warning
3223 @item warnColor (color)
3224 This resources defines the color to be used for drawing pins and pads when
3225 a warning has been issued about them.
3227 @vindex zoom
3228 @cindex zoom of Layout area
3229 @item zoom (int)
3230 The initial value for output scaling is set according to the following
3231 formula: scale = 1:(2 power value). It defaults to @emph{three} which results
3232 in an output scale of @emph{1:8}.
3234 @end table
3236 Refer also to @ref{Command-Line Options}.
3238 @node Actions
3239 @section Actions
3240 @cindex actions
3241 @cindex translations
3242 @cindex key translations
3243 @cindex button translations
3244 @cindex X11 translations
3246 All user accessible commands may be bound to almost any @code{X} event. Almost
3247 no default binding for commands is done in the binaries, so it is vital for the
3248 application that at least a system-wide application resource file exists.
3249 This file normally resides in the @file{share/pcb} directory and
3250 is called @file{Pcb}. The bindings to which the manual refers to are the
3251 ones as defined by the shipped resource file. Besides binding an action to
3252 an X11 event, you can also execute any action command using a ":" command
3253 (see @ref{User Commands}).
3255 Take special care about translations related to the functions keys and the
3256 pointer buttons because most of the window managers use them too.
3257 Change the file according to your hardware/software environment.
3258 You may have to replace all occurances of @emph{baseTranslations} to
3259 @emph{translations} if you use a @code{X11R4} server.
3261 Passing @emph{Object} as an argument to an action routine causes the object
3262 at the cursor location to be changed, removed or whatever. If more than
3263 one object is located at the cross hair position the smallest type is used.
3264 If there are two of the same type the newer one is taken.
3265 @emph{SelectedObjects} will handle all selected and visible objects.
3268 @table @samp
3269 @findex AddRats()
3270 @cindex rats nest
3271 @cindex netlist
3272 @cindex rat-line
3273 @item AddRats(AllRats|SelectedRats)
3274 Adds rat-lines to the layout using the loaded netlist file (see the @emph{:rn},
3275 @ref{User Commands}.). Rat lines are added on the active layer using the current
3276 line thickness shown in the status line.
3277 Only missing connectivity is added by the
3278 AddRats command so if, for example, the layout is complete nothing will be added.
3279 Rat lines may be drawn different to other lines on the screen
3280 to make them easier to identify since they cannot appear in a completed layout.
3281 The rat-lines are added in the minimum length straight-line tree pattern
3282 (always ending on pins or pads) that satisfies the missing connectivity in the circuit.
3283 If a SMD pad is unreachable on the active layer, a warning will be issued
3284 about it and the rat-line to that pad will not be generated.
3285 If connections exist on the board which are not listed in the netlist while
3286 AllRats are being added, warning messages will be issued and the affected pins and
3287 pads will be drawn in a special @emph{warnColor} until the next @emph{Notify()} event.
3288 If the entire layout agrees completely with the net-list a message informs you that
3289 the layout is complete and no rat-lines are added (since none are needed).
3290 If @emph{SelectedRats}
3291 is passed as the argument, only those missing connections that might connect among
3292 the selected pins and pads are drawn.
3293 Default:
3294 @example
3295 None<Key>w:     AddRats(AllRats)
3296 !Shift<Key>w:   AddRats(SelectedRats)
3297 None<Key>o:     DeleteRats(AllRats) AddRats(AllRats)
3298 !Shift<Key>o:   DeleteRats(SelectedRats) AddRats(SelectedRats)
3299 @end example
3301 @findex ApplyVendor()
3302 @cindex vendor map
3303 @cindex vendor drill table
3304 @item ApplyVendor()
3305 Applies an already loaded vendor drill map to the design.
3306 @example
3307 ApplyVendor()
3308 @end example
3310 @findex Atomic()
3311 @cindex undo, multi-action resources
3312 @cindex atomic
3313 @item Atomic(Save|Restore|Block|Close)
3314 Controls the undo grouping of sequences of actions. Before the first action
3315 in a group, Atomic(Save) should be issued.  After each action that might
3316 be undoable, Atomic(Restore) should be issued.  Atomic(Block) concludes
3317 and save the undo grouping if there was anything in the group to undo.
3318 Atomic(Close) concludes and save the undo grouping even if nothing was
3319 actually done.  Thus it might produce an "empty" undo.  This can be useful
3320 when you want to use undo in a group of actions.
3322 @findex Bell()
3323 @cindex signal
3324 @cindex bell
3325 @item Bell([-100..100])
3326 Rings the bell of your display. If no value is passed the setting
3327 of the resource @emph{volume} will be used.
3329 @findex ChangeClearSize()
3330 @cindex change sizes
3331 @cindex sizes, changing of objects
3332 @cindex clearance, changing of objects
3333 @item ChangeClearSize(Object, value[, unit])
3334 @itemx ChangeClearSize(SelectedPins|SelectedVias, value[, unit])
3335 The effect of this action depends on if the soldermask display is presently
3336 turned on or off. If soldermask is displayed, then the soldermask
3337 relief size will be changed.  If soldermask display is turned off,
3338 then the clearance to polygons will be changed.
3339 @emph{unit} is "mil" or "mm".  If not specified the units will default
3340 to the internal unit of 0.01 mil.
3341 @example
3342 !Mod1<Key>k:      ChangeClearSize(Object, +2, mil)
3343 !Mod1 Shift<Key>k: ChangeClearSize(Object, -2, mil)
3344 @end example
3346 @findex ChangeDrillSize()
3347 @cindex change sizes
3348 @cindex sizes, changing of objects
3349 @cindex drilling hole, changing of objects
3350 @item ChangeDrillSize(Object, value[, unit])
3351 @itemx ChangeDrillSize(SelectedPins|SelectedVias, value[, unit])
3352 This action routine changes the drilling hole of pins and vias.
3353 If @emph{value} starts with + or -, then it adds (or subtracts)
3354 @emph{value} from the current hole diameter, otherwise it sets the
3355 diameter to the value.
3356 @emph{unit} is "mil" or "mm".  If not specified the units will default
3357 to the internal unit of 0.01 mil.
3358 Default:
3359 @example
3360 !Mod1<Key>s:       Change2ndSize(Object, +5, mil)
3361 !Mod1 Shift<Key>s: Change2ndSize(Object, -5, mil)
3362 @end example
3364 @findex ChangeFlag()
3365 @cindex flags, changing
3366 @cindex octagonal flag, changing
3367 @cindex square flag, changing
3368 @cindex thermal flag, changing
3369 @itemx ChangeFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square,0|1)
3370 Sets/clears the indicated flag.  This adds/removes thermals, adds/removes the flag
3371 which indicates a pin/pad should be square, or adds/removes the flag which
3372 indicates a pin/pad should be octagonal.
3373 @example
3374 :ChangeFlag(SelectedVias,thermal,1)
3375 :ChangeFlag(SelectedPads,square,0)
3376 @end example
3378 @findex ChangeHole()
3379 @cindex vias, converting to mounting hole
3380 @cindex mounting holes
3381 @item ChangeHole(Object|SelectedVias)
3382 This action routine converts a via to and from a hole.  A hole is
3383 a via that has no copper annulus. The drill size for the via
3384 determines the hole diameter.
3385 @example
3386 !Ctrl<Key>h:    ChangeHole(Object)
3387 @end example
3389 @findex ChangeName()
3390 @cindex name, change an objects
3391 @cindex change object name
3392 @cindex object, change name of
3393 @item ChangeName(Object)
3394 @itemx ChangeName(Layer|Layout)
3395 Changes the name of the visible object at the cursor location. A text object
3396 doesn't have a name therefore the text string itself is changed.
3397 The element name currently used for display is always the one changed with this
3398 command.
3399 See @emph{Display(Description|NameOnPCB|Value)} for details.
3400 Passing @emph{Layer} changes the current layers name.
3401 Default:
3402 @example
3403 None<Key>n: ChangeName(Object)
3404 @end example
3406 @findex ChangeOctagon()
3407 @cindex pins, changing shape of
3408 @cindex vias, changing shape of
3409 @cindex octagonal pins and vias
3410 @itemx ChangeOctagon(Object|SelectElements|SelectedPins|SelectedVias|Selected)
3411 Toggles what shape the affected pin(s) or via(s) will be drawn when they
3412 are not square. The shape will either be round or octagonal.
3413 Default:
3414 @example
3415 !Ctrl<Key>o: ChangeOctagon(Object)
3416 @end example
3418 @findex ChangePinName()
3419 @cindex changing pin/pad names
3420 @cindex pin/pad names, changing
3421 @item ChangePinName(ElementName, PinNumber, PinName)
3422 Changes the name for a specified pin or pad number on a specified element.
3423 This action is typically used to forward annotate pin/pad names from a schematic
3424 to the layout.
3425 @example
3426 ChangePinName(U1, 14, VDD)
3427 @end example
3430 @findex ChangeSize()
3431 @cindex change sizes
3432 @cindex sizes, changing of objects
3433 @cindex thickness, changing of objects
3434 @item ChangeSize(Object, value[, unit])
3435 @itemx ChangeSize(SelectedLines|SelectedPins|SelectedVias, value[, unit])
3436 @itemx ChangeSize(SelectedPads|SelectedTexts|SelectedNames, value[, unit])
3437 @itemx ChangeSize(SelectedElements, value[, unit])
3438 To change the size of an object you have to bind these action to some
3439 @code{X} event (or use :ChangeSize(...)).  If @emph{value} begins with
3440 a + or - then the value will be added (or subtracted) from the current
3441 size, otherwise the size is set equal to @emph{value}. Range checking is
3442 done to insure that none of the maximum/minimums of any size are violated.
3443 If @emph{Object} is passed then a single object at the cursor location is
3444 changed. If any of the @emph{Selected} arguments are passed then all selected
3445 and visible objects of that type are changed. If the type being modified is
3446 an element, then the thickness of the silkscreen lines defining the element
3447 is changed.
3448 @emph{unit} is "mil" or "mm".  If not specified the units will default
3449 to the internal unit of 0.01 mil.
3450 Default:
3451 @example
3452 None<Key>s:   ChangeSize(Object, +5)
3453 !Shift<Key>s: ChangeSize(Object, -5)
3454 @end example
3456 @findex ChangeSquare()
3457 @cindex change square flag
3458 @cindex square flag, changing of objects
3459 @cindex thickness, changing of objects
3460 @item ChangeSquare(Object|SelectedElements|SelectedPins)
3461 Toggles the setting of the square flag. The flag is used to identify a
3462 certain pin, normally the first one, of circuits. It is also used to
3463 make SMD pads have square ends.
3464 @example
3465 None<Key>q:   ChangeSquare(Object)
3466 @end example
3468 @findex ClrFlag()
3469 @cindex flags, clearing
3470 @cindex flags, clearing
3471 @cindex octagonal flag, clearing
3472 @cindex square flag, clearing
3473 @cindex thermal flag, clearing
3474 @itemx ClrFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square)
3475 Clears the indicated flag.  This removes thermals, removes the flag
3476 which indicates a pin/pad should be square, or removes the flag which
3477 indicates a pin/pad should be octagonal.
3478 @example
3479 :ClrFlag(SelectedVias,thermal)
3480 @end example
3482 @findex Command()
3483 @cindex start user input
3484 @cindex inputfield, start user input
3485 @item Command()
3486 Calling @emph{Command()} pops up an input line at the bottom of the window
3487 which allows you to enter commands. Including all action commands!
3488 The dialog ends when @emph{None<Key>Return}
3489 to confirm or @emph{None<Key>Escape} to abort is entered.
3490 Default:
3491 @example
3492 <Key>colon: Command()
3493 @end example
3495 @findex Connection()
3496 @cindex scanning connections
3497 @cindex searching connections
3498 @cindex connections, reseting
3499 @cindex reseting found connections
3500 @cindex connections, searching for
3501 @cindex saving found connections
3502 @item Connection(Find)
3503 @itemx Connection(ResetFoundLinesAndRectangles|ResetPinsViasAndPads|Reset)
3504 The @emph{Connection()} action is used to mark all connections from one pin,
3505 line or via to others.
3506 The @emph{ResetFoundLinesAndRectangles, ResetFoundPinsAndVias} and
3507 @emph{Reset} arguments may be used to reset all marked lines and rectangles,
3508 vias and pins or all of them. The search starts with the pin or via
3509 at the cursor position. All found objects are drawn with the color
3510 defined by the resource @emph{connectedColor}.
3511 See also, @emph{Display(Description|NameOnPCB|Value)}.
3512 Default:
3513 @example
3514 !Shift<Key>c: Connection(Reset)
3515 None<Key>f:   Connection(Find)
3516 !Shift<Key>f: Connection(Reset)
3517 @end example
3519 @findex DeleteRats()
3520 @cindex rats nest
3521 @cindex rat-line
3522 @cindex netlist
3523 @item DeleteRats(AllRats|SelectedRats)
3524 This routine deletes either all rat-lines in the layout, or only
3525 the selected and visible ones. Non-rat-lines and other layout
3526 objects are unaffected.
3527 Default:
3528 @example
3529 None<Key>e:   DeleteRats(AllRats)
3530 !Shift<Key>e: DeleteRats(SelectedRats)
3531 @end example
3533 @findex DisableVendor()
3534 @cindex vendor map, disabling
3535 @cindex vendor drill table, disabling
3536 @item DisableVendor()
3537 Disables automatic drill size mapping to the loaded vendor drill table.
3538 @example
3539 DisableVendor()
3540 @end example
3542 @findex DisperseElements()
3543 @cindex dispersing elements
3544 @cindex distributing elements
3545 @cindex elements, dispersing
3546 @cindex elements, distributing
3547 @item DisperseElements(All|Selected)
3548 Disperses either all elements or only the selected elements in the
3549 layout.  This action should be used at the
3550 start of a design to spread out all footprints before any placement or
3551 routing is done.  
3552 @example
3553 DisperseElements(All)
3554 @end example
3557 @findex Display()
3558 @cindex centering
3559 @cindex redrawing layout
3560 @cindex refreshing layout
3561 @cindex name of an element
3562 @cindex displaying element names
3563 @cindex element, display names of
3564 @cindex grid, absolute and relative
3565 @cindex grid, display
3566 @cindex rubberband
3567 @cindex pinout, display of
3568 @cindex displaying pinout
3569 @cindex lines, clipping to 45 degree
3570 @cindex clipping lines to 45 degree
3571 @item Display(Description|NameOnPCB|Value)
3572 @itemx Display(Toggle45Degree|CycleClip)
3573 @itemx Display(Grid|ToggleGrid)
3574 @itemx Display(ToggleRubberBandMode)
3575 @itemx Display(Center|ClearAndRedraw|Redraw)
3576 @itemx Display(Pinout|PinOrPadName)
3577 This action routines handles some output related settings. It is
3578 used to center the display around the cursor location and to redraw the
3579 output area optionally after clearing the window.
3580 Centering is done with respect to the @emph{grid} setting. Displaying the
3581 grid itself may be switched on and off by @emph{Grid} but only if
3582 the distance between two pixels exceeds 4 pixels.
3583 @pcb{} is able to handle several labels of an element. One of them
3584 is a description of the functionality (eg resistor), the second should be
3585 a unique identifier (R1) whereas the last one is a value (100k).
3586 The @emph{Display()} action selects which of the names is displayed.
3587 It also controls which name will be affected by the @emph{ChangeName} command.
3588 If @emph{ToggleGrid} is passed, @pcb{} changes between relative
3589 ('rel' in the statusline) and absolute grid (an 'abs' in the statusline).
3590 Relative grid means the pointer position when the command is issued is
3591 used as the grid origin; while (0,0) is used in the absolute grid case.
3592 Passing @emph{Pinout} displays the pinout of the element at the current
3593 cursor location whereas @emph{PinOrPadName} toggles displaying of the
3594 pins or pads name under the cursor. If none of them matches but the cursor
3595 is inside of an element, the flags is toggled for all of its pins and pads.
3596 For details about rubberbands see also the details about @emph{Mode}.
3597 Default:
3598 @example
3599 None<Key>c:  Display(Center)
3600 None<Key>d:  Display(PinOrPadName)
3601 !Shift<Key>d: Display(Pinout)
3602 None<Key>r:  Display(ClearAndRedraw)
3603 None<Key>.:  Display(Toggle45Degree)
3604 None<Key>/:  Display(CycleClip)
3605 @end example
3607 @findex DRC()
3608 @cindex design rule checking
3609 @cindex drc
3610 @item DRC()
3611 Initiates design rule checking of the entire layout. Must be repeated
3612 until no errors are found.
3614 @findex ExecuteFile()
3615 @cindex actions file, executing
3616 @cindex script file, executing
3617 @itemx ExecuteFile(filename)
3618 Executes the PCB actions contained in the specified file.
3619 This can be used to automate a complex sequence of operations.
3620 @example
3621 :ExecuteFile(custom.cmd)
3622 @end example
3623 The command file contains a list of PCB actions.  Blank lines
3624 are ignored and lines starting with a # are treated as comment
3625 lines.  For example
3626 @example
3627 # This is a comment line
3628 Display(Grid)
3629 SetValue(Zoom,2)
3630 DRC()
3631 @end example
3633 @findex EditLayerGroups()
3634 @cindex layers, editing of groups
3635 @cindex groups, editing of
3636 @item EditLayerGroups()
3637 Pops up a dialog box to edit the layergroup setting. The function is also
3638 available from the @emph{Objects} menu.
3639 There are no defaults.
3641 @findex EnableVendor()
3642 @cindex vendor map, enabling
3643 @cindex vendor drill table, enabling
3644 @item EnableVendor()
3645 Enables automatic drill size mapping to the loaded vendor drill table.
3646 @example
3647 EnableVendor()
3648 @end example
3651 @findex Load()
3652 @cindex loading files
3653 @item Load(ElementToBuffer|Layout|LayoutToBuffer|Nelist)
3654 This routine pops up a fileselect box to load layout, element data,
3655 or netlist.
3656 The passed filename for layout data is saved and may be reused.
3657 @emph{ElementToBuffer} and @emph{LayoutToBuffer} load the data into the
3658 current buffer.
3659 There are no defaults.
3661 @findex LoadVendor()
3662 @cindex vendor map, loading
3663 @cindex vendor drill table, loading
3664 @item LoadVendor(vendorfile)
3665 Loads the specified vendor resource file.
3666 @example
3667 LoadVendor(myvendor.res)
3668 @end example
3670 @findex MarkCrosshair()
3671 @cindex mark
3672 @cindex cursor position
3673 @item MarkCrosshair()
3674 This routine marks the current cursor location with an X, and then
3675 the cursor display shows both absolute position and position relative to
3676 the mark.  If a mark is already present, this routine removes it and
3677 stops displaying relative cursor coordinates.
3678 Defaults:
3679 @example
3680 !Ctrl<key>m:    MarkCrosshair()
3681 @end example
3683 @findex Mode()
3684 @cindex mode, selecting of
3685 @cindex operation modes, selecting of
3686 @item Mode(Copy|InsertPoint|Line|Move|None|PasteBuffer|Polygon|Thermal)
3687 @itemx Mode(Remove|Rectangle|RubberbandMove|Text|Via)
3688 @itemx Mode(Cycle)
3689 @itemx Mode(Notify)
3690 @itemx Mode(Save|Restore)
3691 Switches to a new mode of operation. The active mode is displayed by a thick
3692 line around the matching mode selector button.
3693 Most of the functionality of @pcb{} is implemented by selecting a mode
3694 and calling @emph{Mode(Notify)}. The arguments @emph{Line}, @emph{Polygon},
3695 @emph{Rectangle}, @emph{Text} and @emph{Via} are used to create the
3696 appropriate object whenever @emph{Mode(Notify)} is called. Some of them,
3697 such as @emph{Polygon}, need more than one call for one object to be created.
3698 @emph{InsertPoint} adds points to existing polygons or lines.
3699 @emph{Save} and @emph{Restore} are used to temporarily save the mode, switch
3700 to another one, call @emph{Mode(Notify)} and restore the saved one. Have
3701 a look at the application resource file for examples.
3702 @emph{Copy} and @emph{Move} modes are used to change an object's location and,
3703 optionally, to create a new one. The first call of @emph{Mode(Notify)} attaches
3704 the object at the pointer location to the cross hair whereas the second
3705 one drops it to the layout. The @emph{rubberband} version of move performs the
3706 move while overriding the current rubberband mode.
3707 Passing @emph{PasteBuffer} attaches the contents of the currently selected
3708 buffer to the cross hair. Each call to @emph{Mode(Notify)} pastes this contents
3709 to the layout. @emph{Mode(Cycle)} cycles through the modes available in the
3710 mode-button pallet.
3711 @emph{Mode(None)} switches all modes off.
3712 Default:
3713 @example
3714 <Key>Escape:             Mode(None)
3715 <Key>space:              Mode(Cycle)
3716 None<Key>BackSpace:      Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore)
3717 None<Key>Delete:         Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore)
3718 None<Key>F1:             Mode(Via)
3719 None<Key>F2:             Mode(Line)
3720 None<Key>F3:             Mode(PasteBuffer)
3721 None<Key>F4:             Mode(Rectangle)
3722 None<Key>F5:             Mode(Text)
3723 None<Key>F6:             Mode(Polygon)
3724 None<Key>F7:             Mode(Thermal)
3725 None<Key>F8:             Mode(Arc)
3726 None<Key>Insert:         Mode(InsertPoint)
3727 None<Key>[:              Mode(Save) Mode(Move) Mode(Notify)
3728 None<Key>]:              Mode(Notify) Mode(Restore)
3729 None<Btn1>:          Mode(Notify)
3730 !Shift Ctrl<Btn1>:   Mode(Save) Mode(Remove) Mode(Notify) Mode(Restore)
3731 None<Btn2Down>:          Mode(Save) Mode(Move) Mode(Notify)
3732 None<Btn2Up>:            Mode(Notify) Mode(Restore)
3733 !Mod1<Btn2Down>:       Mode(Save) Mode(Copy) Mode(Notify)
3734 !Mod1<Btn2Up>:         Mode(Notify) Mode(Restore)
3735 Shift BTNMOD<Btn2Down>: Mode(Save) Mode(RubberbandMove) Mode(Notify)
3736 @end example
3738 @findex MovePointer()
3739 @cindex pointer, moving of
3740 @cindex cursor movements
3741 @item MovePointer(delta_x, delta_y)
3742 With this function it is possible to move the cross hair cursor by using the
3743 cursor keys. The @code{X} server's pointer follows because the necessary
3744 events are generated by @pcb{}. All movements are performed with respect
3745 to the currently set grid value.
3746 Default:
3747 @example
3748 None<Key>Up:      MovePointer(0, -1)
3749 !Shift<Key>Up:    MovePointer(0, -10)
3750 None<Key>Down:    MovePointer(0, 1)
3751 !Shift<Key>Down:  MovePointer(0, 10)
3752 None<Key>Right:   MovePointer(1, 0)
3753 !Shift<Key>Right: MovePointer(10, 0)
3754 None<Key>Left:    MovePointer(-1, 0)
3755 !Shift<Key>Left:  MovePointer(-10, 0)
3756 @end example
3758 @findex MoveToCurrentLayer()
3759 @cindex objects, moving to current layer
3760 @cindex moving objects to current layer
3761 @item MoveToCurrentLayer(Object|SelectedObjects)
3762 The function moves a single object at the cross hair location or all selected
3763 objects to the current layer. Elements are not movable by this function.
3764 They have to be deleted and replaced on the other side.
3765 If a line segment is moved and the movement would result in a loss of
3766 connectivity to another segment then via(s) are automatically added to
3767 maintain the connectivity.
3768 @example
3769 None<Key>m:       MoveToCurrentLayer(Object)
3770 !Shift<Key>m:     MoveToCurrentLayer(SelectedObjects)
3771 @end example
3773 @findex New()
3774 @cindex layout, start a new
3775 @cindex starting a new layout
3776 @item New()
3777 Clear the current layout and starts a new one after entering its name.
3778 Refer to the resource @emph{backup} for more information.
3779 No defaults.
3781 @findex PasteBuffer()
3782 @cindex buffer, selecting a
3783 @cindex pastebuffer, selecting a
3784 @cindex selecting a buffer
3785 @cindex rotating a buffer
3786 @cindex cutting objects
3787 @cindex copying objects
3788 @item PasteBuffer(AddSelected|Clear|1..5)
3789 @itemx PasteBuffer(Rotate, 1..3)
3790 @itemx PasteBuffer(Convert)
3791 This action routine controls and selects the pastebuffer as well as all
3792 cut-and-paste operations. Passing a buffer number selects one in of the
3793 range 1..5. The statusline is updated with the new number.
3794 @emph{Rotate} performs a number of 90 degree counter clockwise rotations
3795 of the buffer contents. @emph{AddSelected} as first argument copies all
3796 selected and visible objects into the buffer. Passing @emph{Clear} removes
3797 all objects from the currently selected buffer. @emph{Convert} causes
3798 the contents of the buffer (lines, arc, vias) to be converted into an
3799 element definition. Refer to @ref{Pastebuffer}
3800 for examples.
3801 Default:
3802 @example
3803 !Ctrl<Key>x:       PasteBuffer(Clear) PasteBuffer(AddSelected)
3804                    Mode(PasteBuffer)
3805 !Shift Ctrl<Key>x: PasteBuffer(Clear) PasteBuffer(AddSelected)
3806                    RemoveSelected() Mode(PasteBuffer)
3807 !Mod1<Key>c:       PasteBuffer(Clear) PasteBuffer(AddSelected)
3808 !Mod1<key>x:       PasteBuffer(Clear) PasteBuffer(AddSelected)
3809                    RemoveSelected()
3810 !Shift<Key>1:      PasteBuffer(1)
3811 !Shift<Key>2:      PasteBuffer(2)
3812 !Shift<Key>3:      PasteBuffer(3)
3813 !Shift<Key>4:      PasteBuffer(4)
3814 !Shift<Key>5:      PasteBuffer(5)
3815 None<Key>F3:       Mode(PasteBuffer)
3816 @end example
3818 @findex Polygon()
3819 @cindex polygon, closing a
3820 @cindex polygon point, go back to previous
3821 @cindex closing a polygon
3822 @item Polygon((Close|PreviousPoint)
3823 Polygons need a special action routine to make life easier. Calling
3824 @emph{Polygon(PreviousPoint)} resets the newly entered corner to the
3825 previous one. The Undo action will call Polygon(PreviousPoint)
3826 when appropriate to do so.  @emph{Close} creates the final
3827 segment of the polygon.  This may fail if clipping to 45 degree
3828 lines is switched on, in which case a warning is issued.
3829 Default:
3830 @example
3831 None<Key>p:             Polygon(Close)
3832 !Shift<Key>p:           Polygon(Close)
3833 @end example
3835 @findex Print()
3836 @cindex layout, printing a
3837 @cindex printing a layout
3838 @item Print()
3839 Pops up a print control box that lets you select the output
3840 device, scaling and many more options. Each run creates all
3841 files that are supported by the selected device. These are
3842 mask files as well as drilling files, silk screens and so on. The table
3843 shows the filenames for all possible files:
3844 @example
3845         POSIX (extension)             8.3 filename
3846                 ---------------------------------------------
3847                 *_componentmask.*             cmsk.*
3848                 *_componentsilk.*             cslk.*
3849                 *_soldermask.*                smsk.*
3850                 *_soldersilk.*                sslk.*
3851                 *_drill.*                     dril.*
3852                 *_groundplane.*               gpl.*
3853                 *_group[1..8].*     [..8].*
3854 @end example
3855 The output may be sent to a post-processor by starting the filename with the
3856 @emph{pipe} @code{("|")} character. Any @code{"%f"} in a command is replaced
3857 with the current filename. The function is available from the @emph{file} menu.
3858 There are no defaults.
3860 @findex Quit()
3861 @cindex quit
3862 @cindex exit
3863 @item Quit()
3864 Quits the application after confirming the operation.
3865 Default:
3866 @example
3867 <Message>WM_PROTOCOLS: Quit()
3868 @end example
3870 @findex Redo()
3871 @cindex redo
3872 @cindex recover
3873 @item Redo()
3874 This routine allows you to recover from the last undo command.
3875 You might want to do this if you thought that undo was going to
3876 revert something other than what it actually did (in case you
3877 are confused about which operations are un-doable), or if you
3878 have been backing up through a long undo list and over-shoot
3879 your stopping point.  Any change that is made since the undo
3880 in question will trim the redo list.  For example if you add
3881 ten lines, then undo three of them you could use redo to put
3882 them back, but if you move a line on the board before performing
3883 the redo, you will lose the ability to "redo" the three "undone" lines.
3884 Default:
3885 @example
3886 !Shift<Key>r:   Redo()
3887 @end example
3889 @findex RemoveSelected()
3890 @cindex removing selected objects
3891 @cindex selected object, removing an
3892 @item RemoveSelected()
3893 This routine removes all visible and selected objects.
3894 There are no defaults.
3896 @findex Report()
3897 @cindex report
3898 @cindex information about objects
3899 @cindex drill
3900 @item Report(Object|DrillReport)
3901 This routine pops up a dialog box describing the various
3902 characteristics of an object (or piece of an object such as a pad or pin)
3903 in the layout at the cursor position, or a report about all of the
3904 drill holes in the layout.
3905 There are no defaults.
3907 @findex RouteStyle()
3908 @cindex routing style
3909 @cindex size of lines and vias
3910 @item RouteStyle(1|2|3|4)
3911 This routine copies the sizes corresponding to the numbered route style
3912 into the active line thickens, via diameter, and via drill size.
3913 Defaults:
3914 @example
3915 !Ctrl<Key>1: RouteStyle(1)
3917 !Ctrl<Key>NUM_STYLES: RouteStyle(NUM_STYLES)
3918 @end example
3919 The variable @code{NUM_STYLES} is set at compile time in
3920 @file{globalconfig.h}.
3922 @findex Save()
3923 @cindex saving files
3924 @cindex saving connections
3925 @item Save(Layout|LayoutAs)
3926 @itemx Save(AllConnections|AllUnusedPins|ElementConnections)
3927 Passing @emph{Layout} saves the layout using the file from which it was
3928 loaded or, if it is a new layout, calls @emph{Save(LayoutAs)} which queries
3929 the user for a filename.
3930 The values: @emph{AllConnections}, @emph{AllUnusedPins} and
3931 @emph{ElementConnections} start a connection scan and save all connections,
3932 all unused pins or the connections of a single element to a file.
3933 There are no defaults.
3935 @findex Select()
3936 @cindex selection
3937 @cindex selecting objects
3938 @item Select(All|Block|Connection|ToggleObject)
3939 @itemx Select(ElementByName|ObjectByName|PadByName|PinByName)
3940 @itemx Select(TextByName|ViaByName)
3941 Toggles either the selection flag of the object at the cross hair position
3942 (@emph{ToggleObject}) or selects all visible objects, all inside a
3943 rectangle or all objects which have been found during the last connection
3944 scan. The @emph{ByName} functions use a @ref{Regular Expressions} search,
3945 always case insensitive, to select the objects.
3946 Default:
3947 @example
3948 None<Btn3Down>:  Select(ToggleObject)
3949 None<Btn3Down>,None<Btn3Motion>: See resource file - this is complex
3950 @end example
3952 @findex SetFlag()
3953 @cindex flags, setting
3954 @cindex octagonal flag, setting
3955 @cindex square flag, setting
3956 @cindex thermal flag, setting
3957 @itemx SetFlag(Object|SelectElements|SelectedPins|SelectedVias|Selected,thermal|octagon|square)
3958 Sets the indicated flag.  This adds thermals, sets the flag
3959 which indicates a pin/pad should be square, or sets the flag which
3960 indicates a pin/pad should be octagonal.
3961 @example
3962 :SetFlag(Selected,thermal)
3963 @end example
3965 @findex SetValue()
3966 @cindex change settings
3967 @cindex zoom, setting of
3968 @cindex grid, setting of
3969 @cindex drilling hole, setting of initial size
3970 @cindex vias, setting of initial size
3971 @cindex lines, setting of initial size
3972 @item SetValue(Grid|LineSize|TextScale|ViaDrillingHole|ViaSize|Zoom, value)
3973 Some internal values may be changed online by this function.
3974 The first parameter specifies which data has to be changed. The other one
3975 determines if the resource is set to the passed value, if @emph{value} is
3976 specified without sign, or increments/decrements if it is specified with
3977 a plus or minus sign.
3978 The function doesn't change any existing object only the initial values of
3979 new objects.  Use the @emph{ChangeSize()} and @emph{ChangeDrillSize()}
3980 to change existing objects.
3981 Default:
3982 @example
3983 None<Key>g:        SetValue(Grid, +5)
3984 !Shift<Key>g:      SetValue(Grid, -5)
3985 None<Key>l:        SetValue(LineSize, +5)
3986 !Shift<Key>l:      SetValue(LineSize, -5)
3987 None<Key>t:        SetValue(TextScale, +10)
3988 !Shift<Key>t:      SetValue(TextScale, -10)
3989 None<Key>v:        SetValue(ViaSize, +5)
3990 !Shift<Key>v:      SetValue(ViaSize, -5)
3991 !Mod1<Key>v:       SetValue(ViaDrillingHole, +5)
3992 !Mod1 Shift<Key>v: SetValue(ViaDrillingHole, -5)
3993 None<Key>z:        SetValue(Zoom, -1)
3994 !Shift<Key>z:      SetValue(Zoom, +1)
3995 @end example
3997 @findex SwapSides()
3998 @cindex change viewing side
3999 @cindex viewing side, changing of
4000 @item SwapSides()
4001 This routine changes the board side you are viewing.
4002 Default:
4003 @example
4004 None<Key>Tab:      SwapSides()
4005 @end example
4007 @findex SwitchDrawingLayer()
4008 @cindex change drawing layer
4009 @cindex layer, change active
4010 @item SwitchDrawingLayer(value)
4011 Makes layer number 1..MAX_LAYER the current one.
4012 Default:
4013 @example
4014 None<Key>1:        SwitchDrawingLayer(1)
4016 None<Key>MAX_LAYER:        SwitchDrawingLayer(MAX_LAYER)
4017 @end example
4019 @findex ToggleHideName()
4020 @cindex hide element name
4021 @cindex element name, hiding
4022 @cindex element name, removing from silk-screen
4023 @item ToggleHideName(Object|SelectedElements)
4024 Toggles whether the element's name is displayed or hidden. If it
4025 is hidden you won't see it on the screen and it will not appear
4026 on the silk layer when you print the layout.
4027 @example
4028 None<Key>h:     ToggleHideName(Object)
4029 !Shift<Key>h:   ToggleHideName(SelectedElements)
4030 @end example
4032 @findex ToggleVendor()
4033 @cindex vendor map, toggling
4034 @cindex vendor drill table, toggling
4035 @item ToggleVendor()
4036 Toggles automatic drill size mapping to the loaded vendor drill table.
4037 @example
4038 ToggleVendor()
4039 @end example
4041 @findex ToggleVisibility()
4042 @cindex toggle layer visibility
4043 @cindex layer visibility, toggling
4044 @item ToggleVisibility(Layer)
4045 Toggles the visibility of the layer.
4046 @example
4047 Mod1<Key>1:     ToggleVisibility(1)
4048 Mod1<Key>2:     ToggleVisibility(2)
4049 Mod1<Key>3:     ToggleVisibility(3)
4050 Mod1<Key>4:     ToggleVisibility(4)
4051 @end example
4053 @findex Undo()
4054 @cindex undo
4055 @cindex recover
4056 @item Undo()
4057 @itemx Undo(ClearList)
4058 The unlimited undo feature of @pcb{} allows you to recover
4059 from most operations that materially affect you work.
4060 Calling @emph{Undo()} without any parameter recovers
4061 from the last (non-undo) operation. @emph{ClearList} is used to release the
4062 allocated memory. @emph{ClearList} is called whenever a new layout is started
4063 or loaded. See also @emph{Redo}.
4064 Default:
4065 @example
4066 None<Key>u:        Undo()
4067 !Shift Ctrl<Key>u: Undo(ClearList)
4068 @end example
4070 @findex UnloadVendor()
4071 @cindex vendor map, unloading
4072 @cindex vendor drill table, unloading
4073 @item UnloadVendor()
4074 Unloads the loaded vendor drill table.
4075 @example
4076 UnloadVendor()
4077 @end example
4079 @findex Unselect()
4080 @cindex selection
4081 @cindex unselect objects
4082 @item Unselect(All|Block|Connection)
4083 Unselects all visible objects, all inside a rectangle or all objects which
4084 have been found during the last connection scan.
4085 Default:
4086 @example
4087 !Shift <Btn3Down>: Mode(Save) Mode(None) Unselect(Block)
4088 !Shift <Btn3Up>:   Unselect(Block) Mode(Restore)
4089 @end example
4091 @end table
4094 @node Translations
4095 @section Default Translations
4096 @cindex translations
4097 @cindex default translations
4098 @cindex X11 default translations
4100 This section covers some default translations of key and button events as
4101 defined in the shipped default application resource file. Most of them have
4102 already been listed in @ref{Actions}. @pcb{} makes use of a nice @code{X11}
4103 feature; calling several action routines for one event.
4105 @table @samp
4107 @cindex removing objects
4108 @cindex removing connections
4109 @cindex object, removing an
4110 @cindex connection, removing an
4111 @item  None<Key>BackSpace:
4112 @item  None<key>Delete:
4113 @itemx !Shift<Key>BackSpace:
4114 @itemx !Shift Ctrl<Btn1>:
4115 The object at the cursor location is removed by @emph{None<Key>BackSpace} or
4116 @emph{Shift Ctrl<Btn1>} whereas @emph{Shift<Key>BackSpace} also removes
4117 all other objects that are fully-connected to the one at the cursor location.
4119 @cindex scrolling
4120 @item  !Mod1 Ctrl<Key>Left:
4121 @itemx !Mod1 Ctrl<Key>Right:
4122 @itemx !Mod1 Ctrl<Key>Up:
4123 @itemx !Mod1 Ctrl<Key>Down:
4124 Scroll one page in one of the four directions.
4126 @cindex scrolling
4127 @item  None<Key>Left:, !Shift<Key>Left:
4128 @itemx None<Key>Right:, !Shift<Key>Right:
4129 @itemx None<Key>Up:, !Shift<Key>Up:
4130 @itemx None<Key>Down:, !Shift<Key>Down:
4131 Move cross hair either one or ten points in grid.
4133 @cindex user input
4134 @item None<Key>Return:
4135 Finished user input, selects the 'default' button of dialogs.
4137 @cindex user input
4138 @item None<Key>Escape:
4139 @emph{Mode(Reset)}, aborts user input, selects the 'abort' button of
4140 dialogs or resets all modes.
4142 @cindex element, move name of
4143 @cindex object, move an
4144 @cindex object, copy an
4145 @cindex move an object
4146 @cindex copy an object
4147 @item None<Btn2Down>, Btn2<Motion>, None<Btn2Up>:
4148 @itemx !Mod1<Btn2Down>, Btn2<Motion>, !Mod1<Btn2Up>:
4149 The first sequence moves the object or element name at the cursor location.
4150 The second one copies the objects. Copying isn't available for
4151 element names.
4153 @end table
4156 @c --------------------------- chapter 6 -------------------------------
4157 @node File Formats
4158 @chapter File Formats
4159 @cindex file formats
4160 @cindex ASCII files, format of
4162 All files used by @pcb{} are read from the standard output of a command
4163 or written to the standard input of one as plain seven bit @code{ASCII}. This
4164 makes it possible to use any editor to change the contents of a layout file.
4165 It is the only way for element or font description files to be created.
4166 To do so you'll need to study the example files @file{example/*} and
4167 @file{default_font} which are shipped with @pcb{}.
4168 For an overview refer to @ref{Intro}.
4170 @vindex elementCommand
4171 @vindex fileCommand
4172 @vindex fontCommand
4173 @vindex libraryCommand
4174 @vindex libraryContentsCommand
4175 @vindex saveCommand
4176 The following sections provide the necessary information about the syntax of
4177 the files.
4178 Netlist files are not created by @pcb{}, but it does use them. For information
4179 on the format of a netlist file see the @emph{:rn},
4180 @ref{User Commands}.
4181 The commands described allow you to add almost any additional
4182 functionality you may need. Examples are compressed read and write access as
4183 well as archives. The commands themselves are defined by the resources
4184 @emph{elementCommand}, @emph{fileCommand}, @emph{fontCommand},
4185 @emph{libraryCommand}, @emph{libraryContentsCommand} and @emph{saveCommand}.
4186 Note that the commands are not saved along with the data.
4187 It is considered an advantage to have the layout file contain all necessary
4188 information, independent of any other files.
4190 One thing common to all files is they may include comments, newlines,
4191 and carriage returns at any place except within quoted strings.
4193 @menu
4194 * Pad and Line Representation::
4195 * Layout File::
4196 * Element File::
4197 * Font File::
4198 * Netlist File::
4199 * Library Contents File::
4200 * Library File::
4201 * File Syntax::
4202 * Object Flags::
4203 * PCBFlags::
4204 @end menu
4208 @node Pad and Line Representation
4209 @section Pad and Line Representation
4210 @cindex pad specification
4211 @cindex file formats, pads and lines
4213 Pads and lines (copper traces, silk screen lines, etc) are represented by the
4214 line end points and the aperture used to draw the line.  It is important to 
4215 understand this when creating the pads for a new footprint.  The following figure
4216 illustrates a pad or line which is drawn using a square aperture.  The end
4217 points (X0,Y0), (X1,Y1) specify the center of the aperture.  The size parameter
4218 specifies the size of the aperture.
4220 @center @image{pad,,,Pad Layout,png}
4222 Pads and lines are represented in this way because this is how lines are 
4223 specified in RS-274X (Gerber) files which are used for creating
4224 the masks used in board manufacturing.  In fact, older mask making
4225 equipment created lines in precisely this fashion.  A physical aperture was
4226 used to pass light through onto a photosensitive film.
4228 @node Layout File
4229 @section Layout File Format
4230 @cindex layout files, format of
4231 @cindex format of layout files
4232 @cindex file format, layout data
4234 The layout file describes a complete layout including symbols, vias,
4235 elements and layers with lines, rectangles and text. This is the most
4236 complex file of all.  As @pcb{} has evolved, the file format has
4237 changed several times to accommodate new features.  @pcb{} has
4238 always been able to read all older versions of the @code{.pcb} file.
4239 This allows the migration of older designs to newer versions of the
4240 program.  Obviously older versions of @pcb{} will not be able
4241 to properly read layout files stored in newer versions of the file
4242 format.
4244 In practice it is very common for footprint libraries to contain
4245 elements which have been defined in various versions of the @pcb{}
4246 file format.  When faced with trying to understand an element file or
4247 layout file which includes syntax not defined here, the best approach
4248 is to examine the file @file{src/parse_y.y} which is the definitive
4249 definition of the file format.
4251 The PCB layout file contains the following contents, in this order (individual items
4252 are defined in @ref{File Syntax}:
4254 @table @code
4256 @item PCB
4257 This names the board and sets its size
4259 @item Grid
4260 Optional.
4262 @item Cursor
4263 Optional.
4265 @item Flags
4266 Optional.
4268 @item Groups
4269 Optional.
4271 @item Styles
4272 Optional.
4274 @item Symbols
4275 Optional.
4277 @item Vias, Rats, Layers, and Elements
4278 These may occur in any order, at this point in the file.
4280 @item Netlists
4281 Optional.
4283 @end table
4285 @node Element File
4286 @section Element File Format
4287 @cindex element, file format
4288 @cindex format of element files
4289 @cindex file format, element data
4291 Element files are used to describe one component which then may be used
4292 several times within one or more layouts. You will normally split the
4293 file into two parts, one for the pinout and one for the package description.
4294 Using @code{m4} allows you to define pin names as macros in one file and
4295 include a package description file which evaluates the macros. See
4296 the resource @emph{elementCommand} for more information. The pins (and pads)
4297 must appear in sequential order in the element file (new in 1.5) so that
4298 pin 1 must be the first PIN(...) in the file.
4300 Doing things this way makes it possible to use one package file for several
4301 different circuits. See the sample files @file{dil*}.
4303 The lowest x and y coordinates of all sub-objects of an element are
4304 used as an attachment point for the cross hair cursor of the main
4305 window, unless the element has a mark, in which case that's the
4306 attachment point.
4310 @node Font File
4311 @section Font File Format
4312 @cindex font file, format of
4313 @cindex format of font files
4314 @cindex file format, font data
4316 A number of user defined Symbols are called a font. There is only one per
4317 layout. All symbols are made of lines. See the file @file{default_font}
4318 as an example.
4320 The lowest x and y coordinates of all lines of a font are transformed to (0,0).
4322 @node Netlist File
4323 @section Netlist File Format
4324 @cindex netlist, file format
4325 @cindex netlist, reading
4327 Netlists read by @pcb{} must have this simple text form:
4329 @example
4330 netname [style] NAME-PINNUM NAME2-PINNUM2 NAME3-PINNUM3 ... [\]
4331 @end example
4333 @noindent
4334 for each net on the layout.
4335 where "netname" is the name of the net which must be unique for each
4336 net, [style] is an optional route-style name,
4337 NAME is the layout-name name given to an element,
4338 and PINNUM is the (usually numeric)
4339 pin number of the element that connects to the net
4340 (for details on pin numbering see @ref{Element Objects}).
4341 Spaces or tabs separate the fields.
4342 If the line ends with a "\" the
4343 net continues on the next line and the "\" is treated exactly as if it
4344 were a space.  If a NAME ends with a lower-case letter,
4345 all lower-case letters are stripped from the end of the NAME to determine the
4346 matching layout-name name.  For example:
4348 @example
4349      Data U1-3 U2abc-4 FLOP1a-7 Uabc3-A9
4350 @end example
4352 specifies that the net called "Data" should have
4353 pin 3 of U1 connected to pin 4 of U2, to pin 7 of
4354 FLOP1 and to pin A9 of Uabc3.  Note that element name and
4355 pin number strings are case-sensitive.
4356 It is up to you to name the elements so that their layout-name names
4357 agrees with the netlist.
4359 @node Library Contents File
4360 @section Library Contents File Format
4361 @cindex library contents file, format of
4362 @cindex format of library contents
4363 @cindex file format, library contents
4365 There is nothing like a special library format. The ones that have been
4366 introduced in 1.4.1 just use some nice (and time consuming) features of GNU
4367 @code{m4}. The only predefined format is the one of the contents file
4368 which is read during startup. It is made up of two basic line types:
4370 @example
4371 menu entry      = "TYPE="name
4372 contents line   = template":"package":"value":"description
4373 name            = String
4374 template        = String
4375 package         = String
4376 value           = String
4377 description     = String
4378 String          = <anything except ":", "\n" and "\r">
4379 @end example
4381 No leading white spaces or comments are allowed in this file. If you need
4382 either one, define a command that removes them before loading. Have a look
4383 to the @emph{libraryContentsCommand} resource.
4385 The menu entry will appear in the selection menu at the top and of the
4386 library window.
4388 @node Library File
4389 @section Library File Format
4390 @cindex library file, format of
4391 @cindex format of libraries
4392 @cindex file format, libraries
4394 This section provides an overview about the existing @code{m4} definitions
4395 of the elements. There are basically two different types of files. One
4396 to define element specific data like the pinout, package and so on, the
4397 other to define the values. For example the static RAM circuits 43256 and
4398 62256 are very similar. They therefore share a common definition in the
4399 macro file but are defined with two different value labels.
4401 The macro file entry:
4402 @example
4403 define(`Description_43256_dil', `SRAM 32Kx8')
4404 define(`Param1_43256_dil', 28)
4405 define(`Param2_43256_dil', 600)
4406 define(`PinList_43256_dil', ``pin1', `pin2', ...')
4407 @end example
4409 And the list file:
4410 @example
4411 43256_dil:N:43256:62256
4412 @end example
4414 The macro must define a description, the pin list and up to two additional
4415 parameters that are passed to the package definitions. The first one is
4416 the number of pins whereas the second one defines for example the width
4417 of a package.
4419 It is very important to select a unique identifier for each macro. In
4420 the example this would be @emph{43256_dil} which is also the templates name.
4421 It is required by some low-level macros that
4422 @emph{Description_, Param1_, Param2_} and @emph{PinList_} are perpended.
4424 The list file uses a syntax:
4425 @example
4426 template:package:value[:more values]
4427 @end example
4429 This means that the shown example will create two element entries with the
4430 same package and pinout but with different names.
4432 A number of packages are defined in @file{common.m4}. Included are:
4434 @example
4435 DIL packages with suffix D, DW, J, JD, JG, N, NT, P
4436 PLCC
4438 generic connectors
4439 DIN 41.612 connectors
4440 zick-zack (SD suffix)
4441 15 pin multiwatt
4442 @end example
4444 If you are going to start your own library please take care about @code{m4}
4445 functions. Be aware of quoting and so on and, most important check your
4446 additional entry by calling the macro:
4448 @example
4449 CreateObject(`template', `value', `package suffix')
4450 @end example
4452 If quoting is incorrect an endless loop may occur (broken by a out-of-memory
4453 message).
4455 The scripts in the @file{lib} directory handle the creation of libraries
4456 as well as of their contents files. Querying is also supported.
4458 I know quite well that this description of the library implementation is
4459 not what some out there expect. But in my opinion it's much more useful to
4460 look at the comments and follow the macros step by step.
4462 @node File Syntax
4463 @section File Syntax
4464 @cindex File sytax
4465 @cindex Syntax, file
4467 @include pcbfile.texi
4469 @c --------------------------- chapter 7 -------------------------------
4470 @node Library Creation
4471 @chapter Library Creation
4472 @cindex library creation
4474 This chapter provides a detailed look at how footprint libraries are
4475 created and used.  The chapter is split into two section, the first
4476 section covers the "old" style libraries which use the @code{m4} macro
4477 processor and the second section covers the "new" style libraries.
4479 Despite the names "old" and "new", both styles of libraries are useful
4480 and the "old" style should not be discounted because of its name.  The
4481 advantage of the old style libraries is that one can define a family of
4482 footprints, say a DIP package, and then quickly produce all the members
4483 of that family.  Because the individual packages make use of a base
4484 definition, corrections made to the base definition propagate to all the
4485 members of a family.  The primary drawback to using this library
4486 approach is that the effort to create a single footprint is more than a
4487 graphical interface and may take even longer if the user has not used
4488 the @code{m4} macro language previously.
4490 The new style of footprint libraries stores each footprint in its own
4491 file.  The footprints are created graphically by placing pads and then
4492 converting a group of pads to a component.  This library method has the
4493 advantage of being quick to learn and it is easily to build single
4494 footprints quickly.  If you are building a family of parts, however, the
4495 additional effort in creating each one individually makes this approach
4496 undesirable.  In addition, creating a part with a large pin count
4497 can be quite tedious when done by hand.
4500 @section Old Style (m4) Libraries
4501 The old style libraries for pcb use the @code{m4} macro processor to
4502 allow the definition of a family of parts.  There are several files
4503 associated with the old style library.  The file @file{common.m4} is the
4504 top level file associated with the library.  @file{common.m4} defines a
4505 few utility macros which are used by other portions of the library,
4506 and then includes a predefined set of library files (the lines like
4507 @code{include(geda.inc)}).
4509 @subsection Overview of Oldlib Operation
4510 The big picture view of the old style library system is that the library
4511 is simply a collection of macro definitions.  The macros are written in
4512 the @code{m4} macro language.  An example of a macro and what it expands
4513 to is the following.  One of the predefined footprints in the library
4514 which comes with PCB is the @code{PKG_SO8} macro.  Note that all the
4515 footprint macros begin with @code{PKG_}.  For this particular example,
4516 @code{PKG_SO8} is a macro for an 8-pin small outline surface mount
4517 package.  All of the footprint macros take 3 arguments.  The first is the
4518 canonical name of the footprint on the board.  In this case "SO8" is an
4519 appropriate name.  The second argument is the reference designator on
4520 the board such as "U1" or "U23".  The third and final argument is the
4521 value.  For an integrated circuit this is usually the part number such
4522 as "MAX4107" or "78L05" and for a component such as a resistor or
4523 capacitor it is the resistance or capacitance.  The complete call to the
4524 macro in our example is @samp{PKG_SO8(SO8, U1, MAX4107)}.  When
4525 processed by @code{m4} using the macros defined in the PCB library, this
4526 macro expands to
4527 @example
4528 Element(0x00 "SO8" "U1" "MAX4107" 146 50 3 100 0x00)
4530         Pad(10 25 38 25 20 "1" 0x00)
4531         Pad(10 75 38 75 20 "2" 0x100)
4532         Pad(10 125 38 125 20 "3" 0x100)
4533         Pad(10 175 38 175 20 "4" 0x100)
4534         Pad(214 175 242 175 20 "5" 0x100)
4535         Pad(214 125 242 125 20 "6" 0x100)
4536         Pad(214 75 242 75 20 "7" 0x100)
4537         Pad(214 25 242 25 20 "8" 0x100)
4538         ElementLine(0 0 151 0 10)
4539         ElementArc(126 0 25 25 0 180 10)
4540         ElementLine(101 0 252 0 10)
4541         ElementLine(252 0 252 200 10)
4542         ElementLine(252 200 0 200 10)
4543         ElementLine(0 200 0 0 10)
4544         Mark(29 25)
4546 @end example
4547 which is the actual definition of the footprint that the PCB program
4548 works with.  As a user of PCB the only time you will need or want to run
4549 @code{m4} directly is when you are debugging a new library addition.  In
4550 normal operation, the calls to @code{m4} are made by helper scripts that
4551 come with PCB.
4553 Tools such as @code{gsch2pcb} (used to interface the gEDA schematic
4554 capture program to PCB layout) will call @code{m4} to produce an initial
4555 PCB layout that includes all the components on a schematic.  In
4556 addition, when manually instantiating parts from within PCB, @code{m4}
4557 will be called by PCB's helper scripts to produce the footprints.
4559 @subsection The Library Scripts
4560 There are several scripts that are used for processing the m4
4561 libraries.  This section briefly describes these scripts and details how
4562 they are used by PCB.
4564 @subsubsection Scripts Used During Compilation
4565 The scripts described in this section are used during compilation of
4566 PCB.  They are run automatically by the build system, but are described
4567 here to help document the complete library processing that occurs.
4568 During the build of PCB, the following actions are taken.  The
4569 @code{CreateLibrary.sh} script is run to produce an M4 "frozen file".
4570 This frozen file is simply a partially processed M4 input file which can
4571 be loaded by M4 more quickly than the original input file.
4573 A typical call to @code{CreateLibrary.sh} used during the compilation of
4574 PCB is:
4575 @example
4576 ./CreateLibrary.sh -I . pcblib ./common.m4 TTL_74xx_DIL.m4
4577 connector.m4 crystal.m4 generic.m4 genericsmt.m4 gtag.m4
4578 jerry.m4 linear.m4 logic.m4 lsi.m4 memory.m4 optical.m4 pci.m4
4579 resistor_0.25W.m4 resistor_adjust.m4 resistor_array.m4
4580 texas_inst_amplifier.m4 texas_inst_voltage_reg.m4
4581 transistor.m4 geda.m4
4582 @end example
4583 The @samp{-I .} says to search in the current directory for the
4584 @file{.m4} files.  The output frozen file is @file{pcblib}.  The main
4585 @file{common.m4} file is listed as well as all of the @file{*.m4} files
4586 which define the components in the library.
4588 In addition, a library contents file is created during the build with
4589 the @code{CreateLibraryContents.sh} script.
4590 A typical call to @code{CreateLibrary.sh} used during the compilation of
4591 PCB is:
4592 @example
4593 ./CreateLibraryContents.sh -I . ./common.m4 TTL_74xx_DIL.list
4594 connector.list crystal.list generic.list genericsmt.list gtag.list
4595 jerry.list linear.list logic.list lsi.list memory.list optical.list
4596 pci.list resistor_0.25W.list resistor_adjust.list resistor_array.list
4597 texas_inst_amplifier.list texas_inst_voltage_reg.list transistor.list
4598 geda.list > pcblib.contents
4599 @end example
4601 The @file{pcblib.contents} file is used by the PCB program to define the
4602 libraries and components which will be displayed when you bring up
4603 the library window from within PCB.  An example of part of the
4604 @file{pcblib.contents} file is:
4605 @example
4606 TYPE=~TTL 74xx DIL
4607 7400_dil:N:7400:4 dual-NAND
4608 7401_dil:N:7401:4 dual-NAND OC
4609 7402_dil:N:7402:4 dual-NOR
4610 TYPE=~geda
4611 geda_DIP6:DIP6:DIP6:Dual in-line package, narrow (300 mil)
4612 geda_DIP8:DIP8:DIP8:Dual in-line package, narrow (300 mil)
4613 geda_DIP14:DIP14:DIP14:Dual in-line package, narrow (300 mil)
4614 geda_ACY300:ACY300:ACY300:Axial non-polar component,
4615 @end example
4616 The @code{TYPE=} lines define the library name that will show up in the
4617 library window in PCB.  The other lines define the actual components in
4618 the library.
4620 @subsubsection Scripts Used by PCB at Runtime
4621 When PCB is first executed, it makes a call to the
4622 @code{ListLibraryContents.sh} script.  This script provides the PCB
4623 program with the contents of the library contents file created when PCB
4624 was compiled.  A typical call to @code{ListLibraryContents.sh} is
4625 @example
4626 ../lib/ListLibraryContents.sh .:/tmp/pcb-20030903/src/../lib pcblib
4627 @end example
4628 This command says to search the path
4629 @samp{.:/tmp/pcb-20030903/src/../lib} for a file called
4630 @file{pcblib.contents} (the @file{.contents} part is added
4631 automatically) and display the contents of the file.
4632 PCB parses this output and generates the library window entries.
4634 When you pick a library component from the library window, PCB calls the
4635 @code{QueryLibrary.sh} script to actually pull the footprint into the
4636 layout.  For example, when the ACY300 component is selected from the
4637 @code{~geda} library, the generated call may be:
4639 @example
4640 /tmp/pcb-20030903/src/../lib/QueryLibrary.sh
4641 .:/tmp/pcb-20030903/src/../lib pcblib geda_ACY300 ACY300
4642 ACY300
4643 @end example
4644 If you were to run this command by hand you would see the PCB code for
4645 the element:
4646 @example
4647 Element(0x00 "Axial non-polar component," "" "ACY300" 245 70 0 100 0x00)
4649         Pin(0 25 50 20 "1" 0x101)
4650         Pin(300 25 50 20 "2" 0x01)
4652         ElementLine(0 25 75 25 10)
4653         ElementLine(225 25 300 25 10)
4655         ElementLine(75 0 225 0 10)
4656         ElementLine(225 0 225 50 10)
4657         ElementLine(225 50 75 50 10)
4658         ElementLine(75 50 75 0 10)
4660 #       ElementArc(X1 Y 50 50 270 180 10)
4661 #       ElementArc(X2 Y 50 50 90 180 10)
4663         Mark(75 25)
4665 @end example
4667 @subsection Creating an Oldlib Footprint
4668 This section provides a complete example of defining a family of
4669 footprints using the M4 style library.  As a vehicle for this example, a
4670 family of footprints for surface mount resistors and capacitors will be
4671 developed.   The file @file{example.inc} should have been installed on
4672 your system as @file{$prefix/share/examples/oldlib/example.inc} where
4673 @file{$prefix} is often times @file{/usr/local}.
4675 The @file{example.inc} file defines a macro called
4676 @code{COMMON_PKG_RCSMT} which is a generic definition for a surface
4677 mount footprint with two identical, rectangular pads.  This macro will
4678 be called with different parameters to fill out the family of parts.
4679 The arguments to the @code{COMMON_PKG_RCSMT} are:
4680 @example
4681 # -------------------------------------------------------------------
4682 # the definition for surface mount resistors and capacitors
4683 # $1: canonical name
4684 # $2: name on PCB
4685 # $3: value
4686 # $4: pad width   (in direction perpendicular to part)
4687 # $5: pad length  (in direction parallel with part)
4688 # $6: pad spacing (center to center)
4689 # $7: distance from edge of pad to silk (in direction
4690 #     perpendicular to part)
4691 # $8: distance from edge of pad to silk (in direction parallel
4692 #     with part)
4693 # $9: Set to "no" to skip silk screen on the sides of the part
4694 @end example
4696 @example
4697 define(`COMMON_PKG_RCSMT',
4698         `define(`XMIN', `eval( -1*`$6'/2 - `$5'/2 - `$8')')
4699         define(`XMAX', `eval(  `$6'/2 + `$5'/2 + `$8')')
4700         define(`YMIN', `eval(-1*`$4'/2 - `$7')')
4701         define(`YMAX', `eval(   `$4'/2 + `$7')')
4702 Element(0x00 "$1" "$2" "$3" eval(XMIN+20) eval(YMAX+20) 0 100 0x00)
4704         ifelse(0, eval($4>$5),
4705         # Pads which have the perpendicular pad dimension less
4706         # than or equal to the parallel pad dimension
4707         Pad(eval(-1*(   $6 + $5 - $4)/2) 0
4708             eval((-1*$6 + $5 - $4)/2) 0 eval($4) "1" 0x100)
4709         Pad(eval(-1*(-1*$6 + $5 - $4)/2) 0
4710             eval((   $6 + $5 - $4)/2) 0 eval($4) "2" 0x100)
4711         ,
4712         # Pads which have the perpendicular pad dimension greater
4713         # than or equal to the parallel pad dimension
4714         Pad(eval(-1*$6/2) eval(-1*($4 - $5)/2)
4715             eval(-1*$6/2)  eval(($4 - $5)/2) eval($5) "1" 0x100)
4716         Pad(eval(   $6/2) eval(-1*($4 - $5)/2)
4717             eval(   $6/2)  eval(($4 - $5)/2) eval($5) "2" 0x100)
4718         )
4720         # silk screen
4721         # ends
4722         ElementLine(XMIN YMIN XMIN YMAX 10)
4723         ElementLine(XMAX YMAX XMAX YMIN 10)
4724         # sides
4725 ifelse($9,"no",
4726         #skip side silk
4727         ,
4728         ElementLine(XMIN YMIN XMAX YMIN 10)
4729         ElementLine(XMAX YMAX XMIN YMAX 10)
4731         Mark(0 0)
4733 @end example
4734 Note that the part has been defined with the mark located at
4735 @code{(0,0)} and that the pads have been placed with the mark at the
4736 common centroid of the footprint.  While not a requirement, this is
4737 highly desirable when developing a library that will need to interface
4738 with a pick and place machine used for factory assembly of a board.
4740 The final part of @file{example.inc} defines particular versions of the
4741 generic footprint we have created.  These particular versions correspond
4742 to various industry standard package sizes.
4743 @example
4744 # 0402 package
4746 # 30x30 mil pad, 15 mil metal-metal spacing=>
4747 # 15 + 15 + 15 = 45 center-to-center
4748 define(`PKG_RC0402',
4749   `COMMON_PKG_RCSMT(`$1', `$2', `$3', 30, 30, 45, 0, 10, "no")')
4751 # 0603 package
4753 # 40x40 mil pad, 30 mil metal-metal spacing=>
4754 #  30 + 20 + 20 = 70 center-to-center
4755 define(`PKG_RC0603',
4756   `COMMON_PKG_RCSMT(`$1', `$2', `$3', 40, 40, 70, 10, 10)')
4758 # 1206 package
4760 # 40x60 mil pad, 90 mil metal-metal spacing=>
4761 #  90 + 20 + 20 = 130 center-to-center
4762 define(`PKG_RC1206',
4763   `COMMON_PKG_RCSMT(`$1', `$2', `$3', 60, 40, 130, 10, 10)')
4764 @end example
4766 At this point, the @file{example.inc} file could be used by third party
4767 tools such as @code{gsch2pcb}.  However to fully integrate our
4768 footprints into PCB we need to create the @file{example.m4} and
4769 @file{example.list} files.  The @file{example.m4} file defines
4770 descriptions for the new footprints.
4771 @example
4772 define(`Description_my_RC0402',
4773   ``Standard SMT resistor/capacitor (0402)'')
4774 define(`Description_my_RC0603',
4775   ``Standard SMT resistor/capacitor (0603)'')
4776 define(`Description_my_RC1206',
4777   ``Standard SMT resistor/capacitor (1206)'')
4778 @end example
4779 Finally we need to create the @file{example.list} file.
4780 @example
4781 my_RC0402:RC0402:RES0402
4782 my_RC0402:RC0402:CAP0402
4783 my_RC0603:RC0603:RES0603
4784 my_RC0603:RC0603:CAP0603
4785 my_RC1206:RC1206:RES1206
4786 my_RC1206:RC1206:CAP1206
4787 @end example
4788 The first field in the list file has the name corresponding to the
4789 Description definitions in @file{example.m4}.  The second field is the
4790 template name which corresponds to the macros @code{PKG_*} we defined in
4791 @file{example.inc} with the leading @code{PKG_} removed.  It is the
4792 second field which controls what footprint will actually appear on the
4793 board.  The final
4794 field is the name of the part type on the board.  The first line in our
4795 @file{example.list} file will produce a menu entry in the library window
4796 that reads:
4797 @example
4798 CAP0402, Standard SMT resistor/capacitor (0402)
4799 @end example
4800 The @code{CAP0402} portion comes directly from the third field in
4801 @code{example.list} and the longer description comes from descriptions
4802 macros in @code{example.m4}.  Please note that any extra white space
4803 at the end of a line in the @file{.list} files will cause them to
4804 not work properly.
4806 @subsection Troubleshooting Old Style Libraries
4808 A powerful technique to help debug problems with libraries is to invoke
4809 the @code{m4} processor directly.  This approach will provide error
4810 output which is not visible from within PCB.  The following example
4811 shows how one might try to debug an 8 pin small outline (SO8) package.  The
4812 macro name for the package is PKG_SO8.  In this example, the
4813 canonical name that is to be associated with the part is SO8, the
4814 reference designator is U1, and the value is MAX4107 (the part number).
4816 @example
4817 echo "PKG_SO8(SO8, U1, MAX4107)" | \
4818    gm4 common.m4 - | \
4819    awk '/^[ \t]*$/ @{next@} @{print@}' | \
4820    more
4821 @end example
4822 The @code{awk} call simply removes blank lines which make the output
4823 hard to read.
4825 For this particular example, the output is:
4826 @example
4827 Element(0x00 "SO8" "U1" "MAX4107" 146 50 3 100 0x00)
4829         Pad(10 25 38 25 20 "1" 0x00)
4830         Pad(10 75 38 75 20 "2" 0x100)
4831         Pad(10 125 38 125 20 "3" 0x100)
4832         Pad(10 175 38 175 20 "4" 0x100)
4833         Pad(214 175 242 175 20 "5" 0x100)
4834         Pad(214 125 242 125 20 "6" 0x100)
4835         Pad(214 75 242 75 20 "7" 0x100)
4836         Pad(214 25 242 25 20 "8" 0x100)
4837         ElementLine(0 0 151 0 10)
4838         ElementArc(126 0 25 25 0 180 10)
4839         ElementLine(101 0 252 0 10)
4840         ElementLine(252 0 252 200 10)
4841         ElementLine(252 200 0 200 10)
4842         ElementLine(0 200 0 0 10)
4843         Mark(29 25)
4845 @end example
4847 @section New Style Libraries
4848 Footprints for the new style library are created graphically using the
4849 PCB program.  A single footprint is saved in each file.
4851 @subsection Creating Newlib Footprints
4852 To create
4853 @enumerate
4854 @item Start PCB with an empty layout.
4855 @item Make the component layer active.
4856 @item For a leaded part, select the via tool and place vias where the
4857 pads for the part should go.  For surface mount pads, draw line
4858 segments.  Note that until the footprint is completed, the surface
4859 mount pads will remain rounded.  Currently a rectangle or polygon
4860 may not be used as a pad.
4861 @item For each via and line segment which will become a pad, select it
4862 and press 'n' to be able to enter a name.  Enter
4863 the pin number and press enter.
4864 @item Make the silk layer active.
4865 @item Using the line and arc tools, draw a silk screen outline for the
4866 part.
4867 @item Using the selection tool, select all of the pins and silk screen
4868 for the part.
4869 @item Place the pointer above the reference point for the part.  This is
4870 typically the common centroid.  Keeping the pointer there, shift-right-click
4871 to bring up the popup menu and choose "convert
4872 selection to element".
4873 @item At this point, the vias, line segments, and silk screen will have
4874 been converted to an element.  To change any of the line segments to
4875 have square ends rather than round ends, select the pads by holding
4876 down the shift key and clicking each pad with the center mouse button.
4877 Now under the Select menu, "Change square-flag of selected objects"
4878 section, choose "Pins".
4879 @item Select the element, shift-right-click to bring up the popup menu, and
4880 choose "Copy Selection to Buffer".  Now left-click on the center of 
4881 the new element.
4882 @item Under the buffer menu, choose "save buffer elements to file" to
4883 save the new footprint to a file.
4884 @item Press ESC to exit from buffer mode.
4885 @end enumerate
4887 @subsection Modifying Newlib Footprints
4888 @enumerate
4889 @item In the @pcb{} program, instantiate the footprint you wish to modify.
4890 @item Using the selection tool, select the footprint.
4891 @item Now left-click on the selected element, this brings up a popup menu, choose
4892 "Cut to Buffer" from the popup menu.
4893 @item Under the buffer menu, choose "break buffer element to pieces",
4894 and then left-click to place the broken apart footprint to an open area of
4895 the layout.  Note that you must use the items under the buffer menu, the
4896 items with the same names in the popup menu do not work.
4897 @item Make your desired modifications to the footprint and then convert
4898 the pieces back to an element using the same procedure as when starting
4899 from scratch on a new footprint.
4900 @end enumerate
4903 @c --------------------------- chapter 8 -------------------------------
4904 @node Schematic Frontends
4905 @chapter Schematic Capture for PCB
4906 @cindex schematic capture
4907 @cindex schematic frontend
4909 When designing a circuit board of any complexity, a schematic capture
4910 front-end for the design is highly desired.  Any schematic capture
4911 program which is able to generate a netlist in a user defined format as
4912 well as a bill of materials can be made to work with PCB.  Currently, we
4913 are aware of two freely available schematic capture programs which can
4914 interface with PCB.  This chapter shows how a design can be taken from
4915 start to finish using either of these two tools for schematic capture
4916 and PCB for layout.
4918 @menu
4919 * gEDA::          Interfacing with GNU EDA (gEDA).
4920 * xcircuit::      Interfacing with xcircuit.
4921 @end menu
4923 @node gEDA
4924 @section gEDA
4925 @cindex gschem, how to interface with
4926 @cindex gEDA, how to interface with
4928 This section shows how to use gEDA as the schematic capture front-end for
4929 a PCB design.  This section is not intended to be complete documentation
4930 on gEDA and it is assumed that the user has at least some familiarity
4931 with the gEDA suite of programs.
4933 The basic steps in a gEDA + PCB design flow are:
4934 @enumerate
4935 @item Set up project directories
4936 @item Set up gEDA (gschem/gnetlist) config files
4937 @item Set up gsch2pcb config files
4938 @item Capture schematics using @code{gschem} (part of gEDA)
4939 @item Create any unique PCB footprints needed for the design
4940 @item Generate initial PCB design using @code{gsch2pcb} (part of gEDA)
4941 @item Layout circuit board using @code{pcb}
4942 @item Make any additional schematic changes with @code{gschem} and
4943 forward annotate to PCB with @code{gsch2pcb}
4944 @item Generate photoplot files (RS-274X, also known as "Gerber") for
4945 board vendor
4946 @end enumerate
4948 @subsection Set Up Project Directories
4949 Although not required, a typical project directory will contain the
4950 schematics and board layout at the top level.
4951 Schematic symbols and circuit board footprints which are unique to this
4952 project are stored in subdirectories.  For this example, @file{sym}
4953 contains the project specific schematic symbols and @file{pkg} contains
4954 the project specific footprints.  Set up the project subdirectory and
4955 subdirectories by executing:
4956 @example
4957 mkdir ~/myproj
4958 cd ~/myproj
4959 mkdir sym
4960 mkdir pkg
4961 mkdir pkg/newlib
4962 mkdir pkg/m4
4963 @end example
4965 @subsection Set Up gEDA Config Files
4966 The gEDA tools, specifically @code{gschem} and @code{gnetlist}, use
4967 configuration files to set the search path for symbol libraries in
4968 addition to other user preferences.  Create a file in the top level
4969 project directory called @file{gschemrc}.  Add the following lines to
4970 that file:
4971 @example
4973 ;; list libraries here.  Order matters as it sets the
4974 ;; search order
4975 (component-library "./sym")
4977 @end example
4978 This sets the local search path for the schematic capture program
4979 @code{gschem}.  Now the netlister, @code{gnetlist}, must also be
4980 configured.  This can be done by copying the file @file{gschemrc} to
4981 @file{gnetlistrc} by running @samp{cp gschemrc gnetlistrc}.
4982 Alternatively, you can create a soft link so only a single file needs to
4983 be updated if additional symbol paths are added.  The link is created by
4984 running @samp{ln -s gschemrc gnetlistrc}.
4986 @subsection Set Up @code{gsch2pcb} Config Files
4987 The program @code{gsch2pcb}, not to be confused with the older
4988 @code{gschem2pcb} script, is used to link the schematic to layout.
4989 @code{gsch2pcb} is responsible for creating the netlist used to provide
4990 connectivity information to PCB as well creating an initial layout with
4991 all components instantiated in the design.  Forward annotation of
4992 schematic changes to the layout is also done using @code{gsch2pcb}.
4993 @code{gsch2pcb} uses a project file to set up the schematic file names,
4994 PCB library locations, and output file names.  Create a project file
4995 called @file{project} using the following as an example:
4996 @example
4998 # List all the schematics to be netlisted
4999 # and laid out on the pc board.
5000 schematics      first.sch second.sch third.sch
5002 # For an output-name of foo, gsch2pcb generates files
5003 # foo.net, foo.pcb, and foo.new.pcb.  If there is no
5004 # output-name specified, the file names are derived from
5005 # the first listed schematic, i.e. first.net, etc.
5006 output-name  preamp
5008 @end example
5011 @subsection Capture Schematics Using @code{gschem}
5012 This section is fairly brief and assumes familiarity with using the
5013 @code{gschem} schematic capture program.  As you are creating your
5014 schematics, be sure to observe the following rules:
5015 @itemize
5016 @item Make sure that each component in the schematic has a
5017 @code{footprint} attribute that corresponds to a footprint in the PCB
5018 library or a footprint you plan on creating.
5019 @item Make sure all reference designators are unique.  One way to ensure
5020 this is to run the @code{refdes_renum} script (part of gEDA) after the
5021 schematics are created.
5022 @end itemize
5024 @subsection Create Any Unique PCB Footprints
5025 Create the new footprints you design needs using either the m4 style or
5026 newlib style of PCB libraries.  Refer to @ref{Library Creation} for details on this
5027 process.  For m4 style footprints, store them in the @file{pkg/m4}
5028 subdirectory and for newlib footprints, store them in the
5029 @file{pkg/newlib} subdirectory.
5031 @subsection Generate Initial PCB Design Using @code{gsch2pcb}
5032 The @code{gsch2pcb} program connects the schematic and layout.  It basic
5033 operation is to call @code{gnetlist} to generate the connectivity
5034 netlist that PCB used to verify connectivity and to instantiate all
5035 elements found in the schematic to a new layout.
5036 The default, as of @code{gsch2pcb} version 0.9,  is to use any found  m4
5037 style parts first and then search for newlib style if no old style part
5038 was found.  By using the @code{--use-files} or @code{-f} flag to @code{gsch2pcb}
5039 priority is given to newlib style parts even if m4 style are found.  You
5040 may wish to verify this in the @code{gsch2pcb} documentation in case
5041 this changes in the future.
5042 To start your layout,
5043 run @samp{gsch2pcb project} where @file{project} is the project file
5044 created previously.  This will create a new netlist file,
5045 @file{preamp.net}, and a new layout file, @file{preamp.pcb}.
5048 @subsection Layout Circuit Board
5049 Run PCB on the new layout by running @samp{pcb preamp.pcb}.
5050 Load the netlist file by selecting "load netlist file" from the "file"
5051 menu.  In the file selection dialog box, choose @file{preamp.net}.  This
5052 loads connectivity information into PCB.
5054 Using the selection tool, grab and move apart the various footprints
5055 with the middle mouse button.  Once the parts are moved apart from each
5056 other, choose "optimize rats-nest" from the "Connects" menu.  This menu
5057 choice will display and optimize the rats nest.  Use the rats nest to
5058 help guide placement of the parts.  You may wish to re-run the "optimize
5059 rats-nest" command after moving parts around.
5061 After the placement is complete, use the line tool to add traces to the
5062 board.  As traces are added, the corresponding rats line will disappear.
5064 @subsection Forward Annotation of Schematic Changes
5065 If schematic changes are made after the layout has started,
5066 @code{gsch2pcb} can be used to forward annotate these changes to the
5067 layout.  To forward annotate schematic changes, run @samp{gsch2pcb
5068 project}.  This command will create the files @file{preamp.new.pcb},
5069 @file{preamp.net}, and modify the file @file{preamp.pcb}.  The
5070 modifications to @file{preamp.pcb} include forward annotation of
5071 schematic component value changes, adds any new components, and removes
5072 any deleted components.
5074 @subsection Generate Photoplot Files (RS-274X)
5075 After the layout is complete, choose "edit layer-groupings" from the
5076 "Settings" menu.  The LayerGroups form lets you specify which layers
5077 will appear in each output layer group.  For example, in the default
5078 form, layer group 1 has "front" and "front side" in it.  The
5079 output file @file{1.gbr} if DOS file names are used, or
5080 @file{somename_front.gbr} if long file names are used will contain the
5081 "front" and "front side" layers in it.  Usually the defaults are
5082 sufficient, but this form is still a useful reference.
5084 Choose "print layout..." from the "File" menu.  In the print dialog box,
5085 select "Gerber/RS-274X" for the device
5086 driver.  Select the "outline", "alignment", and "drillhelper" options.
5087 To get DOS compatible file names, select the "DOS (8.3) names" option,
5088 otherwise enter "preamp" for the filename.  Press "OK".
5090 The following output files should have been created in the project directory.
5091 The names in parentheses correspond to the DOS compatible output file names.
5092 @table @file
5093 @item preamp_frontsilk.gbr (csilk.gbr)
5094 Top side silk screen.
5095 @item preamp_frontmask.gbr (cmask.gbr)
5096 Top side soldermask relief.
5097 @item preamp_front.gbr (1.gbr)
5098 Top copper.
5099 @item preamp_backmask.gbr (smask.gbr)
5100 Bottom side soldermask relief.
5101 @item preamp_back.gbr (2.gbr)
5102 Bottom Copper.
5103 @item preamp_fab.gbr (fab.gbr)
5104 Fabrication drawing.  Also known as the drill drawing.  This drawing is
5105 used for reference by the board vendor but is not directly used in the
5106 fabrication process.
5107 @item preamp_plated-drill.cnc (pdrill.cnc)
5108 NC Drill format file for the plated through holes.
5109 @item preamp_unplated-drill.cnc (udrill.cnc)
5110 NC Drill format file for the unplated through holes.
5111 @item preamp_bom.txt (bom.txt)
5112 A bill of materials for the layout.
5113 @item preamp_xy.txt (xy.txt)
5114 Centroid (X-Y) data for driving automated assembly equipment.
5115 @end table
5117 @comment to include an image:
5118 @comment @image{geda1, 6in, 4in, geda schematic, png}
5120 @node xcircuit
5121 @section xcircuit
5122 @cindex xcircuit, how to interface with
5123 @cindex xcircuit, how to interface with
5125 If anyone cares to contribute this section, it will get added.  Please
5126 submit changes to the bug tracking system for PCB which can be found from
5127 the PCB homepage at @url{http://pcb.gpleda.org}.
5129 @c --------------------------- Appendix A -------------------------------
5131 @node Installation
5132 @appendix Installation and Troubleshooting
5134 Compiling and installing the package should be straightforward. If any problems
5135 occur, please contact the author @email{Thomas.Nau@@rz.uni-ulm.de}, or the
5136 current maintainer @email{haceaton@@aplcomm.jhuapl.edu} to find
5137 a solution and include it into the next release.
5139 @menu
5140 * compiling::     Compiling and installing.
5141 * problems::      Troubleshooting.
5142 @end menu
5145 @node compiling
5146 @section Compiling and Installing
5147 @cindex install, how to
5148 @cindex compile, how to
5150 This section covers the steps which are necessary to compile the package.
5152 @menu
5153 * quickstart::                 Quick start.
5154 * running configure::          Customizing Pcb with Configure
5155 @end menu
5157 @node quickstart
5158 @subsection Quick Start
5159 @cindex GNU build system
5161 Starting with version 2.0, @pcb{} has switched to a GNU
5162 autoconf/automake build system.  Installation of @pcb{} consists of
5163 three steps:  configuration, building, and installing.
5164 In a typical installation, these steps are as simple as
5165 @example
5166 ./configure
5167 make
5168 make install
5169 @end example
5171 @node running configure
5172 @subsection Running the configure Script
5173 @cindex GNU configure script
5174 @cindex configure
5176 The @code{configure} script accepts all of the standard GNU configure
5177 options.  For a complete list of configuration options, run
5178 @code{./configure --help}.
5181 @table @samp
5182 @vindex INFOLIBDIR
5183 @item INFOLIBDIR
5184 must be set to the directory where your GNU info files are located.
5186 @vindex PCBLIBDIR
5187 @item PCBLIBDIR
5188 is the path of a directory where the font files will be installed.
5190 @vindex DEFAULTFONT
5191 @item DEFAULTFONT
5192 the name of the default font file.
5194 @vindex DEFAULTLIBRARY
5195 @item DEFAULTLIBRARY
5196 the name of the default library.
5198 @vindex GNUM4
5199 @item GNUM4
5200 the name of GNUs m4 version.
5202 @vindex BTNMOD
5203 @item BTNMOD
5204 If your window manager has already bound @emph{Mod1} together with some
5205 function keys you may want to change this setting. This is true for HP-VUE.
5208 @end table
5210 If you find things which must be changed to compile on your system,
5211 please add the appropriate autoconf tests (if you are familiar with
5212 that) and mail a copy to the maintainer, harry eaton,  at
5213 @email{haceaton@@aplcomm.jhuapl.edu}.
5216 If you do not have the appropriate permissions you should run
5217 @file{./pcbtest.sh} in the @file{src} directory to run @pcb{} from
5218 the installation directory.
5221 @node problems
5222 @section Troubleshooting
5223 @cindex problems
5224 @cindex troubleshooting
5226 There are some known problems. Most of them are related to
5227 missing parts of a standard @code{X11} distribution. Some others are caused by
5228 third party applications such as @code{X} servers. To make this list more
5229 complete please mail your problems and, if available, solutions to the author.
5230 The mail address may be found at the beginning of this chapter.
5231 In any case, read @ref{X11}.
5233 By the way, you @code{MUST HAVE AN ANSI COMPILER} to make @pcb{} work.
5236 Another source of problems are older versions of @code{flex} and @code{bison}.
5237 @pcb{} definitely works with @code{flex-2.4.7} and @code{bison-1.22} or
5238 later. The problems will result in a @emph{syntax error} while parsing files.
5239 This should only be a problem if you have modified the @code{flex} or
5240 @code{bison} input files.
5242 The following list gives you just an idea because I'm not able to test
5243 all @pcb{} releases on all platforms.
5245 @menu
5246 * HP::              Hewlett-Packard series 700 and 800 running HP-UX 10.*
5247 * Sun::             Sun, Solaris 2.5
5248 * SGI::             SGI, IRIX 5.3 and 6.*
5249 * DEC Alpha::       DEC Alpha, DEC UNIX 3.2c and 4.0
5250 * SCO::             SCO Unix ODT 3.0, PC hardware
5251 * Linux::           Linux 0.99pl14 and later
5252 * BSD::             FreeBSD, NetBSD ...
5253 * X11::             Refers to @code{X11R4}, @code{X11R5}, and @code{OpenWindows}
5254 * TeX and Manuals:: Problems creating the @file{pcb.dvi}
5255 @end menu
5257 @node HP
5258 @subsection HP Series 700 and 800
5259 @cindex architecture
5260 @cindex HP
5261 @cindex Hewlett Packard
5263 You have to install several @code{X11} include files
5264 or, better, install a complete @code{X11R5} release. Hewlett-Packard doesn't
5265 support the Athena Widgets. So the header files and libraries are missing
5266 from the application media, but they are available as a patch.
5267 They also do not ship the @code{ANSI} compiler with the normal operating
5268 system release so you have to buy one or use @code{GCC}.
5269 Some of the tools are available as patches.
5271 In addition, @pcb{} has been successfully tested on these platforms with
5272 @code{HPUX 9.*, 10.*} running self-compiled @code{X11R5}.
5275 @node Sun
5276 @subsection Sun SPARC architecture
5277 @cindex architecture
5278 @cindex Sun
5279 @cindex Solaris
5280 @cindex OpenWindows
5282 There are no known problems with Sun machines if they use @code{X11R5} instead
5283 of @code{OpenWindows}. @pcb{} compiled successfully with all kinds of
5284 SPARCstations @code{Solaris-2.[345]}.
5286 For problems with @code{OpenWindows} refer to @ref{X11}.
5288 @node SGI
5289 @subsection Silicon Graphics
5290 @cindex architecture
5291 @cindex Silicon Graphics
5292 @cindex SGI
5294 @pcb{} has been tested on some boxes running either @code{IRIX-4.0.5} or
5295 @code{IRIX-5.3}. The former one uses a @code{X11R4} server.
5296 There are no problems.
5297 For known problems
5298 with @code{X11R4}, see @ref{X11}.
5301 @node DEC Alpha
5302 @subsection DEC Alpha
5303 @cindex architecture
5304 @cindex DEC
5305 @cindex Alpha
5307 @pcb{} compiled and runs without problems on @code{DEC UNIX V3.2c}.
5310 @node SCO
5311 @subsection SCO Unix
5312 @cindex architecture
5313 @cindex SCO
5314 @cindex PC UNIX
5316 John DuBois <spcecdt@@deeptht.armory.com> wrote:
5317 @example
5318 @code{SCO-ODT-3.0} requires the latest version of tls003, the Athena
5319 widget library (available from sosco.sco.com). The main problems
5320 I have encountered are it core dumps fairly often, especially
5321 while loading/dropping elements...
5322 @end example
5323 I'll see what I am able to do as soon as I have access to an @code{SCO} system.
5326 @node Linux
5327 @subsection Linux
5328 @cindex architecture
5329 @cindex Linux
5330 @cindex PC UNIX
5332 Since the @code{X11} version of @pcb{} has been developed on a Linux
5333 system here are no known problems.
5336 @node BSD
5337 @subsection FreeBSD and NetBSD
5338 @cindex FreeBSD
5339 @cindex NetBSD
5340 @cindex PC UNIX
5342 @pcb{} has been tested on NetBSD and works without any problems.
5343 You may also be able to find a NetBSD package at
5344 @url{ftp://ftp.netbsd.org/pub/NetBSD/packages/cad/pcb/README.html} or a
5345 FreeBSD port at
5346 @url{http://www.freebsd.org/cgi/url.cgi?ports/cad/pcb/pkg-descr}.
5348 @node X11
5349 @subsection Problems related to X11
5350 @cindex X11, problems
5352 There are a some problems related to @code{X11R4} or systems derived from
5353 @code{X11} such as @code{OpenWindows}. @xref{Sun}. You at least have to change
5354 all occurances of @emph{baseTranslations} in the resource files to
5355 @emph{translations} if you are using a @code{X11R4} server. Look at the
5356 @code{X11R5} @emph{Intrinsics} manual for details.
5358 The panner widget (print dialog box) appears only in release @code{X11R5} and
5359 later. It really simplifies adjusting the offsets.
5360 With earlier releases the printout will always appear in the center of the
5361 page.
5363 You may have some problems in a mixed @code{X11-OpenWindows}
5364 environment.
5366 @pcb{} has been tested successfully with @code{X11R6} under Linux 1.1.59
5367 and later.
5370 @node TeX and Manuals
5371 @subsection Problems related to TeX
5372 @cindex TeX, problems
5374 If your @code{TeX} installation complains about a missing @file{texinfo.tex}
5375 file copy the one included in this release (directory @file{doc}
5376 to your @code{TeX} macro directory.
5377 Note, there are probably newer versions of this file available from some
5378 FTP sites.
5379 @code{TeX-3.0} failed, @code{TeX-3.14} worked just fine. Check our FTP server
5380 @emph{ftp.uni-ulm.de} for ready-to-print versions of the manuals.
5383 @c --------------------------- Appendix B -------------------------------
5385 @node Custom Menus
5386 @appendix Customizing the Menus
5388 The menu system is driven off a data file that contains
5389 @dfn{resources}.  A resource is a hierarchical description of a data
5390 tree which, in this case, is mapped to the hierarchical menus used by
5391 Pcb.
5393 @menu
5394 * Resource Syntax::          What a resource file looks like.
5395 * Menu Definitions::         Using a resource to define a menu.
5396 * Menu Files and Defaults::  Where Pcb looks for its menu resource.
5397 @end menu
5399 @node Resource Syntax
5400 @section Resource Syntax
5402 A resource file is a simple text file.  It contains curly braces to
5403 group things, spaces between things, and double quotes when strings
5404 need to include spaces.  There are four fundamental ways of adding
5405 data to a resource.
5407 First, a string (either a single word or a quoted string with spaces,
5408 we call both ``strings'' in this appendix) can be added all by itself,
5409 to add a string resource to the current resource.  This is used, for
5410 example, to define the string printed on a menu button.  In this
5411 example, four strings are added to the @var{File} resource:
5413 @example
5414 File = @{
5415   Sample
5416   "longer sample"
5417   some text
5419 @end example
5421 Second, a named string may be added by giving two strings separated by
5422 an equals sign.  This is used to specify X resources and a few other
5423 optional parameters of menus, for example.  Note that a string all by
5424 itself is thus an ``unnamed'' string.
5426 @example
5427 @{"Layer groups" foreground=red sensitive=false@}
5428 @end example
5430 Third, an unnamed subresource may be added.  This is used to create
5431 submenus and menu buttons.  To add a subresource, simply group other
5432 things in curly braces.  This example describes a resource containing
5433 one string and three subresources:
5435 @example
5436 @{File
5437   @{New do_new()@}
5438   @{Save do_save()@}
5439   @{Quit do_quit()@}
5441 @end example
5443 Lastly, a named subresource may be added by prefixing an unnamed
5444 subresource with a string and an equals sign, just as when naming
5445 strings.  This syntax is used to name the resources used for the main
5446 menu and popup menus:
5448 @example
5449 MainMenu = @{
5450   @dots{}
5451   @}
5452 @end example
5454 Additionally, the menu parser allows for ``hooks'' whereby portions of
5455 the menu system can be programmatically created at runtime by the
5456 application.  These hooks are invoked by a single word proceeded by an
5457 at sign, such as this example where most of the Sizes menu is created
5458 automatically:
5460 @example
5461 @{Sizes
5462     @@sizes
5463     @{"Adjust active sizes ..." AdjustStyle(0)@}
5464     @}
5465 @end example
5467 In addition to all that, any unquoted pound sign (@code{#}) begins a
5468 comment.  Commented text continues until the end of the containing
5469 line.  Comments may begin at the beginning of a line, or after other
5470 text on the line:
5472 @example
5473 # This is a comment
5474 MainMenu = @{ # This is also a comment
5475 @end example
5477 @node Menu Definitions
5478 @section Menu Definitions
5480 To best understand this section, you should find the
5481 @file{pcb-menu.res} file that your Pcb uses and refer to it for
5482 examples (@pxref{Menu Files and Defaults}).  Note that the lesstif
5483 GUI uses @file{pcb-menu.res} and the GTK+ GUI uses @file{gpcb-menu.res}.
5484 The file format is identical however and if so desired, one can make
5485 one file be a soft link to the other.
5487 A resource defines a menu when it meets certain semantic requirements.
5488 The menu hierarchy is reflected as a hierarchy of unnamed
5489 subresources, with the first string of each subresource defining the
5490 label used for the menu button.  A subresource that itself contains
5491 subresources becomes a submenu, a subresource that does not becomes a
5492 button.
5494 A submenu should only contain subresources for the buttons or submenus
5495 within that submenu.  Two exceptions are allowed: an initial string
5496 sets the label, and the string ``-'' (a single dash) will create a
5497 separator.
5499 A button should not contain subresources, but will contain many
5500 strings, named and unnamed.  The first member shall be an unnamed
5501 string which is the label for the button.  Any other unnamed strings
5502 within the button's resource will be used as actions (much like the
5503 .Xdefaults action strings), which are functions that will be called
5504 when the button is pressed (or popped up, or created, depending on the
5505 action).  As a convenience, if a left parenthesis is seen, the current
5506 ``word'' will continue at least until the matching right parenthesis.
5507 This allows you to pass strings with spaces as arguments to actions
5508 without needing to quote the action.
5510 Named resources in button resources will be used as X resources.  Such
5511 resources can be used to set the font, color, and spacing of buttons.
5512 As a convenience, ``fg'' can be used as an abbreviation for ``foreground''.
5514 Within the menu's resource file, Pcb will look for a few key named
5515 subresources.  At the moment, there are just two key named subresources.
5516 @code{MainMenu} will be used for the main menu bar and @code{Mouse} will be
5517 used to define mouse actions.  In the future, other named subresources will
5518 be used for popup resources.
5520 Given all this, a small sample @file{pcb-menu.res} would be:
5522 @example
5523 MainMenu = @{
5524   @{File
5525     @{"Open..." Load(Layout)@}
5526     -
5527     @{"Quit" Quit() fg=red font=10x20@}
5528   @}
5530 @end example
5532 Within the Pcb sources are specially crafted comments that mark all
5533 the actions, flags, menu hooks, and whatnot that Pcb offers.  Read the
5534 file @file{src/gather-actions} in the Pcb source tree for
5535 documentation for these comments.
5537 @node Menu Files and Defaults
5538 @section Menu Files and Defaults
5540 Pcb will look for a file which defines its menus, trying the following
5541 names (the example is for the lesstif GUI, the GTK+ GUI has ``gpcb-menu.res''
5542 in place of ``pcb-menu.res''):
5544 @example
5545 ./pcb-menu.res
5546 $HOME/.pcb/pcb-menu.res
5547 $PCBLIBDIR/pcb-menu.res
5548 <internal>
5549 @end example
5551 Note that @var{pcblibdir} defaults to @file{/usr/local/share/pcb}
5552 (hence, @file{/usr/local/share/pcb/pcb-menu.res}).  The
5553 @file{<internal>} entry refers to a menu definition within the Pcb
5554 application itself.  The master file for all this is the file
5555 @file{src/pcb-menu.res} in the Pcb source tree.  This master source is
5556 used to create the internal menu definition as well as being installed
5557 in @file{$pcblibdir}.
5559 @c --------------------------- Appendix C -------------------------------
5560 @node Regular Expressions
5561 @appendix Element Search/Regular Expressions
5562 @cindex Element Search
5563 @cindex Regular Expressions
5564 @vindex Element Search
5565 @vindex Regular Expressions
5567 @section Element Search/Regular Expressions
5568 @pcb{}'s search is based on POSIX 1003.2 Regular Expressions.  Full POSIX
5569 Regular Expressions are supported by @pcb{} if the regex library was
5570 available when @pcb{} was built.  One difference from the regular
5571 expressions found in tools like awk or grep is that PCB implicitly
5572 adds a ``^'' to the begining of a regular expression and ``$'' to the
5573 end of the regular expression.  For example, if you enter ``C1'', the
5574 actual regular expression used internally is ``^C1$''.  Another difference
5575 is that search patterns in pcb are not case sensitive. That is, ``CON'' is
5576 treated the same as ``con''.
5578 It is easier to show by example how to search than explain
5579 POSIX 1003.2.  With regular expressions most characters are just
5580 themselves, but some are special:
5582 @table @samp
5583 @item *
5584 Matches 0 or more instances of preceding character.
5586 @item +
5587 Matches 1 or more instances of preceding character.
5589 @item ?
5590 Matches 0 or 1 instances of preceding character.
5592 @item .
5593 Matches any single character other than the newline character.
5595 @item |
5596 The vertical bar is the alternation operator. It combines two
5597 regular expressions. The result matches if either of them matches.
5599 @item \
5600 A backslash indicates the next character should not be interpreted literally
5601 if it normally is, and should be interpreted literally if it normally isn't.
5603 @item @{n@}
5604 An integer n enclosed in curly brackets matches the preceding item if
5605 it occurs exactly n times.
5607 @item [ ]
5608 A pair of square brackets matches every character they contain.  Characters
5609 may be given explicitly, or as ranges.
5611 @item -
5612 A hyphen in the context of square brackets denotes the range between the
5613 preceding and the following character.  E.g., the range of digits is
5614 ``0-9'' .  The range of letters from C to K is ``C-K'' .
5616 @item \^ inside square brackets
5617 Inside square brackets the caret is an anti operator. Its presence makes
5618 the square prackets match anything except the contents of the brackets.
5620 @item ( )
5621 Round parenthesis group parts of a regular expression. This is very much
5622 like they do in math formulars.
5624 @end table
5626 If you need a special character literally, you can escape it with a
5627 backslash.
5629 The following examples illustrate how regular expressions can be used to
5630 specify element names (reference designators) to search for.
5631 @table @samp
5633 @item C5
5634 Select the element whose name is exactly ``C5''.
5636 @item C5 | R3
5637 Select C5 and R3.
5639 @item C.*
5640 Select all elements whose name start with the letter ``C'', such as C5, or
5641 C42, or CF1.
5643 @item C.*1
5644 Select all elements that start with ``C'' and end with ``1'', such as C1,
5645 or C51 or C5/9B71.
5647 @item R10?
5648 Search for R1 or R10, but will not select R100 or R105. The question mark
5649 is a quantifier for the character ``0''.
5651 @item R128+
5652 Selects R128, R1288, R12888, etc.
5654 @item TB.
5655 Select all terminal blocks having exactly one character designator after
5656 ``TB'' such as TB1, TBA, or TBx but not TB.
5658 @item TB..
5659 Select all terminal blocks having a two character designator such as TB21 or
5660 TB1a.
5662 @item TB.*
5663 Select all terminal blocks with any designator.
5665 @item .*31
5666 Select all items, whose name ends with ``31'' such as Q31, or R31, or R531.
5668 @item Q[12]
5669 Select Q1 and Q2.
5671 @item [A-D].*
5672 Select all items, whose name starts with ``A'', ``B'', ``C'', or ``D''.
5674 @item .*N@{2@}.*
5675 Select all items, whose name contains two ``N'' in a row such as
5676 CONN23, or connA, but not CON5
5678 @item [^D].*
5679 Select all items that do not start with the letter ``D'', such as C2, or
5680 R34, but not D34
5682 @end table
5685 @c --------------------------- Appendix -- drill sizes -------------------------------
5686 @node Standard Drill Sizes
5687 @appendix Standard Drill Size Tables
5688 @cindex drill sizes, list of standard
5689 @cindex standard drill sizes
5691 @section American Standard Wire Size Drills
5692 @include wire_size.texi
5694 @section American Standard Letter Size Drills
5695 @include letter_size.texi
5697 @section Fractional Inch Size Drills
5698 @include fractional_size.texi
5700 @section Metric Drills
5701 @include metric_size.texi
5703 @c --------------------------- Appendix -- Centroid File Format ----------------------
5704 @node Centroid File Format
5705 @appendix Centroid (X-Y) File Format
5706 @cindex centroid file format
5707 @cindex x-y file format
5709 @section Overview
5711 @section File Format
5712 The centroid output file is in a standard comma seperated values (CSV)
5713 format.  Comment lines begin with a ``#''.  The output file contains a
5714 header with a version number for the file format, some comments
5715 containing the author and title of the board, and a comment describing
5716 the remainder of the file format.
5718 An example centroid file is shown below.
5720 @example
5722 # PcbXY Version 1.0
5723 # Date: Fri Jul 22 03:40:08 2005 UTC
5724 # Author: PCB User
5725 # Title: MyBoard - PCB X-Y
5726 # RefDes, Description, Value, X, Y, rotation, top/bottom
5727 # X,Y in mils.  rotation in degrees.
5728 # --------------------------------------------
5729 R61,"0603","10",2610.00,3560.00,90,top
5730 J5,"AMPHENOL_ARFX1231","unknown",2390.00,4220.00,180,top
5731 C13,"0402","0.01u",2340.00,3014.00,270,top
5733 @end example
5735 @section Computation of Centroid and Rotation
5736 @cindex centroid file, algorithms
5737 @cindex x-y file, algorithms
5738 The center of each element is found by averaging the (X,Y) coordinates
5739 for the center of each pin and pad in the element.  For example if an
5740 element has 2 pins, 1 at (1,0) and another at (1,4) then the centroid
5741 will be at (1,2).
5743 The calculation of rotation is a bit more complex.  Currently a
5744 rotation is not stored for each element but rather the rotated element
5745 is stored.  In other words if the element from the library has a pin
5746 at (0,0) and (0,2) and it has been rotated by 90 degrees, then the
5747 @file{.pcb} file will store (0,0) and (2,0) for the pin locations with
5748 no indication that they have been rotated from the original.
5750 In the event that the element has only 1 pin, then the rotation is set
5751 to zero.  If the element has only one pad (as opposed to a
5752 through-hole pin), then the rotation of the pad is used.
5754 When the element has multiple pins, the location of pin #1 is placed
5755 in the coordinate system which has the centroid of the part at (0,0).
5756 Then which quadrant pin #1 falls in determines the rotation.  Zero
5757 degrees of rotation is defined as pin #1 being in the upper left
5758 quadrant.  Increasing angles correspond to counterclockwise rotation so a
5759 rotation of 90 degrees places pin #1 in the lower left quadrant.
5760 Currently, the only allowed rotations are 0, 90, 180, and 270 degrees.
5762 If pin #1 happens to be at the centroid of the part, then pin #2 is
5763 examined to see which quadrant it is located in.  The same rules apply
5764 for the definitions of rotation.  In other words, when pin #1 is at
5765 the centroid of the part and pin #2 is in the upper left quadrant, the
5766 rotation is declared to be zero degrees.
5768 @c --------------------------- Appendix -- Annotation File Format ----------------------
5769 @node Annotation File Format
5770 @appendix Annotation File Format
5771 @cindex annotation file format
5772 @cindex backannotation file format
5774 @section Overview
5776 @section File Format
5777 The annotation output file an ASCII file that can be used to communicate 
5778 layout changes that affect the netlist back to a schematic tool.  Currently
5779 the only place this file is used is if when the Renumber() action is called
5780 within Pcb.  Renumber() will renumber all the reference designators (instance
5781 names) in the layout.  The result of the renumbering will be written out to 
5782 an annotation file which can be used to propagate the changes to the schematic
5783 sources.  See @ref{Renumber Action} for details on the Renumber() action.  If you
5784 are using gschem (part of gEDA/gaf) as your schematic entry tool then refer
5785 to pcb_backannotate(1) for details on how to use the annotation file to make
5786 the changes to the schematics.
5788 The annotation file format is fairly simple.  Each line consists of a command followed
5789 by arguments.  Blank lines and lines consisting of only whitespace are ignored.
5790 There are no line continuations.
5792 An example annotation file is shown below.
5793 @example
5795 *COMMENT* PCB Annotation File
5796 *FILEVERSION* 20061031
5797 *RENAME* "C17" "C1"
5798 *RENAME* "U5" "U1"
5799 *RENAME* "U6" "U2"
5800 *RENAME* "C21" "C2"
5801 *RENAME* "R14" "R1"
5802 *RENAME* "C7" "C3"
5803 *RENAME* "C8" "C4"
5804 *RENAME* "C6" "C5"
5806 @end example
5808 @subsection *COMMENT*
5809 Command for a comment.  The text of a comment is ignored by tools which process
5810 the annotation file.
5811 @cartouche
5812 @format
5813 *COMMENT* text
5814 @end format
5815 @end cartouche
5817 @subsection *FILEVERSION*
5818 Indicates what version of the annotation file is in use.  The date code corresponds to the 
5819 date when the current version was added to the Pcb sources.  
5820 @cartouche
5821 @format
5822 *FILEVERSION* datecode
5823 @end format
5824 @end cartouche
5826 @subsection *RENAME*
5827 Renames an element.  The arguments are enclosed in double quotes and are the original name
5828 and the new name.
5829 @cartouche
5830 @format
5831 *RENAME* ``old'' ``new''
5832 @end format
5833 @end cartouche
5835 @c --------------------------- Appendix -- Actions ----------------------
5836 @node Action Reference
5837 @appendix Action Reference
5838 @cindex action reference
5840 @include actions.texi
5842 @c --------------------------- Appendix -- Glossary ----------------------
5843 @node Glossary
5844 @appendix Glossary
5845 @cindex glossary
5846 @cindex terminology
5847 @cindex index of terms
5849 @table @asis
5851 @item Footprint
5852 The pattern of metal, silkscreen, soldermask relief, and drills which
5853 defines where you place a component on a circuit board.
5854 Footprints are the placed by the user onto the PC board during the
5855 placement phase of PCB layout.
5857 @item Gerber File
5858 The file format used in the industry to convey a board database to the
5859 manufacturer is RS-274X (which replaces the now obsolete RS-274D
5860 format).  This file format was originally developed by Gerber for
5861 their photo plotters and thus RS-274D and RS-274X format files 
5862 are often times refered to as ``Gerber'' files.
5864 @item Thermal, Thermal Relief
5865 A thermal relief is a way of connecting a pin to a ground
5866 or power plane.  Instead of directly connecting to the plane, small "spokes"
5867 are used to increase the thermal resistance between the pin and the plane.
5868 Often times these connections are refered to as simply a thermal.  By increasing
5869 the thermal resistance to the plane, it becomes easier to solder to the
5870 pin.  In the drawing below, the pin on the left is connected to the
5871 polygon using a solid connection with no thermal relief, the middle
5872 pin is connected using a thermal, while the pin on the right has no
5873 connection to the polygon.  In PCB, the ``Thermal'' Tool is used to
5874 make both a solid connection and one with thermal relief (see @ref{Polygon Objects}).
5876 @center @image{thermal,,,Example of a thermal relief,png}
5878 @end table
5880 @c ---------------------------------------------------------------------
5881 @node Index
5882 @unnumbered Index of Resources
5883 @printindex vr
5885 @unnumbered Index of Actions, Commands and Options
5886 @printindex fn
5888 @unnumbered Index of Concepts
5889 @printindex cp
5891 @contents
5892 @bye