1. iorodeo
  2. py2gcode

Commits

iorodeo  committed f428b74

Reworked cnc path generation - greatly simplified bi and uni direction raster path generation.

  • Participants
  • Parent commits 6db1713
  • Branches default

Comments (0)

Files changed (1)

File py2gcode/cnc_path.py

View file
  • Ignore whitespace
 import math
 from gcode_cmds import *
 
+PLANE_COORD = { 
+        'xy': ('x','y'), 
+        'xz': ('x','z'), 
+        'yz': ('y','z'), 
+        } 
+
+PLANE_NORM_COORD = {'xy': 'z', 'xz': 'y', 'yz': 'x'}
+
+
 class GenericStart(GCodeProg):
 
     """
             self.add(FeedRate(feedrate),comment=comment)
 
 
-class LinearFeedPath(GCodeProg):
-
-    """
-    Base class for gcode programs consisting of a sequence of LinearFeeds.
-    """
+class BaseFeedPath(GCodeProg):
 
     def __init__(self):
-        super(LinearFeedPath,self).__init__()
+        super(BaseFeedPath,self).__init__()
 
     @property
     def pointList(self):
     def startPoint(self):
         return self.pointList[0]
 
-    @property
+    @property 
     def listOfCmds(self):
-        listOfCmds = []
-        for point in self.pointList:
-            if isinstance(point,dict):
-                if 'type' in point:
-                    motionType = point['type']
-                    del point['type']
-                    if not motionType in ('linearFeed','rapidMotion'):
-                        raise ValueError, 'unknown motion type {0}'.format(motionType)
-                else:
-                    motionType = 'linearFeed'
-                if motionType == 'linearFeed':
-                    listOfCmds.append(LinearFeed(**point))
-                else:
-                    listOfCmds.append(RapidMotion(**point))
-            else:
-                listOfCmds.append(LinearFeed(*point))
-        return listOfCmds
+        return []
 
     @listOfCmds.setter
     def listOfCmds(self,value):
         pass
 
 
-class RectPathXY(LinearFeedPath):
+class LinearFeedPath(BaseFeedPath):
+
     """
-    Rectangular path  in xy plane made of LinearFeeds which is defined by
-    points 'point0' and 'point1'. Note, prior to rectangle tool is moved from
+    Base class for gcode programs consisting of a sequence of LinearFeeds.
+    """
+
+    def __init__(self):
+        super(LinearFeedPath,self).__init__()
+
+    @property
+    def listOfCmds(self):
+        listOfCmds = []
+        for point in self.pointList: 
+            if 'type' in point:
+                motionType = point['type']
+                del point['type']
+                if not motionType in ('linearFeed','rapidMotion'):
+                    raise ValueError, 'unknown motion type {0}'.format(motionType)
+            else:
+                motionType = 'linearFeed'
+            if motionType == 'linearFeed':
+                listOfCmds.append(LinearFeed(**point))
+            else:
+                listOfCmds.append(RapidMotion(**point))
+        return listOfCmds
+
+
+class HelicalFeedPath(BaseFeedPath):
+
+    def __init__(self):
+        super(HelicalFeedPath,self).__init__()
+
+    @property
+    def listOfcmds(self):
+        listOfCmds = []
+        for poitn in self.pointList:
+            pass
+
+class GeneralFeedPath(BaseFeedPath):
+
+    def __init__(self):
+        super(GeneralFeedPath,self).__init__()
+
+    @property
+    def listOfCmds(self):
+        listOfCmds = []
+        for point in self.pointList:
+            pass
+
+class RectPath(LinearFeedPath):
+    """
+    Rectangular path made of LinearFeeds which is defined by points 'point0',
+    point1' and the selected plane. Note, prior to rectangle tool is moved from
     current position to start point p via a LinearFeed.  There is no move to
     safe height etc.
 
     Note, point0 is the start and end point of the path.
     """
 
-    def __init__(self, point0, point1):
-        super(RectPathXY,self).__init__()
+    def __init__(self, point0, point1, plane='xy'):
+        super(RectPath,self).__init__()
+        checkPlane(plane)
         self.point0 = point0
         self.point1 = point1
+        self.plane = plane
 
     @property
     def pointList(self):
         x0, y0 = self.point0
         x1, y1 = self.point1 
         pointList = [(x0,y0), (x0,y1), (x1,y1), (x1,y0), (x0,y0)]
+        kx, ky = PLANE_COORD[self.plane]
+        pointList = [{kx: x, ky: y} for x,y in pointList]
         return pointList
 
 
-class RectWithCornerCutPathXY(LinearFeedPath):
+class RectWithCornerCutPath(LinearFeedPath):
 
     """
-    Rectangular path in xy plane with radial corner  cuts.
+    Rectangular path in specified plane  with radial corner  cuts.
 
     Note, point0 is the start and end point of the path.
     """
     defaultCornerCutDict = {'00':True, '01':True, '11':True, '10':True}
     numToCornerStr = {1:'01', 2:'11',3:'10',4:'00'}
 
-    def __init__(self,point0,point1,cornerCutLen,cornerCutDict=defaultCornerCutDict):
+    def __init__(
+            self, 
+            point0,
+            point1,
+            cornerCutLen, 
+            cornerCutDict=defaultCornerCutDict,
+            plane='xy'
+            ):
+        super(RectWithCornerCutPath,self).__init__()
+        checkPlane(plane)
         self.point0 = point0
         self.point1 = point1
         self.cornerCutLen = cornerCutLen
         self.cornerCutDict = cornerCutDict
+        self.plane = plane
         for k in self.defaultCornerCutDict:
             if k not in self.cornerCutDict:
                 self.cornerCutDict[k] = False
 
     @property
     def pointList(self):
-        rectPath = RectPathXY(self.point0,self.point1)
+        rectPath = RectPath(self.point0,self.point1,plane=self.plane)
         x0, y0 = self.point0
         x1, y1 = self.point1
         xMid = 0.5*(x0 + x1)
         yMid = 0.5*(y0 + y1)
+        kx, ky = PLANE_COORD[self.plane]
 
         pointList = []
         for i, p in enumerate(rectPath.pointList):
             if i > 0:
                 cornerStr = self.numToCornerStr[i]
                 if self.cornerCutDict[cornerStr]:
-                    x,y = p
+                    x, y = p[kx], p[ky]
                     normConst = math.sqrt((x-xMid)**2 + (y-yMid)**2)
-                    #u = (x-xMid)/normConst
-                    #v = (y-yMid)/normConst
                     u = (x-xMid)/abs(x-xMid)
                     v = (y-yMid)/abs(y-yMid)
-                    xx = x + self.cornerCutLen*u/math.sqrt(2.0)
-                    yy = y + self.cornerCutLen*v/math.sqrt(2.0)
-                    pointList.extend([(xx,yy),(x,y)])
+                    xCut = x + self.cornerCutLen*u/math.sqrt(2.0)
+                    yCut = y + self.cornerCutLen*v/math.sqrt(2.0)
+                    pointList.extend([{kx: xCut, ky: yCut}, {kx: x, ky: y}])
         return pointList
 
 
-class FilledRectPathXY(LinearFeedPath): 
+class FilledRectPath(LinearFeedPath): 
 
     """ 
     Filled Rectangular path in xy plane made up of LinearFeeds. Path is defined
     steps to take.
     """
 
-    def __init__(self,point0,point1,step,number):
-        super(FilledRectPathXY,self).__init__()
+    def __init__(self,point0,point1,step,number,plane='xy'):
+        super(FilledRectPath,self).__init__()
+        checkFilledRectStep(point0,point1,step)
+        checkPlane(plane)
         self.point0 = point0
         self.point1 = point1
         self.step = abs(step)
         self.number = number
-        checkFilledRectStep(self.point0,self.point1,self.step)
+        self.plane = plane
 
     @property
     def pointList(self):
         x1, y1 = self.point1
         xMid = 0.5*(x0 + x1)
         yMid = 0.5*(y0 + y1)
+
         if x0 < x1:
             dx0 =  self.step
             dx1 = -self.step
         for i in range(self.number):
             p0 = (x0,y0)
             p1 = (x1,y1)
-            rectPath = RectPathXY(p0,p1)
+            rectPath = RectPath(p0,p1,plane=self.plane)
             pointList.extend(rectPath.pointList)
             x0 += dx0
             x1 += dx1
         return pointList
 
 
-class FilledRectWithCornerCutPathXY(LinearFeedPath):
+class FilledRectWithCornerCutPath(LinearFeedPath):
 
-    defaultCornerCutDict = RectWithCornerCutPathXY.defaultCornerCutDict
+    defaultCornerCutDict = RectWithCornerCutPath.defaultCornerCutDict
 
-    def __init__(self, point0, point1, step, number, cutLen, cornerCutDict=defaultCornerCutDict):
+    def __init__(
+            self, 
+            point0, 
+            point1, 
+            step, 
+            number, 
+            cutLen, 
+            cornerCutDict=defaultCornerCutDict, 
+            plane='xy'
+            ):
+
+        checkFilledRectStep(point0,point1,step);
+        checkPlane(plane)
         self.point0 = point0
         self.point1 = point1
         self.step = abs(step)
         self.number = number
         self.cutLen = cutLen
         self.cornerCutDict = cornerCutDict
+        self.plane = plane
 
     @property
     def pointList(self):
-        filledPath = FilledRectPathXY(
+        filledPath = FilledRectPath(
                 self.point0, 
                 self.point1,
                 self.step, 
-                self.number
+                self.number,
+                plane = self.plane,
                 )
-        cornerCutPath = RectWithCornerCutPathXY(
+        cornerCutPath = RectWithCornerCutPath(
                 self.point0, 
                 self.point1, 
                 self.cutLen,
-                self.cornerCutDict
+                cornerCutDict = self.cornerCutDict,
+                plane = self.plane,
                 )
         pointList = cornerCutPath.pointList + filledPath.pointList[5:]
         return pointList
 
 
-class BiDirRasterRectPathBase(LinearFeedPath):
+class BiDirRasterRectPath(LinearFeedPath):
 
-    """ 
-    Base class bi-directional for rastered rectangle paths.  
+    """
+    Generates a bi-direction rastered rectangle path. The rectangle is
+    specified via the adjacent corners (point0 and point1), the step between
+    raster rows, the plane of the raster and the direction of the raster.
     """
 
-    allowedDirections = ()
-
-    def __init__(self,point0,point1,step,direction=None):
+    def __init__(self,point0,point1,step,plane='xy',direction='x'):
+        super(BiDirRasterRectPath,self).__init__()
+        checkFilledRectStep(point0,point1,step)
+        checkPlane(plane)
+        checkDirection(direction,plane)
         self.point0 = point0
         self.point1 = point1
         self.step = abs(step)
-        if direction in self.allowedDirections:
-            self.direction = direction
-        else:
-            raise ValueError, 'uknown direction {0}'.format(direction)
-        checkFilledRectStep(self.point0,self.point1,self.step)
+        self.plane = plane
+        self.direction = direction
 
     @property
     def pointList(self):
-        return []
+        n = getCoordOrder(self.direction,self.plane)
+        pointList = getBiDirRasterRectPointList(
+                self.point0[::n],
+                self.point1[::n],
+                self.step,
+                keys = PLANE_COORD[self.plane][::n]
+                )
+        return pointList
 
 
-class BiDirRasterRectPathXY(BiDirRasterRectPathBase):
+class UniDirRasterRectPath(LinearFeedPath):
 
-    """
-    Bi-directional rastered rectangle  path in xy plane.
-    """
-
-    allowedDirections = 'x','y'
-
-    def __init__(self,point0,point1,step,direction='x'):
-        super(BiDirRasterRectPathXY,self).__init__(point0,point1,step,direction=direction)
+    def __init__(self,point0,point1,step,cutLevel,retLevel,plane='xy',direction='x'):
+        checkFilledRectStep(point0,point1,step)
+        checkPlane(plane)
+        checkDirection(direction,plane)
+        self.point0 = point0
+        self.point1 = point1
+        self.step = step
+        self.cutLevel = cutLevel
+        self.retLevel = retLevel
+        self.plane = plane
+        self.direction = direction
 
     @property
     def pointList(self):
-        if self.direction == 'x':
-            pointList = getBiDirRasterRectPointList(self.point0,self.point1,self.step)
-        else:
-            x0, y0 = self.point0
-            x1, y1 = self.point1
-            pointList =  getBiDirRasterRectPointList((y0,x0),(y1,x1),self.step)
-            pointList = [(x,y) for y,x in pointList]
+        n = getCoordOrder(self.direction,self.plane)
+        rasterKeys = PLANE_COORD[self.plane][::n] + (PLANE_NORM_COORD[self.plane],)
+        pointList = getUniDirRasterRectPath(
+                self.point0[::n],
+                self.point1[::n],
+                self.step,
+                self.cutLevel,
+                self.retLevel,
+                keys = rasterKeys
+                )
         return pointList
 
 
-class BiDirRasterRectPathXZ(BiDirRasterRectPathBase):
-
-    """
-    Bi-directional rastered rectangle raster path in xz plane.
-    """
-
-    allowedDirections = 'x', 'z'
-
-    def __init__(self,point0,point1,step,direction='x'):
-        super(BiDirRasterRectPathXZ,self).__init__(point0,point1,step,direction=direction)
-
-    @property
-    def pointList(self):
-        if self.direction == 'x':
-            pointList = getBiDirRasterRectPointList(self.point0,self.point1,self.step)
-            pointList = [(x,0,z) for x,z in pointList]
-        else:
-            x0, z0 = self.point0
-            x1, z1 = self.point1
-            pointList = getBiDirRasterRectPointList((z0,x0),(z1,x1),self.step)
-            pointList = [(x,0,z) for z,x in pointList]
-        return pointList
-
-class BiDirRasterRectPathYZ(BiDirRasterRectPathBase):
-
-    """
-    Bi-directional rastered rectangle path in yz plane.
-    """
-
-    allowedDirections = 'y', 'z'
-
-    def __init__(self,point0,point1,step,direction='y'):
-        super(BiDirRasterRectPathYZ,self).__init__(point0,point1,step,direction=direction)
-
-    @property
-    def pointList(self):
-        if self.direction == 'y':
-            pointList = getBiDirRasterRectPointList(self.point0,self.point1,self.step)
-            pointList = [(0,y,z) for y,z in pointList]
-        else:
-            y0, z0 = self.point0
-            y1, z1 = self.point1
-            pointList = getBiDirRasterRectPointList((z0,y0),(z1,y1),self.step)
-            pointList = [(0,y,z) for z,y in pointList]
-        return pointList
-
-
-class UniDirRasterRectPathBase(LinearFeedPath):
-
-    allowedDirections = ()
-
-    def __init__(self,point0,point1,step,direction=None):
-        super(UniDirRasterRectPathBase,self).__init__()
-        self.point0 = point0
-        self.point1 = point1
-        self.step = step
-        if direction in self.allowedDirections:
-            self.direction = direction
-        else:
-            raise ValueError, 'uknown direction {0}'.format(direction)
-        checkFilledRectStep(self.point0,self.point1,self.step)
-
-    @property
-    def pointList(self):
-        return []
-
-
-class UniDirRasterRectPathXY(UniDirRasterRectPathBase):
-
-    allowedDirections = ('x', 'y')
-
-    def __init__(self,point0,point1,step,cutZ,retZ,direction='x'):
-        super(UniDirRasterRectPathXY,self).__init__(point1,point1,step,direction=direction)
-        self.cutZ = cutZ
-        self.retZ = retZ
-
-    @property
-    def pointList(self):
-        if self.direction == 'x':
-            pointList = getUniDirRasterRectPath(
-                    self.point0,
-                    self.point1,
-                    self.step,
-                    self.cutZ,
-                    self.retZ
-                    )
-        else:
-            x0, y0 = self.point0
-            x1, y1 = self.point1
-            pointList = getUniDirRasterRectPath(
-                    (y0,x0),
-                    (y1,x1),
-                    self.step,
-                    self.cutZ,
-                    self.retZ,
-                    )
-            keySwapDict = {'x': 'y', 'y': 'x'}
-            pointList = [swapKeys(point,keySwapDict) for point in pointList]
-        return pointList
-
-
-class UniDirRasterRectPathXZ(UniDirRasterRectPathBase):
-
-    allowedDirections = ('x', 'z')
-
-    def __init__(self,point0,point1,step,cutY,retY,direction='x'):
-        super(UniDirRasterRectPathXZ,self).__init__(point0,point1,step,direction=direction)
-        self.cutY = cutY
-        self.retY = retY
-
-    @property
-    def pointList(self):
-        if self.direction == 'x':
-            pointList = getUniDirRasterRectPath(
-                    self.point0,
-                    self.point1,
-                    self.step,
-                    self.cutY,
-                    self.retY
-                    )
-            keySwapDict = {'y': 'z', 'z': 'y'}
-            pointList = [swapKeys(point,keySwapDict) for point in pointList]
-        else:
-            x0, y0 = self.point0
-            x1, y1 = self.point1
-            pointList = getUniDirRasterRectPath(
-                    (y0,x0),
-                    (y1,x1),
-                    self.step,
-                    self.cutY,
-                    self.retY,
-                    )
-            keySwapDict = {'x': 'z', 'y': 'x', 'z': 'y'}
-            pointList = [swapKeys(point,keySwapDict) for point in pointList]
-        return pointList
-
-
-class UniDirRasterRectPathYZ(UniDirRasterRectPathBase):
-
-    allowedDirections = ('y','z')
-
-    def __init__(self,point0,point1,step,cutX,retX,direction='y'):
-        super(UniDirRasterRectPathYZ,self).__init__(point0,point1,step,direction=direction)
-        self.cutX = cutX
-        self.retX = retX
-
-    @property
-    def pointList(self):
-        if self.direction == 'y':
-            pointList = getUniDirRasterRectPath(
-                    self.point0,
-                    self.point1,
-                    self.step,
-                    self.cutX,
-                    self.retX
-                    )
-            keySwapDict = {'x': 'y', 'z': 'x', 'y': 'z'}
-            pointList = [swapKeys(point,keySwapDict) for point in pointList]
-        else:
-            print('a')
-            x0, y0 = self.point0
-            x1, y1 = self.point1
-            pointList = getUniDirRasterRectPath(
-                    (y0,x0),
-                    (y1,x1),
-                    self.step,
-                    self.cutX,
-                    self.retX,
-                    )
-            keySwapDict = {'x': 'z', 'z': 'x'}
-            pointList = [swapKeys(point,keySwapDict) for point in pointList]
-        return pointList
-
 # -----------------------------------------------------------------------------
 
 def swapKeys(d,keySwapDict):
     xLen = abs(x1-x0)
     yLen = abs(y1-y0)
     if step > xLen or step > yLen:
-        raise ValueError, 'step size too small'
+        raise ValueError, 'step size too large'
 
 
-def getBiDirRasterRectPointList(point0,point1,step):
+def checkPlane(plane): 
+    """
+    check that plane is in list of allowed planes
+    """
+    if not plane in PLANE_COORD: 
+        raise ValueError, 'unknown plane {0}'.format(plane)
+
+def checkDirection(direction,plane):
+    """
+    Check that the direction is allowed given the plane
+    """
+    return direction in PLANE_COORD[plane] 
+
+def getCoordOrder(direction,plane):
+    """
+    Returns 1 for coordinate order given by PLANE_COORD[plane] tuple
+    and -1 for reverse order.
+    """
+    if direction == PLANE_COORD[plane][0]:
+        return 1
+    else:
+        return -1
+
+def getBiDirRasterRectPointList(point0,point1,step,keys=('x','y')):
     """
     Generates a bi-directional rastered rectangle  path defined by
     point0=(x0,y0) and point1=(x1,y1). The raster scan is in the direction of
             return x0
 
     # Generate raster
-    x,y = x0,y0
-    pointList.append((x,y))
+    x, y = x0, y0
+    kx, ky = keys
+    pointList.append({kx: x,ky: y})
     while 1:
         x = getAlternateX(x)
-        pointList.append((x,y))
+        pointList.append({kx: x,ky: y})
         if rasterDone(y):
             break
         y += dy
-        pointList.append((x,y))
+        pointList.append({kx: x,ky: y})
     if y != y1:
         y = y1
-        pointList.append((x,y))
+        pointList.append({kx: x,ky: y})
         x = getAlternateX(x)
-        pointList.append((x,y))
+        pointList.append({kx: x,ky: y})
     return pointList
 
 
-def getUniDirRasterRectPath(point0,point1,step,cutZ,retZ):
+def getUniDirRasterRectPath(point0,point1,step,cutZ,retZ,keys=('x','y','z')):
     """
     Generates a uni-directional rastered rectangle path.
 
 
     # Generate raster
     x, y = x0, y0
+    kx, ky, kz = keys
     isFirst = True
     isLast = False
-    pointList.append({'x': x, 'y': y, 'z': cutZ})  
+    pointList.append({kx: x, ky: y, kz: cutZ})  
     while 1:
         x = getAlternateX(x)
         if x==x0:
-            pointList.append({'z': retZ})
-            pointList.append({'x':x, 'y':y, 'type':'rapidMotion'})
+            pointList.append({kz: retZ})
+            pointList.append({kx:x, ky:y, 'type':'rapidMotion'})
         else:
-            pointList.append({'z': cutZ})
+            pointList.append({kz: cutZ})
             if isFirst:
                 isFirst = False
             else:
                 if outOfBounds(y):
                     y = y1
                     isLast = True
-                pointList.append({'y': y})
-            pointList.append({'x': x, 'y': y})
+                pointList.append({ky: y})
+            pointList.append({kx: x, ky: y})
         if isLast:
             break
     return pointList
     prog.add(Space())
 
     if 0:
+        p = 0,0
+        q = 1,2
+        prog.add(Comment('RectPath'))
+        prog.add(RectPath(p,q,plane='xy'))
+
+    if 0:
         p = ( 1.0,  1.0)
         q = (-1.0, -1.0)
         step = 0.1
         num = 8 
-        prog.add(Comment('FilledRectPathXY'))
-        prog.add(FilledRectPathXY(p,q,step,num))
+        prog.add(Comment('FilledRectPath'))
+        prog.add(FilledRectPath(p,q,step,num))
         prog.add(Space())
 
     if 0:
         p = (0,0)
         q = (4,5)
         cutLen = 0.5
-        prog.add(RectWithCornerCutPathXY(p,q,cutLen))
+        prog.add(RectWithCornerCutPath(p,q,cutLen,plane= 'xz'))
 
     if 0:
         p = (0,0)
         q = (4,5)
         cutLen = 0.5
         cornerCutDict = {'00':True,'11':True}
-        prog.add(RectWithCornerCutPathXY(p,q,cutLen,cornerCutDict=cornerCutDict))
+        prog.add(RectWithCornerCutPath(p,q,cutLen,cornerCutDict=cornerCutDict))
+
+    if 0: 
+        p = ( 1.0,  1.0)
+        q = (-1.0, -1.0)
+        step = 0.1
+        num = 5
+        cutLen = 0.25
+
+        prog.add(Comment('FilledRectWithCornerCutPath'))
+        prog.add(FilledRectWithCornerCutPath(p,q,step,num,cutLen,plane='xz'))
+        prog.add(Space())
 
     if 0:
         p = ( 1.0,  1.0)
         step = 0.1
         num = 5
         cutLen = 0.25
-
-        prog.add(Comment('FilledRectWithCornerCutPathXY'))
-        prog.add(FilledRectWithCornerCutPathXY(p,q,step,num,cutLen))
-        prog.add(Space())
-
-    if 1:
-        p = ( 1.0,  1.0)
-        q = (-1.0, -1.0)
-        step = 0.1
-        num = 5
-        cutLen = 0.25
         cornerCutDict = {'11':True}
 
-        prog.add(Comment('FilledRectWithCornerCutPathXY'))
-        prog.add(FilledRectWithCornerCutPathXY(p,q,step,num,cutLen,cornerCutDict=cornerCutDict))
+        prog.add(Comment('FilledRectWithCornerCutPath'))
+        path = FilledRectWithCornerCutPath(p,q,step,num,cutLen,cornerCutDict=cornerCutDict,plane=xy)
+        prog.add(path)
         prog.add(Space())
 
     if 0:
         p = -5.0, -1.5
         q =  5.0,  1.5
         step = 0.1
-        prog.add(Comment('BiDirRasterRectPathXY'))
-        prog.add(BiDirRasterRectPathXY(p,q,step,direction='x'))
+        prog.add(Comment('BiDirRasterRectPath'))
+        prog.add(BiDirRasterRectPath(p,q,step,plane='xy',direction='x'))
 
     if 0:
         p = -5.0, -1.5
         q =  5.0,  1.5
         step = 0.1
-        prog.add(Comment('BiDirRasterRectPathXY'))
-        prog.add(BiDirRasterRectPathXY(p,q,step,direction='x'))
+        prog.add(Comment('BiDirRasterRectPath'))
+        prog.add(BiDirRasterRectPath(p,q,step,plane='xy',direction='y'))
 
     if 0:
         p = 3, 1
         q = 0, 0
         step = 0.05
-        prog.add(Comment('BiDirRasterRectPathXZ'))
-        prog.add(BiDirRasterRectPathXZ(p,q,step,direction='x'))
+        prog.add(Comment('BiDirRasterRectPath'))
+        prog.add(BiDirRasterRectPath(p,q,step,plane='xz',direction='x'))
 
     if 0:
         p = 3, 1
         q = 0, 0
         step = 0.05
-        prog.add(Comment('BiDirRasterRectPathXZ'))
-        prog.add(BiDirRasterRectPathXZ(p,q,step,direction='z'))
+        prog.add(Comment('BiDirRasterRectPath'))
+        prog.add(BiDirRasterRectPath(p,q,step,plane='xz',direction='z'))
 
     if 0:
         p = 1.5, 1
         q = 0, 0
         step = 0.05
-        prog.add(Comment('BiDirRasterRectPathXZ'))
-        prog.add(BiDirRasterRectPathYZ(p,q,step,direction='y'))
+        prog.add(Comment('BiDirRasterRectPath'))
+        prog.add(BiDirRasterRectPath(p,q,step,plane='yz',direction='y'))
+
+    if 0:
+        p = 1.5, 1
+        q = 0, 0
+        step = 0.05
+        prog.add(Comment('BiDirRasterRectPath'))
+        prog.add(BiDirRasterRectPath(p,q,step,plane='yz',direction='z'))
 
     if 0:
         p = 0,0
         step = 0.05
         cutZ = -0.1 
         retZ =  0.1
-        prog.add(Comment('UniDirRasterRectPathXY'))
-        prog.add(UniDirRasterRectPathXY(p,q,step,cutZ,retZ,direction='x'))
+        prog.add(Comment('UniDirRasterRectPath'))
+        prog.add(UniDirRasterRectPath(p,q,step,cutZ,retZ,plane='xy',direction='x'))
 
     if 0:
         p = 0,0
         step = 0.05
         cutZ = -0.1 
         retZ =  0.1
-        prog.add(Comment('UniDirRasterRectPathXY'))
-        prog.add(UniDirRasterRectPathXY(p,q,step,cutZ,retZ,direction='y'))
+        prog.add(Comment('UniDirRasterRectPath'))
+        prog.add(UniDirRasterRectPath(p,q,step,cutZ,retZ,plane='xy',direction='y'))
 
     if 0:
         p = 0,0
         step = 0.05
         cutY = 0.1 
         retY = -0.1
-        prog.add(Comment('UniDirRasterRectPathXZ'))
-        prog.add(UniDirRasterRectPathXZ(p,q,step,cutY,retY,direction='x'))
+        prog.add(Comment('UniDirRasterRectPath'))
+        prog.add(UniDirRasterRectPath(p,q,step,cutY,retY,plane='xz',direction='x'))
 
     if 0:
         p = 0,0
         step = 0.05
         cutY = 0.1 
         retY = -0.1
-        prog.add(Comment('UniDirRasterRectPathXZ'))
-        prog.add(UniDirRasterRectPathXZ(p,q,step,cutY,retY,direction='z'))
+        prog.add(Comment('UniDirRasterRectPath'))
+        prog.add(UniDirRasterRectPath(p,q,step,cutY,retY,plane='xz',direction='z'))
 
     if 0:
         p = 2, 0
         step = 0.05
         cutY = 0.1 
         retY = -0.1
-        prog.add(Comment('UniDirRasterRectPathYZ'))
-        prog.add(UniDirRasterRectPathYZ(p,q,step,cutY,retY,direction='y'))
+        prog.add(Comment('UniDirRasterRectPath'))
+        prog.add(UniDirRasterRectPath(p,q,step,cutY,retY,plane='yz',direction='y'))
 
-    if 0:
+    if 1:
         p = 2, 0
         q = 0,-1
         step = 0.05
         cutY = 0.1 
         retY = -0.1
-        prog.add(Comment('UniDirRasterRectPathYZ'))
-        prog.add(UniDirRasterRectPathYZ(p,q,step,cutY,retY,direction='z'))
+        prog.add(Comment('UniDirRasterRectPath'))
+        prog.add(UniDirRasterRectPath(p,q,step,cutY,retY,plane='yz',direction='z'))
 
 
     prog.add(Space())