From 00166f3751e01fdb5a8cb7664925fc37dfda3541 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Thu, 1 Sep 2011 12:00:22 -0300 Subject: [PATCH] gp2rml/gp2rml.c: allow unit of Z clearance (mm) to be specified explictly --- gp2rml/gp2rml.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gp2rml/gp2rml.c b/gp2rml/gp2rml.c index 0d93a5f..47f597b 100644 --- a/gp2rml/gp2rml.c +++ b/gp2rml/gp2rml.c @@ -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 #include +#include #include @@ -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); }