simplyfy ijk handling

This commit is contained in:
Nikolay Khabarov
2017-05-21 18:50:07 +03:00
parent 3dde415ab6
commit ff373809b1
2 changed files with 7 additions and 42 deletions

View File

@@ -52,9 +52,8 @@ class GCode(object):
"""
return 'X' in self.params or 'Y' in self.params or 'Z' in self.params
def radius(self, plane, default, multiply):
def radius(self, default, multiply):
""" Get radius for circular interpolation(I, J, K or R).
:param plane: If R is present, specify which axises should be used.
:param default: Default values, if any of coords is not specified.
:param multiply: If value exist, multiply it by this value.
:return: Coord object.
@@ -62,14 +61,6 @@ class GCode(object):
i = self.get('I', default.x, multiply)
j = self.get('J', default.y, multiply)
k = self.get('K', default.z, multiply)
if 'R' in self.params:
r1 = self.get('R', None, multiply) / math.sqrt(2.0)
if plane == Plane.PLANE_XY:
i = j = r1
elif plane == Plane.PLANE_ZX:
k = i = r1
elif plane == Plane.PLANE_YZ:
j = k = r1
return Coordinates(i, j, k)
def command(self):
@@ -104,6 +95,4 @@ class GCode(object):
raise GCodeException('duplicated gcode entries')
if 'G' in params and 'M' in params:
raise GCodeException('g and m command found')
if 'R' in params and ('I' in params or 'J' in params or 'K' in params):
raise GCodeException('r and component radius found')
return GCode(params)