Skip to content

Commit

Permalink
Check for null drill_unit from gerbv.
Browse files Browse the repository at this point in the history
This can happen if there are no holes to drill.
This fixes #397
  • Loading branch information
eyal0 committed Jun 26, 2020
1 parent bbba928 commit 10f8e05
Show file tree
Hide file tree
Showing 16 changed files with 664 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ map<int, drillbit> ExcellonProcessor::parse_bits() {
currentDrill = currentDrill->next) {
drillbit curBit;
curBit.diameter = currentDrill->drill_size;
curBit.unit = string(currentDrill->drill_unit);
curBit.unit = currentDrill->drill_unit == nullptr ? "" : string(currentDrill->drill_unit);
curBit.drill_count = currentDrill->drill_count;

bits.insert(pair<int, drillbit>(currentDrill->drill_num, curBit));
Expand Down
1 change: 1 addition & 0 deletions integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"multivibrator_xy_offset",
"multivibrator_xy_offset_zero_start",
"multi_outline",
"null_drill",
"overlapping_edge_cuts",
"round_pcb_3",
"round_pcb_4",
Expand Down
14 changes: 14 additions & 0 deletions testing/gerbv_example/null_drill/expected/contentions_front.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
184 changes: 184 additions & 0 deletions testing/gerbv_example/null_drill/expected/front.ngc
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
( pcb2gcode 2.1.0 )
( Software-independent Gcode )

G94 ( Inches per minute feed rate. )
G20 ( Units == INCHES. )

G90 ( Absolute coordinates. )
G00 S800 ( RPM spindle speed. )
G01 F11.81102 ( Feedrate. )


G00 Z0.78740 (Retract to tool change height)
T0
M5 (Spindle stop.)
G04 P1.00000 (Wait for spindle to stop)
(MSG, Change tool bit to mill diameter 0.02362in)
M6 (Tool change.)
M0 (Temporary machine stop.)
M3 ( Spindle on clockwise. )
G04 P1.00000 (Wait for spindle to get up to speed)
G04 P0 ( dwell for no time -- G64 should not smooth over this point )
G00 Z0.03937 ( retract )

G00 X0.81279 Y-0.60413 ( rapid move to begin. )
G01 F5.90551
( Mill infeed pass 1/1 )
G01 Z-0.01024
G04 P0 ( dwell for no time -- G64 should not smooth over this point )
G01 F11.81102
G01 X0.81279 Y-0.60413
G01 X0.81136 Y-0.60834
G01 X0.80792 Y-0.61443
G01 X0.80647 Y-0.61642
G01 X0.80174 Y-0.62158
G01 X0.79612 Y-0.62574
G01 X0.79398 Y-0.62698
G01 X0.78756 Y-0.62977
G01 X0.77951 Y-0.63148
G01 X0.77128 Y-0.63148
G01 X0.76323 Y-0.62977
G01 X0.75571 Y-0.62642
G01 X0.75202 Y-0.62382
G01 X0.66713 Y-0.62382
G01 X0.66713 Y-0.65531
G01 X0.66690 Y-0.65762
G01 X0.66623 Y-0.65983
G01 X0.66514 Y-0.66188
G01 X0.66367 Y-0.66367
G01 X0.66188 Y-0.66514
G01 X0.65983 Y-0.66623
G01 X0.65762 Y-0.66690
G01 X0.65531 Y-0.66713
G01 X0.58839 Y-0.66713
G01 X0.58608 Y-0.66690
G01 X0.58386 Y-0.66623
G01 X0.58182 Y-0.66514
G01 X0.58003 Y-0.66367
G01 X0.57856 Y-0.66188
G01 X0.57747 Y-0.65983
G01 X0.57680 Y-0.65762
G01 X0.57657 Y-0.65531
G01 X0.57657 Y-0.58839
G01 X0.57675 Y-0.58633
G01 X0.57729 Y-0.58435
G01 X0.57816 Y-0.58248
G01 X0.57934 Y-0.58079
G01 X0.58079 Y-0.57934
G01 X0.58248 Y-0.57816
G01 X0.58435 Y-0.57729
G01 X0.58633 Y-0.57675
G01 X0.58839 Y-0.57657
G01 X0.62419 Y-0.57657
G01 X0.62588 Y-0.57389
G01 X0.62911 Y-0.57005
G01 X0.63388 Y-0.56613
G01 X0.63828 Y-0.56372
G01 X0.64041 Y-0.56283
G01 X0.64411 Y-0.56171
G01 X0.64638 Y-0.56126
G01 X0.65138 Y-0.56083
G01 X0.75202 Y-0.56083
G01 X0.75467 Y-0.55890
G01 X0.75681 Y-0.55767
G01 X0.76207 Y-0.55532
G01 X0.76442 Y-0.55456
G01 X0.77128 Y-0.55317
G01 X0.77827 Y-0.55310
G01 X0.78073 Y-0.55336
G01 X0.78756 Y-0.55488
G01 X0.79508 Y-0.55823
G01 X0.80174 Y-0.56307
G01 X0.80647 Y-0.56822
G01 X0.80792 Y-0.57022
G01 X0.81136 Y-0.57631
G01 X0.81279 Y-0.58052
G01 X0.81279 Y-0.60413
G01 X0.81423 Y-0.60834
G01 X0.81767 Y-0.61443
G01 X0.81870 Y-0.61590
G01 X0.81870 Y-0.68676
G01 X0.81510 Y-0.69035
G01 X0.65417 Y-0.69035
G01 X0.65214 Y-0.68820
G01 X0.65118 Y-0.68743
G01 X0.64449 Y-0.68264
G01 X0.63699 Y-0.67923
G01 X0.63465 Y-0.67847
G01 X0.62780 Y-0.67702
G01 X0.62535 Y-0.67676
G01 X0.61712 Y-0.67682
G01 X0.60905 Y-0.67847
G01 X0.60671 Y-0.67923
G01 X0.59921 Y-0.68264
G01 X0.59156 Y-0.68820
G01 X0.58522 Y-0.69524
G01 X0.58105 Y-0.70233
G01 X0.58005 Y-0.70459
G01 X0.57788 Y-0.71124
G01 X0.57737 Y-0.71366
G01 X0.57657 Y-0.72185
G01 X0.57737 Y-0.73004
G01 X0.57788 Y-0.73246
G01 X0.58049 Y-0.74026
G01 X0.58455 Y-0.74743
G01 X0.58600 Y-0.74942
G01 X0.59156 Y-0.75550
G01 X0.59921 Y-0.76106
G01 X0.60786 Y-0.76491
G01 X0.61590 Y-0.76668
G01 X0.61835 Y-0.76694
G01 X0.62658 Y-0.76688
G01 X0.63584 Y-0.76491
G01 X0.64449 Y-0.76106
G01 X0.65118 Y-0.75627
G01 X0.65214 Y-0.75550
G01 X0.65417 Y-0.75335
G01 X0.82815 Y-0.75335
G01 X0.83315 Y-0.75291
G01 X0.83542 Y-0.75246
G01 X0.83911 Y-0.75134
G01 X0.84125 Y-0.75045
G01 X0.84565 Y-0.74804
G01 X0.85042 Y-0.74412
G01 X0.87325 Y-0.72122
G01 X0.87569 Y-0.71823
G01 X0.87698 Y-0.71631
G01 X0.87880 Y-0.71290
G01 X0.87969 Y-0.71076
G01 X0.88080 Y-0.70707
G01 X0.88126 Y-0.70480
G01 X0.88169 Y-0.69980
G01 X0.88169 Y-0.61590
G01 X0.88272 Y-0.61443
G01 X0.88616 Y-0.60834
G01 X0.88871 Y-0.60051
G01 X0.88957 Y-0.59232
G01 X0.88871 Y-0.58414
G01 X0.88616 Y-0.57631
G01 X0.88272 Y-0.57022
G01 X0.88127 Y-0.56822
G01 X0.87654 Y-0.56307
G01 X0.86988 Y-0.55823
G01 X0.86352 Y-0.55532
G01 X0.86117 Y-0.55456
G01 X0.85553 Y-0.55336
G01 X0.85308 Y-0.55310
G01 X0.84608 Y-0.55317
G01 X0.83922 Y-0.55456
G01 X0.83688 Y-0.55532
G01 X0.83161 Y-0.55767
G01 X0.82947 Y-0.55890
G01 X0.82385 Y-0.56307
G01 X0.81834 Y-0.56918
G01 X0.81423 Y-0.57631
G01 X0.81279 Y-0.58052

G04 P0 ( dwell for no time -- G64 should not smooth over this point )
G00 Z0.787402 ( retract )

M5 ( Spindle off. )
G04 P1.000000
M9 ( Coolant off. )
M2 ( Program end. )

0 comments on commit 10f8e05

Please sign in to comment.