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:
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:
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.