Commit 38f0bece authored by paulusmax's avatar paulusmax

fix styling, make first Gcode command happen always, make rapid moves also...

fix styling, make first Gcode command happen always, make rapid moves also obey minimum step distance

git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@937 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 0b2f2d6d
...@@ -105,26 +105,22 @@ class GCodeGenerator: ...@@ -105,26 +105,22 @@ class GCodeGenerator:
self.append(self.gcode.delay(2)) self.append(self.gcode.delay(2))
# At minimum this will stop the duplicate gcode # At minimum this will stop the duplicate gcode
# And this is a place holder for when the GUI is linked # And this is a place holder for when the GUI is linked
ResLimitX = self._minimum_step res_limit_x = self._minimum_step
ResLimitY = self._minimum_step res_limit_y = self._minimum_step
ResLimitZ = self._minimum_step res_limit_z = self._minimum_step
OldPosition = None old_position = None
for pos, rapid in moves: for pos, rapid in moves:
if OldPosition == None: new_position = pos
OldPosition = pos # make sure we arent putting out values with no motion
NewPosition = pos if old_position is None \
or abs(new_position.x - old_position.x) >= res_limit_x \
or abs(new_position.y - old_position.y) >= res_limit_y \
or abs(new_position.z - old_position.z) >= res_limit_z:
if rapid: if rapid:
self.append(self.gcode.rapid(pos.x, pos.y, pos.z)) self.append(self.gcode.rapid(pos.x, pos.y, pos.z))
else: else:
# make sure we arent putting out values with no motion
if NewPosition.x - OldPosition.x >= ResLimitX \
or NewPosition.x - OldPosition.x <= -ResLimitX \
or NewPosition.y - OldPosition.y >= ResLimitY \
or NewPosition.y - OldPosition.y <= -ResLimitY \
or NewPosition.z - OldPosition.z >= ResLimitZ \
or NewPosition.z - OldPosition.z <= -ResLimitZ:
self.append(self.gcode.cut(pos.x, pos.y, pos.z)) self.append(self.gcode.cut(pos.x, pos.y, pos.z))
OldPosition = pos old_position = pos
# go back to safety height # go back to safety height
self.append(self.gcode.safety()) self.append(self.gcode.safety())
if self.toggle_spindle_status: if self.toggle_spindle_status:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment