Commit 1dcf7be5 authored by Guillaume Seguin's avatar Guillaume Seguin

Start cleaning up gcode measurement code

parent f4a16223
...@@ -129,12 +129,12 @@ class Layer(object): ...@@ -129,12 +129,12 @@ class Layer(object):
def measure(self): def measure(self):
xmin = 999999999 xmin = float("inf")
ymin = 999999999 ymin = float("inf")
zmin = 0 zmin = 0
xmax = -999999999 xmax = float("-inf")
ymax = -999999999 ymax = float("-inf")
zmax = -999999999 zmax = float("-inf")
relative = False relative = False
relative_e = False relative_e = False
...@@ -272,29 +272,21 @@ class GCode(object): ...@@ -272,29 +272,21 @@ class GCode(object):
def measure(self): def measure(self):
xmin = 999999999 xmin = float("inf")
ymin = 999999999 ymin = float("inf")
zmin = 0 zmin = 0
xmax = -999999999 xmax = float("-inf")
ymax = -999999999 ymax = float("-inf")
zmax = -999999999 zmax = float("-inf")
for l in self.layers: for l in self.layers:
xd,yd,zd = l.measure() xd, yd, zd = l.measure()
if xd[0] < xmin: xmin = min(xd[0], xmin)
xmin = xd[0] xmax = max(xd[1], xmax)
if xd[1] > xmax: ymin = min(yd[0], ymin)
xmax = xd[1] ymax = max(yd[1], ymax)
zmin = min(zd[0], zmin)
if yd[0] < ymin: zmax = max(zd[1], zmax)
ymin = yd[0]
if yd[1] > ymax:
ymax = yd[1]
if zd[0] < zmin:
zmin = zd[0]
if zd[1] > zmax:
zmax = zd[1]
self.xmin = xmin self.xmin = xmin
self.xmax = xmax self.xmax = xmax
......
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