コード例 #1
0
 def _rightwardsPath(self):
     """
     Each of these paths is the full width of one finger.
     """
     distribution = self.getDistribution()
     finger_width = distribution['finger_width']
     x_straight_cut = distribution['x_straight_cut']
     file_text = G.comment(' => _rightwardsPath')
     file_text += G.G2XY((finger_width, finger_width), (finger_width, 0))
     file_text += G.G1_XY((x_straight_cut, 0))
     return file_text
コード例 #2
0
    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
コード例 #3
0
 def _remCut(self):
     distribution = self.getDistribution()
     file_text = G.comment(' => _remCut')
     file_text += G.G1_XY((0, distribution['remainder'] / 2))
     return file_text