def _getGCode(self, order_int):
        file_text = self._startProgram()
        # move to start, at safe-Z, in INCR mode
        file_text += G.set_INCR_mode()
        file_text += G.G0_XY(( \
            self.startRefs['x_starting_ref'], \
            self.startRefs['y_starting_ref'] \
        ))

        height_to_cut = self.workpiece_params['stock_height']

        while height_to_cut > 0:
            # move down to top of stock
            file_text += G.set_ABS_mode()
            file_text += G.G0_Z(height_to_cut)
            # get to cutting height
            height_to_cut = max(
                height_to_cut - self.cutting_params['cut_per_pass'], 0)
            file_text += G.set_ABS_mode()
            file_text += G.G1_Z(
                height_to_cut)  # could be G0 here, but it's good practice

            # This is other magic for A/B: special order of paths.
            file_text += self.cutFingers(order_int)
            file_text += self.returnToStart(order_int)

        file_text += self.returnToHome()
        file_text += self._endProgram()
        return file_text
示例#2
0
 def setMode(self, mode):
     file_text = ''
     if mode.lower() == 'abs':
         if self.mode != 'abs':
             self.mode = 'abs'
             file_text = G.set_ABS_mode()
     elif mode.lower() == 'incr':
         if self.mode != 'incr':
             self.mode = 'incr'
             file_text = G.set_INCR_mode()
     else:
         raise ValueError('"%s" mode is not handled by SimpleMachine' %
                          (mode))
     return file_text