It looks like the issue is with only creating polylines when there are all three coordinates on a line of G-code. This is the problem:
if X != None and Y != None and Z != None:
Some of the lines only have one or two values:
N11 X9.080Z92.687
N12 X9.906Z92.421
N13 X10.731Z92.031
N14 X11.144Z91.781
N15 X11.557Z91.489
N16 X11.969Z91.147
N17 X12.382Z90.745
N18 X12.795Z90.264
N19 X13.208Z89.691
N20 X14.033Z88.514
N21 X14.858Z87.370
N22 X15.684Z86.264
N23 X16.509Z85.203
N24 X17.335Z84.164
N25 X18.986Z82.201
N26 X20.637Z80.360
In these cases, which in the 1001.cnc example are most of the lines, they are being skipped.
What I need to figure out (if possible) is how to rebuild each list to contain an x, y, and z value even if they are not present in each line. In the Rhinoscript version, the above code creates an array which contains the previous values if absent on the newest line:
9.080,0.005,92.687
9.906,0.005,92.421
10.731,0.005,92.031
11.144,0.005,91.781
11.557,0.005,91.489
11.969,0.005,91.147
12.382,0.005,90.745
12.795,0.005,90.264
13.208,0.005,89.691
14.033,0.005,88.514
14.858,0.005,87.370
15.684,0.005,86.264
16.509,0.005,85.203
17.335,0.005,84.164
18.986,0.005,82.201
20.637,0.005,80.360
I think if I can get this part figured out I will have this solved. I’m not even sure if that is realistic with Python, but, from what I’ve seen so far, there is probably a way to do it.
Dan