mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2025-01-03 22:30:14 +02:00
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
This commit is contained in:
parent
b76d17fea0
commit
7cb25c5a3f
39
cameo/lang.y
39
cameo/lang.y
@ -41,12 +41,12 @@ static void add_paths(struct path *new)
|
||||
}
|
||||
|
||||
|
||||
static void translate(double x, double y, double z)
|
||||
static void translate(struct path *list, double x, double y, double z)
|
||||
{
|
||||
struct path *path;
|
||||
struct point *p;
|
||||
|
||||
for (path = paths; path; path = path->next)
|
||||
for (path = list; path; path = path->next)
|
||||
for (p = path->first; p; p = p->next) {
|
||||
p->x += x;
|
||||
p->y += y;
|
||||
@ -103,7 +103,7 @@ static void align(int ref, double x, double y)
|
||||
xd = x-xr;
|
||||
yd = y-yr;
|
||||
|
||||
translate(xd, yd, 0);
|
||||
translate(paths, xd, yd, 0);
|
||||
xo += xd;
|
||||
yo += yd;
|
||||
}
|
||||
@ -191,7 +191,7 @@ command:
|
||||
double x = $2*$4;
|
||||
double y = $3*$5;
|
||||
|
||||
translate(x, y, 0);
|
||||
translate(paths, x, y, 0);
|
||||
xo += x;
|
||||
yo += y;
|
||||
}
|
||||
@ -210,7 +210,7 @@ command:
|
||||
}
|
||||
| TOK_TRANSLATE dimen dimen
|
||||
{
|
||||
translate($2, $3, 0);
|
||||
translate(paths, $2, $3, 0);
|
||||
xo += $2;
|
||||
yo += $3;
|
||||
}
|
||||
@ -224,30 +224,39 @@ command:
|
||||
}
|
||||
| TOK_GERBER dimen opt_filename
|
||||
{
|
||||
add_paths(gerber_read($3, $2/2));
|
||||
translate(xo, yo, 0);
|
||||
struct path *new;
|
||||
|
||||
new = gerber_read($3, $2/2);
|
||||
translate(new, xo, yo, 0);
|
||||
add_paths(new);
|
||||
}
|
||||
| TOK_GNUPLOT dimen opt_filename
|
||||
{
|
||||
add_paths(gnuplot_read($3, $2/2));
|
||||
translate(xo, yo, 0);
|
||||
struct path *new;
|
||||
|
||||
new = gnuplot_read($3, $2/2);
|
||||
translate(new, xo, yo, 0);
|
||||
add_paths(new);
|
||||
}
|
||||
| TOK_EXCELLON opt_filename
|
||||
{
|
||||
add_paths(excellon_read($2));
|
||||
translate(xo, yo, 0);
|
||||
struct path *new;
|
||||
|
||||
new = excellon_read($2);
|
||||
translate(new, xo, yo, 0);
|
||||
add_paths(new);
|
||||
}
|
||||
| TOK_WRITE opt_filename
|
||||
{
|
||||
translate(0, 0, zo);
|
||||
translate(paths, 0, 0, zo);
|
||||
gnuplot_write($2, paths);
|
||||
translate(0, 0, -zo);
|
||||
translate(paths, 0, 0, -zo);
|
||||
}
|
||||
| TOK_APPEND opt_filename
|
||||
{
|
||||
translate(0, 0, zo);
|
||||
translate(paths, 0, 0, zo);
|
||||
gnuplot_append($2, paths);
|
||||
translate(0, 0, -zo);
|
||||
translate(paths, 0, 0, -zo);
|
||||
}
|
||||
| TOK_DRILL dimen dimen
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user