def _getInstructions(self, sequence):
     params = self.getParams()
     bit_diameter = params['bit_diameter']
     current_side_X = params['side_X']
     current_side_Y = params['side_Y']
     step_increment = bit_diameter - self.getOverlap()
     child = self.child_features[RectangularGroove]
     file_text = addDebugFrame(inspect.currentframe())
     # do the full size outline first
     file_text += child.getGCode()
     while current_side_X >= (2 * bit_diameter) and current_side_Y >= (
             2 * bit_diameter):
         starting_side_X = current_side_X
         starting_side_Y = current_side_Y
         current_side_X = max(current_side_X - (2 * step_increment),
                              2 * step_increment)
         current_side_Y = max(current_side_Y - (2 * step_increment),
                              2 * step_increment)
         file_text += self.machine.setMode('INCR')
         file_text += G.G1_XY(((starting_side_X - current_side_X) / 2,
                               (starting_side_Y - current_side_Y) / 2))
         self.setUpRectangularGroove(current_side_X, current_side_Y)
         file_text += child.getGCode()
         file_text += addDebugFrame(inspect.currentframe())
     if sequence not in ['last', 'only']:
         # returns to center of pocket, for
         file_text += self.returnToHome()
         file_text += self.moveToStart()
     return file_text
Ejemplo n.º 2
0
 def getGCode(self):
     file_text = addDebugFrame(inspect.currentframe())
     params = self.getParams()
     file_text += self.machine.moveToSafeZ()
     file_text += self.moveToReference()
     file_text += addDebugFrame(inspect.currentframe())
     file_text += self.machine.setMode('ABS')
     file_text += G.G0_Z(params['stock_height'])
     file_text += self.machine.setMode('INCR')
     file_text += G.G1_Z(-params['cut_depth'])
     file_text += G.set_dwell(0.5)
     file_text += self.machine.moveToSafeZ()
     file_text += self.returnFromReference()
     return file_text
 def returnToHome(self):
     """Where does it finish ?"""
     side_X, side_Y, corner_radius = self.getGrooveAdjustments()
     file_text = addDebugFrame(inspect.currentframe())
     file_text += self.machine.setMode('INCR')
     file_text += G.G0_XY((side_X / 2, -corner_radius + (side_Y / 2)))
     return file_text
 def moveToStart(self):
     """Where does it start ?"""
     side_X, side_Y, corner_radius = self.getGrooveAdjustments()
     file_text = addDebugFrame(inspect.currentframe())
     file_text += self.machine.setMode('INCR')
     file_text += G.G0_XY((-side_X / 2, corner_radius - (side_Y / 2)))
     return file_text
Ejemplo n.º 5
0
 def returnToHome(self):
     """Reference position is the center, return from corner."""
     side_X, side_Y = self.getGrooveAdjustments()
     file_text = addDebugFrame(inspect.currentframe())
     file_text += self.machine.setMode('INCR')
     file_text += G.G0_XY((side_X / 2, side_Y / 2))
     return file_text
 def returnFromReference(self):
     """Core interface."""
     file_text = addDebugFrame(inspect.currentframe())
     ref_X = self.option_queries[ReferenceXQuery].getValue()
     ref_Y = self.option_queries[ReferenceYQuery].getValue()
     file_text += self.returnToHome()
     file_text += self.machine.setMode('INCR')
     file_text += G.G0_XY((-ref_X, -ref_Y))
     return file_text
    def getGCode(self, instruction_callback, to_start_callback,
                 return_callback):
        file_text = addDebugFrame(inspect.currentframe())
        basic_params, cut_per_pass, cut_depth = self.getParams()
        stock_height = basic_params['stock_height']
        target_depth = stock_height - cut_depth
        multipass = cut_depth > cut_per_pass
        sequence = 'first'
        # pre-amble
        # Z-axis move to starting point from Z-safe
        file_text += self.machine.moveToSafeZ()
        file_text += to_start_callback()
        file_text += addDebugFrame(inspect.currentframe())
        file_text += self.machine.setMode('ABS')
        file_text += G.G0_Z(stock_height)

        if multipass:
            while stock_height > target_depth:
                stock_height -= cut_per_pass
                if stock_height <= target_depth:
                    stock_height = target_depth
                    sequence = 'last'
                # Z-axis move
                file_text += self.machine.setMode('ABS')
                file_text += G.G1_Z(stock_height)
                file_text += G.set_dwell(0.5)
                file_text += G.comment('# ' + sequence)
                file_text += instruction_callback(sequence)
                file_text += addDebugFrame(inspect.currentframe())
                sequence = 'next'
        else:
            sequence = 'only'
            file_text += G.G1_Z(target_depth)
            file_text += G.set_dwell(0.5)
            file_text += instruction_callback(sequence)
            file_text += addDebugFrame(inspect.currentframe())

        # post-amble
        file_text += self.machine.moveToSafeZ()
        file_text += return_callback()
        file_text += addDebugFrame(inspect.currentframe())
        file_text += self.machine.setMode('ABS')

        return file_text
Ejemplo n.º 8
0
 def _getInstructions(self, sequence):
     """Climb cutting ?"""
     side_X, side_Y = self.getGrooveAdjustments()
     file_text = addDebugFrame(inspect.currentframe())
     file_text += self.machine.setMode('INCR')
     file_text += G.G1_XY((0, side_Y))
     file_text += G.G1_XY((side_X, 0))
     file_text += G.G1_XY((0, - side_Y))
     file_text += G.G1_XY((- side_X, 0))
     return file_text
Ejemplo n.º 9
0
 def _getInstructions(self, sequence):
     file_text = addDebugFrame(inspect.currentframe())
     params = self.getParams()
     diameter = params['diameter']
     current_od = params['bit_diameter']
     od_feature = self.child_features[CircularGroove]
     while current_od < diameter:
         # increase current_od
         starting_od = current_od
         current_od = min(
             current_od + (2 * (params['bit_diameter'] - self.getOverlap())),
             diameter
         )
         file_text += self.machine.setMode('INCR')
         file_text += G.G1_XY((- (current_od - starting_od) / 2, 0))
         self.setUpCircularGroove(current_od)
         file_text += od_feature.getGCode()
         file_text += addDebugFrame(inspect.currentframe())
     if sequence not in ['last', 'only']:
         # returns to center of pocket
         file_text += od_feature.returnToHome()
     return file_text
 def _getInstructions(self, sequence):
     """CW direction ATM"""
     side_X, side_Y, corner_radius = self.getGrooveAdjustments()
     file_text = addDebugFrame(inspect.currentframe())
     file_text += self.machine.setMode('INCR')
     file_text += G.G1_XY((0, side_Y - (2 * corner_radius)))
     file_text += G.G2XY((corner_radius, corner_radius), (corner_radius, 0))
     file_text += G.G1_XY((side_X - (2 * corner_radius), 0))
     file_text += G.G2XY((corner_radius, -corner_radius),
                         (0, -corner_radius))
     file_text += G.G1_XY((0, -side_Y + (2 * corner_radius)))
     file_text += G.G2XY((-corner_radius, -corner_radius),
                         (-corner_radius, 0))
     file_text += G.G1_XY((-side_X + (2 * corner_radius), 0))
     file_text += G.G2XY((-corner_radius, corner_radius),
                         (0, corner_radius))
     return file_text
 def returnToHome(self):
     """Called on the conclusion of each depth step, except for the last."""
     file_text = addDebugFrame(inspect.currentframe())
     file_text += self.child_features[RectangularGroove].returnToHome()
     return file_text
 def moveToStart(self):
     file_text = addDebugFrame(inspect.currentframe())
     params = self.getParams()
     self.setUpRectangularGroove(params['side_X'], params['side_Y'])
     file_text += self.child_features[RectangularGroove].moveToStart()
     return file_text
Ejemplo n.º 13
0
 def returnToHome(self):
     """Called after the last depth step in the pocket has been cut."""
     od_feature = self.child_features[CircularGroove]
     file_text = addDebugFrame(inspect.currentframe())
     file_text += od_feature.returnToHome()
     return file_text