mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-23 04:13:20 +02:00
cameo/gerber.c: support %FSLAX46Y46*% and %MOMM*%
This commit is contained in:
parent
e3cd91bc40
commit
503036c22e
@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* gerber.c - Gerber file input
|
* gerber.c - Gerber file input
|
||||||
*
|
*
|
||||||
* Written 2010, 2013, 2015 by Werner Almesberger
|
* Written 2010, 2013, 2015, 2017 by Werner Almesberger
|
||||||
* Copyright 2010, 2013, 2015 Werner Almesberger
|
* Copyright 2010, 2013, 2015, 2017 Werner Almesberger
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -27,9 +27,9 @@
|
|||||||
#include "gerber.h"
|
#include "gerber.h"
|
||||||
|
|
||||||
|
|
||||||
/* KiCad Gerber uses 0.1 mil units */
|
static double scale; /* KiCad Gerber units */
|
||||||
|
|
||||||
#define KU2MM(in) ((in)/10000.0*25.4)
|
#define KU2MM(in) ((in)/scale)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -90,15 +90,22 @@ struct path *gerber_read(const char *name, double r_tool_default)
|
|||||||
while (fgets(buf, sizeof(buf), file)) {
|
while (fgets(buf, sizeof(buf), file)) {
|
||||||
lineno++;
|
lineno++;
|
||||||
if (!strncmp(buf, "%FS", 3)) {
|
if (!strncmp(buf, "%FS", 3)) {
|
||||||
if (strcmp(buf, "%FSLAX34Y34*%\n")) {
|
if (!strcmp(buf, "%FSLAX34Y34*%\n")) {
|
||||||
|
scale = 10 * 1000;
|
||||||
|
} else if (!strcmp(buf, "%FSLAX46Y46*%\n")) {
|
||||||
|
scale = 1000 * 1000;
|
||||||
|
} else {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"unrecognized format %s\n", buf);
|
"unrecognized format %s\n", buf);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
/* @@@ we assume that %MO follows %FS */
|
||||||
if (!strncmp(buf, "%MO", 3)) {
|
if (!strncmp(buf, "%MO", 3)) {
|
||||||
if (strcmp(buf, "%MOIN*%\n")) {
|
if (!strcmp(buf, "%MOIN*%\n")) {
|
||||||
|
scale /= 25.4;
|
||||||
|
} else if (strcmp(buf, "%MOMM*%\n")) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"unrecognized mode %s\n", buf);
|
"unrecognized mode %s\n", buf);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user