Commit 1395a013 authored by Guillaume Seguin's avatar Guillaume Seguin

Revert "Correctly handle G92 in hosts" as argued in #443

This reverts commit 1877d2cc.

Conflicts:
	printrun/gcoder.py
parent dc010932
......@@ -96,8 +96,7 @@ class Layer(list):
self.z = z
def _preprocess(self, current_x, current_y, current_z,
offset_x, offset_y, offset_z,
ignore_noe = False, host_mode = True):
offset_x, offset_y, offset_z, ignore_noe = False):
xmin = float("inf")
ymin = float("inf")
zmin = 0
......@@ -146,14 +145,9 @@ class Layer(list):
if line.z is not None: current_z = 0
elif line.command == "G92":
if host_mode:
current_x = line.x or current_x
current_y = line.y or current_y
current_z = line.z or current_z
else:
if line.x is not None: offset_x = current_x - line.x
if line.y is not None: offset_y = current_y - line.y
if line.z is not None: offset_z = current_z - line.z
if line.x is not None: offset_x = current_x - line.x
if line.y is not None: offset_y = current_y - line.y
if line.z is not None: offset_z = current_z - line.z
line.current_x = current_x
line.current_y = current_y
......@@ -190,14 +184,14 @@ class GCode(object):
est_layer_height = None
def __init__(self, data, host_mode = True):
def __init__(self, data):
self.lines = [Line(l2) for l2 in
(l.strip() for l in data)
if l2]
self._preprocess_lines()
self.filament_length = self._preprocess_extrusion()
self._create_layers()
self._preprocess_layers(host_mode = host_mode)
self._preprocess_layers()
def __len__(self):
return len(self.line_idxs)
......@@ -374,7 +368,7 @@ class GCode(object):
def num_layers(self):
return len(self.layers)
def _preprocess_layers(self, host_mode = True):
def _preprocess_layers(self):
xmin = float("inf")
ymin = float("inf")
zmin = 0
......@@ -394,7 +388,7 @@ class GCode(object):
for l in self.all_layers:
meta = l._preprocess(current_x, current_y, current_z,
offset_x, offset_y, offset_z,
ignore_noe, host_mode)
ignore_noe)
current_x, current_y, current_z = meta[0]
offset_x, offset_y, offset_z = meta[1]
(xm, xM), (ym, yM), (zm, zM) = meta[2:]
......
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