1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-22 23:16:27 +02:00

gp2rml/gp2rml.c: allow unit of Z clearance (mm) to be specified explictly

This commit is contained in:
Werner Almesberger 2011-09-01 12:00:22 -03:00
parent 50918a26fd
commit 00166f3751

View File

@ -1,8 +1,8 @@
/*
* gp2rml.c - Convert from gnuplot to RML
*
* Written 2010 by Werner Almesberger
* Copyright 2010 Werner Almesberger
* Written 2010-2011 by Werner Almesberger
* Copyright 2010-2011 Werner Almesberger
*
* 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
@ -35,6 +35,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
@ -178,8 +179,9 @@ static void output_paths(double z_clear, double xy_speed, double z_speed)
static void usage(const char *name)
{
fprintf(stderr,
"usage: %s z_clear xy_speed z_speed [file]\n\n"
"usage: %s z_clear[mm] xy_speed z_speed [file]\n\n"
" z_clear clearance above the highest peak, in mm (must be > 0)\n"
" Unit (\"mm\") can optionally be specified\n"
" xy_speed cutting speed, in mm/s\n"
" z_speed vertical speed when lowering the pen, in mm/s\n"
, name);
@ -210,6 +212,12 @@ int main(int argc, const char **argv)
}
for (i = 0; i != 3; i++) {
p[i] = strtod(argv[i+1], &end);
/*
* Allow the clearance to have a unit, for consistency in
* mkmk-simple
*/
if (!i && *end && !strcmp(end, "mm"))
continue;
if (*end || p[i] <= 0)
usage(*argv);
}