mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2025-04-21 12:27:27 +03:00
cameo: added KiCad Gerber input and path merging
- Makefile (OBJS): added gerber.o - cameo.c (usage, main): new option -g to process input a KiCad Gerber - gerber.h, gerber.c (gerber_read): parse Gerber files as generated by KiCad - path.h, path.c (path_reverse_inplace, points_eq, attr_eq, path_connect): merge sets of paths with equal endpoints into single paths
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "path.h"
|
||||
#include "gnuplot.h"
|
||||
#include "gerber.h"
|
||||
|
||||
|
||||
static int dog_bone = 0;
|
||||
@@ -65,9 +66,11 @@ static void process_paths(struct path *paths)
|
||||
static void usage(const char *name)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s [-d] r_mm [in.gnuplot [out.gnuplot]]\n\n"
|
||||
"usage: %s [-d] r_mm [in.gnuplot [out.gnuplot]]\n"
|
||||
" %s -g [-d] r_mm [in.gerber [out.gnuplot]]\n\n"
|
||||
" -d put a dog-bone notch in each concave external corner\n"
|
||||
, name);
|
||||
" -g input format is KiCad Gerber, not gnuplot\n"
|
||||
, name, name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -75,15 +78,19 @@ static void usage(const char *name)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *in = NULL, *out = NULL;
|
||||
int gerber = 0;
|
||||
double r;
|
||||
struct path *paths;
|
||||
int c;
|
||||
|
||||
while ((c = getopt(argc, argv, "d")) != EOF)
|
||||
while ((c = getopt(argc, argv, "dg")) != EOF)
|
||||
switch (c) {
|
||||
case 'd':
|
||||
dog_bone = 1;
|
||||
break;
|
||||
case 'g':
|
||||
gerber = 1;
|
||||
break;
|
||||
default:
|
||||
usage(*argv);
|
||||
}
|
||||
@@ -102,7 +109,10 @@ int main(int argc, char **argv)
|
||||
usage(*argv);
|
||||
}
|
||||
|
||||
paths = gnuplot_read(in, r);
|
||||
if (gerber)
|
||||
paths = gerber_read(in, r);
|
||||
else
|
||||
paths = gnuplot_read(in, r);
|
||||
process_paths(paths);
|
||||
gnuplot_write(out, paths);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user