pcb 4.1.1
An interactive printed circuit board layout editor.
|
00001 00031 #ifndef PCB_CONST_H 00032 #define PCB_CONST_H 00033 00034 #include <limits.h> 00035 #include <math.h> 00036 00037 #include "globalconst.h" 00038 00039 /* --------------------------------------------------------------------------- 00040 * integer codings for the board sides. 00041 */ 00042 #define BOTTOM_SIDE 0 00043 #define TOP_SIDE 1 00044 00045 00083 /* --------------------------------------------------------------------------- 00084 * the layer-numbers of the two additional special (silkscreen) layers 00085 * 'bottom' and 'top'. The offset of MAX_LAYER is not added 00086 */ 00087 #define SILK_LAYER 2 00088 #define BOTTOM_SILK_LAYER 0 00089 #define TOP_SILK_LAYER 1 00090 00091 /* --------------------------------------------------------------------------- 00092 * the resulting maximum number of layers, including additional silk layers 00093 */ 00094 #define MAX_ALL_LAYER (MAX_LAYER + SILK_LAYER) 00095 00096 /* --------------------------------------------------------------------------- 00097 * misc constants 00098 */ 00099 #define MARK_SIZE MIL_TO_COORD(50) 00100 #define UNDO_WARNING_SIZE (1024*1024) 00101 #define USERMEDIANAME "user defined" 00103 /* --------------------------------------------------------------------------- 00104 * some math constants 00105 */ 00106 #ifndef M_PI 00107 #define M_PI 3.14159265358979323846 00108 #endif 00109 #ifndef M_SQRT1_2 00110 #define M_SQRT1_2 0.707106781 00111 #endif 00112 #define M180 (M_PI/180.0) 00113 #define RAD_TO_DEG (180.0/M_PI) 00114 #define TAN_22_5_DEGREE_2 0.207106781 00115 #define COS_22_5_DEGREE 0.923879533 00116 #define TAN_30_DEGREE 0.577350269 00117 #define TAN_60_DEGREE 1.732050808 00118 #define LN_2_OVER_2 0.346573590 00119 00120 /* PCB/physical unit conversions */ 00121 #define COORD_TO_MIL(n) ((n) / 25400.0) 00122 #define MIL_TO_COORD(n) ((n) * 25400.0) 00123 #define COORD_TO_MM(n) ((n) / 1000000.0) 00124 #define MM_TO_COORD(n) ((n) * 1000000.0) 00125 #define COORD_TO_INCH(n) (COORD_TO_MIL(n) / 1000.0) 00126 #define INCH_TO_COORD(n) (MIL_TO_COORD(n) * 1000.0) 00127 00128 /* These need to be carefully written to avoid overflows, and return 00129 a Coord type. */ 00130 #define SCALE_TEXT(COORD,TEXTSCALE) ((Coord)((COORD) * ((double)(TEXTSCALE) / 100.0))) 00131 #define UNSCALE_TEXT(COORD,TEXTSCALE) ((Coord)((COORD) * (100.0 / (double)(TEXTSCALE)))) 00132 00133 /* --------------------------------------------------------------------------- 00134 * modes 00135 */ 00136 #define NO_MODE 0 00137 #define VIA_MODE 1 00138 #define LINE_MODE 2 00139 #define RECTANGLE_MODE 3 00140 #define POLYGON_MODE 4 00141 #define PASTEBUFFER_MODE 5 00142 #define TEXT_MODE 6 00143 #define ROTATE_MODE 102 00144 #define REMOVE_MODE 103 00145 #define MOVE_MODE 104 00146 #define COPY_MODE 105 00147 #define INSERTPOINT_MODE 106 00148 #define RUBBERBANDMOVE_MODE 107 00149 #define THERMAL_MODE 108 00150 #define ARC_MODE 109 00151 #define ARROW_MODE 110 00152 #define PAN_MODE 0 00153 #define LOCK_MODE 111 00154 #define POLYGONHOLE_MODE 112 00156 /* --------------------------------------------------------------------------- 00157 * object flags 00158 */ 00159 00160 /* %start-doc pcbfile ~objectflags 00161 @node Object Flags 00162 @section Object Flags 00163 00164 Note that object flags can be given numerically (like @code{0x0147}) 00165 or symbolically (like @code{"found,showname,square"}. Some numeric 00166 values are reused for different object types. The table below lists 00167 the numeric value followed by the symbolic name. 00168 00169 @table @code 00170 @item 0x0001 pin 00171 If set, this object is a pin. This flag is for internal use only. 00172 @item 0x0002 via 00173 Likewise, for vias. 00174 @item 0x0004 found 00175 If set, this object has been found by @code{FindConnection()}. 00176 @item 0x0008 hole 00177 For pins and vias, this flag means that the pin or via is a hole 00178 without a copper annulus. 00179 @item 0x0008 nopaste 00180 For pads, set to prevent a solderpaste stencil opening for the 00181 pad. Primarily used for pads used as fiducials. 00182 @item 0x0010 rat 00183 If set for a line, indicates that this line is a rat line instead of a 00184 copper trace. 00185 @item 0x0010 pininpoly 00186 For pins and pads, this flag is used internally to indicate that the 00187 pin or pad overlaps a polygon on some layer. 00188 @item 0x0010 clearpoly 00189 For polygons, this flag means that pins and vias will normally clear 00190 these polygons (thus, thermals are required for electrical 00191 connection). When clear, polygons will solidly connect to pins and 00192 vias. 00193 @item 0x0010 hidename 00194 For elements, when set the name of the element is hidden. 00195 @item 0x0020 showname 00196 For elements, when set the names of pins are shown. 00197 @item 0x0020 clearline 00198 For lines and arcs, the line/arc will clear polygons instead of 00199 connecting to them. 00200 @item 0x0020 fullpoly 00201 For polygons, the full polygon is drawn (i.e. all parts instead of only the biggest one). 00202 @item 0x0040 selected 00203 Set when the object is selected. 00204 @item 0x0080 onsolder 00205 For elements and pads, indicates that they are on the solder side. 00206 @item 0x0080 auto 00207 For lines and vias, indicates that these were created by the 00208 autorouter. 00209 @item 0x0100 square 00210 For pins and pads, indicates a square (vs round) pin/pad. 00211 @item 0x0200 rubberend 00212 For lines, used internally for rubber band moves. 00213 @item 0x0200 warn 00214 For pins, vias, and pads, set to indicate a warning. 00215 @item 0x0400 usetherm 00216 Obsolete, indicates that pins/vias should be drawn with thermal 00217 fingers. 00218 @item 0x0400 00219 Obsolete, old files used this to indicate lines drawn on silk. 00220 @item 0x0800 octagon 00221 Draw pins and vias as octagons. 00222 @item 0x1000 drc 00223 Set for objects that fail DRC. 00224 @item 0x2000 lock 00225 Set for locked objects. 00226 @item 0x4000 edge2 00227 For pads, indicates that the second point is closer to the edge. For 00228 pins, indicates that the pin is closer to a horizontal edge and thus 00229 pinout text should be vertical. 00230 @item 0x8000 marker 00231 Marker used internally to avoid revisiting an object. 00232 @item 0x10000 connected 00233 If set, this object has been as physically connected by @code{FindConnection()}. 00234 @end table 00235 %end-doc */ 00236 00237 #define NOFLAG 0x0000 00238 #define PINFLAG 0x0001 00239 #define VIAFLAG 0x0002 00240 #define FOUNDFLAG 0x0004 00241 #define HOLEFLAG 0x0008 00242 #define NOPASTEFLAG 0x0008 00245 #define RATFLAG 0x0010 00246 #define PININPOLYFLAG 0x0010 00248 #define CLEARPOLYFLAG 0x0010 00249 #define HIDENAMEFLAG 0x0010 00250 #define DISPLAYNAMEFLAG 0x0020 00252 #define CLEARLINEFLAG 0x0020 00253 #define FULLPOLYFLAG 0x0020 00254 #define SELECTEDFLAG 0x0040 00255 #define ONSOLDERFLAG 0x0080 00256 #define AUTOFLAG 0x0080 00257 #define SQUAREFLAG 0x0100 00258 #define RUBBERENDFLAG 0x0200 00261 #define WARNFLAG 0x0200 00262 #define USETHERMALFLAG 0x0400 00263 #define ONSILKFLAG 0x0400 00264 #define OCTAGONFLAG 0x0800 00265 #define DRCFLAG 0x1000 00266 #define LOCKFLAG 0x2000 00267 #define EDGE2FLAG 0x4000 00269 #define VISITFLAG 0x8000 00270 #define CONNECTEDFLAG 0x10000 00273 #define NOCOPY_FLAGS (FOUNDFLAG | CONNECTEDFLAG) 00274 00275 /* --------------------------------------------------------------------------- 00276 * PCB flags 00277 */ 00278 00279 /* %start-doc pcbfile ~pcbflags 00280 @node PCBFlags 00281 @section PCBFlags 00282 @table @code 00283 @item 0x00001 00284 Pinout displays pin numbers instead of pin names. 00285 @item 0x00002 00286 Use local reference for moves, by setting the mark at the beginning of 00287 each move. 00288 @item 0x00004 00289 When set, only polygons and their clearances are drawn, to see if 00290 polygons have isolated regions. 00291 @item 0x00008 00292 Display DRC region on crosshair. 00293 @item 0x00010 00294 Do all move, mirror, rotate with rubberband connections. 00295 @item 0x00020 00296 Display descriptions of elements, instead of refdes. 00297 @item 0x00040 00298 Display names of elements, instead of refdes. 00299 @item 0x00080 00300 Auto-DRC flag. When set, PCB doesn't let you place copper that 00301 violates DRC. 00302 @item 0x00100 00303 Enable 'all-direction' lines. 00304 @item 0x00200 00305 Switch starting angle after each click. 00306 @item 0x00400 00307 Force unique names on board. 00308 @item 0x00800 00309 New lines/arc clear polygons. 00310 @item 0x01000 00311 Crosshair snaps to pins and pads. 00312 @item 0x02000 00313 Show the solder mask layer. 00314 @item 0x04000 00315 Draw with thin lines. 00316 @item 0x08000 00317 Move items orthogonally. 00318 @item 0x10000 00319 Draw autoroute paths real-time. 00320 @item 0x20000 00321 New polygons are full ones. 00322 @item 0x40000 00323 Names are locked, the mouse cannot select them. 00324 @item 0x80000 00325 Everything but names are locked, the mouse cannot select anything else. 00326 @item 0x100000 00327 New polygons are full polygons. 00328 @item 0x200000 00329 When set, element names are not drawn. 00330 @end table 00331 %end-doc */ 00332 00333 #define PCB_FLAGS 0x000fffff /* all used flags */ 00334 00335 #define SHOWNUMBERFLAG 0x00000001 00336 #define LOCALREFFLAG 0x00000002 00337 #define CHECKPLANESFLAG 0x00000004 00338 #define SHOWDRCFLAG 0x00000008 00339 #define RUBBERBANDFLAG 0x00000010 00340 #define DESCRIPTIONFLAG 0x00000020 00341 #define NAMEONPCBFLAG 0x00000040 00342 #define AUTODRCFLAG 0x00000080 00343 #define ALLDIRECTIONFLAG 0x00000100 00344 #define SWAPSTARTDIRFLAG 0x00000200 00345 #define UNIQUENAMEFLAG 0x00000400 00346 #define CLEARNEWFLAG 0x00000800 00347 #define SNAPPINFLAG 0x00001000 00348 #define SHOWMASKFLAG 0x00002000 00349 #define THINDRAWFLAG 0x00004000 00350 #define ORTHOMOVEFLAG 0x00008000 00351 #define LIVEROUTEFLAG 0x00010000 00352 #define THINDRAWPOLYFLAG 0x00020000 00353 #define LOCKNAMESFLAG 0x00040000 00354 #define ONLYNAMESFLAG 0x00080000 00355 #define NEWFULLPOLYFLAG 0x00100000 00356 #define HIDENAMESFLAG 0x00200000 00357 #define AUTOBURIEDVIASFLAG 0x00400000 00358 00359 /* --------------------------------------------------------------------------- 00360 * object types 00361 */ 00362 #define NO_TYPE 0x00000 00363 #define VIA_TYPE 0x00001 00364 #define ELEMENT_TYPE 0x00002 00365 #define LINE_TYPE 0x00004 00366 #define POLYGON_TYPE 0x00008 00367 #define TEXT_TYPE 0x00010 00368 #define RATLINE_TYPE 0x00020 00369 00370 #define PIN_TYPE 0x00100 00371 #define PAD_TYPE 0x00200 00372 #define ELEMENTNAME_TYPE 0x00400 00373 #define POLYGONPOINT_TYPE 0x00800 00374 #define LINEPOINT_TYPE 0x01000 00375 #define ELEMENTLINE_TYPE 0x02000 00376 #define ARC_TYPE 0x04000 00377 #define ELEMENTARC_TYPE 0x08000 00378 00379 #define LOCKED_TYPE 0x10000 00380 #define NET_TYPE 0x20000 00381 #define ARCPOINT_TYPE 0x40000 00382 00383 #define PIN_TYPES (VIA_TYPE | PIN_TYPE) 00384 #define LOCK_TYPES (VIA_TYPE | LINE_TYPE | ARC_TYPE | POLYGON_TYPE | ELEMENT_TYPE \ 00385 | TEXT_TYPE | ELEMENTNAME_TYPE | LOCKED_TYPE) 00386 00387 #define ALL_TYPES (~0) 00389 #endif