File: 186.htm

package info (click to toggle)
eagle 4.16-5
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 36,508 kB
  • sloc: sh: 82; makefile: 32
file content (124 lines) | stat: -rw-r--r-- 5,690 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<html>
<head>
<title>EAGLE Help: UL_POLYGON</title>
</head>
<body bgcolor=white>
<font face=Helvetica,Arial>
<hr>
<i>EAGLE Help</i>
<h1><center>UL_POLYGON</center></h1>
<hr>
<b>Data members</b>
<p>
<table>
<tr><td valign=top><font face=Helvetica,Arial><tt>isolate</tt>      </font></td><td valign=top><font face=Helvetica,Arial><a href=156.htm>int</a></font></td></tr>
<tr><td valign=top><font face=Helvetica,Arial><tt>layer</tt>        </font></td><td valign=top><font face=Helvetica,Arial><a href=156.htm>int</a></font></td></tr>
<tr><td valign=top><font face=Helvetica,Arial><tt>orphans</tt>      </font></td><td valign=top><font face=Helvetica,Arial><a href=156.htm>int</a> (0=off, 1=on)</font></td></tr>
<tr><td valign=top><font face=Helvetica,Arial><tt>pour</tt>         </font></td><td valign=top><font face=Helvetica,Arial><a href=156.htm>int</a> (<tt>POLYGON_POUR_...</tt>)</font></td></tr>
<tr><td valign=top><font face=Helvetica,Arial><tt>rank</tt>         </font></td><td valign=top><font face=Helvetica,Arial><a href=156.htm>int</a></font></td></tr>
<tr><td valign=top><font face=Helvetica,Arial><tt>spacing</tt>      </font></td><td valign=top><font face=Helvetica,Arial><a href=156.htm>int</a></font></td></tr>
<tr><td valign=top><font face=Helvetica,Arial><tt>thermals</tt>     </font></td><td valign=top><font face=Helvetica,Arial><a href=156.htm>int</a> (0=off, 1=on)</font></td></tr>
<tr><td valign=top><font face=Helvetica,Arial><tt>width</tt>        </font></td><td valign=top><font face=Helvetica,Arial><a href=156.htm>int</a></font></td></tr>
</table>
<p>
<b>Loop members</b>
<p>
<table>
<tr><td valign=top><font face=Helvetica,Arial><tt>contours()</tt>   </font></td><td valign=top><font face=Helvetica,Arial><a href=196.htm>UL_WIRE</a> (see note)</font></td></tr>
<tr><td valign=top><font face=Helvetica,Arial><tt>fillings()</tt>   </font></td><td valign=top><font face=Helvetica,Arial><a href=196.htm>UL_WIRE</a></font></td></tr>
<tr><td valign=top><font face=Helvetica,Arial><tt>wires()</tt>      </font></td><td valign=top><font face=Helvetica,Arial><a href=196.htm>UL_WIRE</a></font></td></tr>
</table>
<p>
<b>Constants</b>
<p>
<table>
<tr><td valign=top><font face=Helvetica,Arial><tt>POLYGON_POUR_SOLID</tt>   </font></td><td valign=top><font face=Helvetica,Arial>solid</font></td></tr>
<tr><td valign=top><font face=Helvetica,Arial><tt>POLYGON_POUR_HATCH</tt>   </font></td><td valign=top><font face=Helvetica,Arial>hatch</font></td></tr>
</table>
<p>
<b>See also</b> <a href=164.htm>UL_BOARD</a>,
<a href=181.htm>UL_PACKAGE</a>,
<a href=190.htm>UL_SHEET</a>,
<a href=191.htm>UL_SIGNAL</a>,
<a href=193.htm>UL_SYMBOL</a>
<p>
<b>Note</b>
<p>
The <tt>contours()</tt> and <tt>fillings()</tt> loop members loop through the
wires that are used to draw the calculated polygon if it is part of a signal and
the polygon has been calculated by the <a href=75.htm>RATSNEST</a>
command. The <tt>wires()</tt> loop member always loops through the polygon
wires as they were drawn by the user. For an uncalculated signal polygon
<tt>contours()</tt> does the same as <tt>wires()</tt>, and <tt>fillings()</tt>
does nothing.
<p>
<b>Polygon width</b>
<p>
When using the <tt>fillings()</tt> loop member to get the fill wires of a solid
polygon, make sure the <i>width</i> of the polygon is not zero (actually it should
be quite a bit larger than zero, for example at least the hardware resolution of
the output device you are going to draw on). <b>Filling a polygon with zero width
may result in enormous amounts of data, since it will be calculated with the
smallest editor resolution of 1/10000mm!</b>
<p>
<b>Partial polygons</b>
<p>
A calculated signal polygon may consist of several distinct parts (called
<i>positive</i> polygons), each of which can contain extrusions (<i>negative</i>
polygons) resulting from other objects being subtracted from the polygon.
Negative polygons can again contain other positive polygons and so on.
<p>
The wires looped through by <tt>contours()</tt> always start with a positive
polygon. To find out where one partial polygon ends and the next one begins, simply
store the (x1,y1) coordinates of the first wire and check them against
(x2,y2) of every following wire. As soon as these are equal, the last wire
of a partial polygon has been found. It is also guaranteed that the second
point (x2,y2) of one wire is identical to the first point (x1,y1) of the
next wire in that partial polygon.
<p>
To find out where the "inside" and the "outside" of the polygon lays,
take any contour wire and imagine looking from its point (x1,y1) to (x2,y2).
The "inside" of the polygon is always on the right side of the wire.
Note that if you simply want to draw the polygon you won't need all these
details.
<p>
<b>Example</b>
<p>
<pre>
board(B) {
  B.signals(S) {
    S.polygons(P) {
      int x0, y0, first = 1;
      P.contours(W) {
        if (first) {
           // a new partial polygon is starting
           x0 = W.x1;
           y0 = W.y1;
           }
        // ...
        // do something with the wire
        // ...
        if (first)
           first = 0;
        else if (W.x2 == x0 &amp;&amp; W.y2 == y0) {
           // this was the last wire of the partial polygon,
           // so the next wire (if any) will be the first wire
           // of the next partial polygon
           first = 1;
           }
        }
      }
    }
  }
</pre>

<hr>
<table width=100% cellspacing=0 border=0><tr><td align=left><font face=Helvetica,Arial>
<a href=index.htm>Index</a>
</font></td><td align=right><font face=Helvetica,Arial size=-1>
<i>Copyright &copy; 2005 CadSoft Computer GmbH</i>
</font></td></tr></table>
<hr>
</font>
</body>
</html>