mirror of
https://github.com/sinseman44/PyCNC.git
synced 2026-04-20 18:48:11 +00:00
simplyfy ijk handling
This commit is contained in:
13
cnc/gcode.py
13
cnc/gcode.py
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user