Commit b2d50f23 authored by Guillaume Seguin's avatar Guillaume Seguin

Heavily speedup print speed of exluded parts (#266)

This is achieved by reworking the logic to look at next move:
if we know the next move will set absolute E if needed, we don't need
to do it for this line. We can thus skip this G-code.
parent c8ed2fb3
...@@ -472,7 +472,12 @@ class printcore(): ...@@ -472,7 +472,12 @@ class printcore():
try: self.layerchangecb(layer) try: self.layerchangecb(layer)
except: traceback.print_exc() except: traceback.print_exc()
if self.preprintsendcb: if self.preprintsendcb:
gline = self.preprintsendcb(gline) if self.queueindex + 1 < len(self.mainqueue):
(next_layer, next_line) = self.mainqueue.idxs(self.queueindex + 1)
next_gline = self.mainqueue.all_layers[next_layer][next_line]
else:
next_gline = None
gline = self.preprintsendcb(gline, next_gline)
if gline == None: if gline == None:
self.queueindex += 1 self.queueindex += 1
self.clear = True self.clear = True
......
...@@ -417,14 +417,18 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -417,14 +417,18 @@ class PronterWindow(MainWindow, pronsole.pronsole):
return True return True
return False return False
def preprintsendcb(self, gline): def preprintsendcb(self, gline, next_gline):
if self.is_excluded_move(gline): if not self.is_excluded_move(gline):
return gline
else:
# Check if next move will be excluded too and if it will emit an absolute E set
if self.is_excluded_move(next_gline) and next_gline.e != None and not next_gline.relative_e:
return None # nothing to do: next move will set absolute E if needed
else: # else, check if this is an extrusion move with non relative E and replace it
if gline.e != None and not gline.relative_e: if gline.e != None and not gline.relative_e:
return gcoder.Line("G92 E%.5f" % gline.e) return gcoder.Line("G92 E%.5f" % gline.e)
else: else: # or just do nothing
return None return None
else:
return gline
def printsentcb(self, gline): def printsentcb(self, gline):
if gline.is_move and hasattr(self.gwindow, "set_current_gline"): if gline.is_move and hasattr(self.gwindow, "set_current_gline"):
......
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