hole->aperture = -hole->aperture;
for (i = 0; i < CVectorSize(group); i++) {
- double xy[2], dia;
+ double xy[2], dia, r;
CVectorGetElement(group, &hole, i);
tool = drill->aperture[abs(hole->aperture)];
xy[0] = hole->start_x; xy[1] = hole->start_y;
dia = tool->parameter[0];
+ /* Half a mil slop to decisively include points on boundary. */
+ r = dia/2 + 0.0005;
+
if (drill->aperture[biggest_tool]->parameter[0] < dia)
biggest_tool = abs(hole->aperture);
- if (CNearTreeFindInSphere(t, dia, 0, tmp, xy, 1) != 0) {
+ if (CNearTreeFindInSphere(t, r, 0, tmp, xy, 1) != 0) {
/* We should always should find at least one hole! */
fprintf(stderr, _("%s: fatal error searching holes\n"),
progname);
-# Copyright © 2018 Nick Bowler
+# Copyright © 2018, 2021 Nick Bowler
#
# 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
]])
AT_CLEANUP
+
+AT_SETUP([non-overlapping holes])
+
+AT_DATA([test.cnc],
+[[M48
+INCH
+T25C0.010
+T24C0.091
+%
+T25
+X010433Y001181
+T24
+X010512Y002362
+X010512Y002047
+M30
+]])
+
+AT_CHECK([slotifier test.cnc], [0],
+[[M48
+INCH,TZ
+T10C0.091
+T11C0.010
+%
+T10
+X010512Y002362G85X010512Y002047
+T11
+X010433Y001181
+M30
+
+]])
+
+AT_CLEANUP