Date: | 2010-12-15 10:34:53 (13 years 3 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | 7cb25c5a3fe36eba8466e38c37c9f11c9aabc99b |
Message: | cameo: apply translation after loading a file only to the new file - lang.y (translate): list of paths is now an argument (instead of always using the global path list) - lang.y: on "gerber", "gnuplot", and "excellon", only translate the new paths |
Files: |
cameo/lang.y (5 diffs) |
Change Details
cameo/lang.y | ||
---|---|---|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | static void translate(double x, double y, double z) | |
44 | static void translate(struct path *list, double x, double y, double z) | |
45 | 45 | { |
46 | 46 | struct path *path; |
47 | 47 | struct point *p; |
48 | 48 | |
49 | for (path = paths; path; path = path->next) | |
49 | for (path = list; path; path = path->next) | |
50 | 50 | for (p = path->first; p; p = p->next) { |
51 | 51 | p->x += x; |
52 | 52 | p->y += y; |
... | ... | |
103 | 103 | xd = x-xr; |
104 | 104 | yd = y-yr; |
105 | 105 | |
106 | translate(xd, yd, 0); | |
106 | translate(paths, xd, yd, 0); | |
107 | 107 | xo += xd; |
108 | 108 | yo += yd; |
109 | 109 | } |
... | ... | |
191 | 191 | double x = $2*$4; |
192 | 192 | double y = $3*$5; |
193 | 193 | |
194 | translate(x, y, 0); | |
194 | translate(paths, x, y, 0); | |
195 | 195 | xo += x; |
196 | 196 | yo += y; |
197 | 197 | } |
... | ... | |
210 | 210 | } |
211 | 211 | | TOK_TRANSLATE dimen dimen |
212 | 212 | { |
213 | translate($2, $3, 0); | |
213 | translate(paths, $2, $3, 0); | |
214 | 214 | xo += $2; |
215 | 215 | yo += $3; |
216 | 216 | } |
... | ... | |
224 | 224 | } |
225 | 225 | | TOK_GERBER dimen opt_filename |
226 | 226 | { |
227 | add_paths(gerber_read($3, $2/2)); | |
228 | translate(xo, yo, 0); | |
227 | struct path *new; | |
228 | ||
229 | new = gerber_read($3, $2/2); | |
230 | translate(new, xo, yo, 0); | |
231 | add_paths(new); | |
229 | 232 | } |
230 | 233 | | TOK_GNUPLOT dimen opt_filename |
231 | 234 | { |
232 | add_paths(gnuplot_read($3, $2/2)); | |
233 | translate(xo, yo, 0); | |
235 | struct path *new; | |
236 | ||
237 | new = gnuplot_read($3, $2/2); | |
238 | translate(new, xo, yo, 0); | |
239 | add_paths(new); | |
234 | 240 | } |
235 | 241 | | TOK_EXCELLON opt_filename |
236 | 242 | { |
237 | add_paths(excellon_read($2)); | |
238 | translate(xo, yo, 0); | |
243 | struct path *new; | |
244 | ||
245 | new = excellon_read($2); | |
246 | translate(new, xo, yo, 0); | |
247 | add_paths(new); | |
239 | 248 | } |
240 | 249 | | TOK_WRITE opt_filename |
241 | 250 | { |
242 | translate(0, 0, zo); | |
251 | translate(paths, 0, 0, zo); | |
243 | 252 | gnuplot_write($2, paths); |
244 | translate(0, 0, -zo); | |
253 | translate(paths, 0, 0, -zo); | |
245 | 254 | } |
246 | 255 | | TOK_APPEND opt_filename |
247 | 256 | { |
248 | translate(0, 0, zo); | |
257 | translate(paths, 0, 0, zo); | |
249 | 258 | gnuplot_append($2, paths); |
250 | translate(0, 0, -zo); | |
259 | translate(paths, 0, 0, -zo); | |
251 | 260 | } |
252 | 261 | | TOK_DRILL dimen dimen |
253 | 262 | { |
Branches:
master