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