Permalink
Browse files

Rearanged the code to fix the "Processing Comments" bug.

The script will now check that the current command is not a machine-generated comment BEFORE deciding what to do.
  • Loading branch information...
1 parent ca114e3 commit 291bd25a329742853a5af9e1dfc04f2e6f95434d @Winter-Guerra committed Feb 20, 2012
Showing with 20 additions and 18 deletions.
  1. +20 −18 io_import_gcode.py
View
@@ -485,27 +485,28 @@ def process(self):
tmp = i.split()
command = tmp[0][0]
com_type = tmp[0][1:]
+
if command in codes:
if com_type in codes[command]:
- print('good com =>'+command+com_type)
-
- for j in tmp[1:]:
- axis = j[0]
- if axis == ';':
- # ignore comments
- break
- if axis in self.axes:
- val = float(j[1:])
- pos[axis] = val
- if self.cur['Z'] != pos['Z']:
- self.commands.append(layer())
- self.commands.append(tool_off(pos))
- self.cur[axis] = val
- # create action object
- #print(pos)
-
if (command != '('):
#We have a GCode (Not a skeinforge command)
+ #Run the usual checks
+ print('good com =>'+command+com_type)
+
+ for j in tmp[1:]:
+ axis = j[0]
+ if axis == ';':
+ # ignore comments
+ break
+ if axis in self.axes:
+ val = float(j[1:])
+ pos[axis] = val
+ if self.cur['Z'] != pos['Z']:
+ self.commands.append(layer())
+ self.commands.append(tool_off(pos))
+ self.cur[axis] = val
+ # create action object
+ #print(pos)
if com_type == '101':
machine.extruder = True
print('Extruder ON')
@@ -524,8 +525,9 @@ def process(self):
self.commands.append(act)
else:
#We have a skeinforge command
+ #Run the skeinforge command
+ print('Good Skeinforge com => '+command+com_type)
codes [command] [com_type] (tmp[1])
-
else:
print(i)
print(' G/M/T Code for this line is unknowm ' + com_type)

0 comments on commit 291bd25

Please sign in to comment.