def generateCode(self):

        feed_rate, safe_Z, max_cut_per_pass, bit_diameter, stock_thickness = self.setup.getAllData(
        )

        self.g_code = G.startProgram(feed_rate)
        self.g_code += G.bore_circle_ID(safe_Z, stock_thickness,
                                        max_cut_per_pass,
                                        self.tab_thickness_var.get(),
                                        bit_diameter,
                                        self.doughnut_ID_var.get())
        self.g_code += G.bore_tabbed_ID(safe_Z, stock_thickness,
                                        max_cut_per_pass,
                                        self.tab_thickness_var.get(),
                                        bit_diameter,
                                        self.doughnut_ID_var.get(),
                                        float(self.tab_width_var.get()))
        self.g_code += G.bore_circle_OD(safe_Z, stock_thickness,
                                        max_cut_per_pass,
                                        self.tab_thickness_var.get(),
                                        bit_diameter,
                                        self.doughnut_OD_var.get())
        self.g_code += G.bore_tabbed_OD(safe_Z, self.tab_thickness_var.get(),
                                        max_cut_per_pass,
                                        self.tab_thickness_var.get(),
                                        bit_diameter,
                                        self.doughnut_OD_var.get(),
                                        float(self.tab_width_var.get()))
        self.g_code += G.endProgram()

        return self.g_code
    def generateCode(self):

        feed_rate, safe_Z, max_cut_per_pass, bit_diameter, stock_thickness = self.setup.getAllData()


        self.g_code = G.startProgram(feed_rate)
        self.g_code += G.bore_circle_ID(safe_Z,
                          stock_thickness,
                          max_cut_per_pass,
                          self.tab_thickness_var.get(),
                          bit_diameter,
                          self.doughnut_ID_var.get())
        self.g_code += G.bore_tabbed_ID(safe_Z,
                          stock_thickness,
                          max_cut_per_pass,
                          self.tab_thickness_var.get(),
                          bit_diameter,
                          self.doughnut_ID_var.get(),
                          float(self.tab_width_var.get()))
        self.g_code += G.bore_circle_OD(safe_Z,
                          stock_thickness,
                          max_cut_per_pass,
                          self.tab_thickness_var.get(),
                          bit_diameter,
                          self.doughnut_OD_var.get())
        self.g_code += G.bore_tabbed_OD(safe_Z,
                          self.tab_thickness_var.get(),
                          max_cut_per_pass,
                          self.tab_thickness_var.get(),
                          bit_diameter,
                          self.doughnut_OD_var.get(),
                          float(self.tab_width_var.get()))
        self.g_code += G.endProgram()

        return self.g_code
 def full_doughnut(self):
     g_code = sg.startProgram(1000)
     g_code += sg.bore_circle_ID(40, 4.5, 3, 1.5, 4.763, 118)
     g_code += sg.bore_tabbed_ID(40, 1.5, 3, 1.5, 4.763, 118, 6.35)
     g_code += sg.bore_circle_OD(40, 4.5, 3, 1.5, 4.763, 150)
     g_code += sg.bore_tabbed_OD(40, 1.5, 3, 1.5, 4.763, 150, 6.35)
     g_code += sg.endProgram()
     match = self.proven_doughnut()
     self.assertEqual(g_code, match, "not a match")
 def full_doughnut(self):
     g_code = sg.startProgram(1000)
     g_code += sg.bore_circle_ID(40, 4.5, 3, 1.5, 4.763, 118)
     g_code += sg.bore_tabbed_ID(40, 1.5, 3, 1.5, 4.763, 118, 6.35)
     g_code += sg.bore_circle_OD(40, 4.5, 3, 1.5, 4.763, 150)
     g_code += sg.bore_tabbed_OD(40, 1.5, 3, 1.5, 4.763, 150, 6.35)
     g_code += sg.endProgram()
     match = self.proven_doughnut()
     self.assertEqual(g_code, match, "not a match")
Beispiel #5
0
    def generateCode(self):
        feed_rate, safe_Z, max_cut_per_pass, bit_diameter, stock_thickness = self.setup.getAllData(
        )

        self.g_code = G.startProgram(feed_rate)
        self.g_code += G.bore_circle_ID(safe_Z, stock_thickness,
                                        max_cut_per_pass,
                                        self.target_depth_var.get(),
                                        bit_diameter,
                                        self.hole_diameter_var.get())
        self.g_code += G.endProgram()

        return self.g_code
    def generateCode(self):
        feed_rate, safe_Z, max_cut_per_pass, bit_diameter, stock_thickness = self.setup.getAllData()

        self.g_code = G.startProgram(feed_rate)
        self.g_code += G.bore_circle_ID(safe_Z,
                          stock_thickness,
                          max_cut_per_pass,
                          self.target_depth_var.get(),
                          bit_diameter,
                          self.hole_diameter_var.get())
        self.g_code += G.endProgram()

        return self.g_code
Beispiel #7
0
    def generateCode(self):
        feed_rate, safe_Z, max_cut_per_pass, bit_diameter, stock_thickness = self.setup.getAllData(
        )

        self.g_code = G.startProgram(feed_rate)

        self.g_code += G.polar_holes(safe_Z, stock_thickness, max_cut_per_pass,
                                     0, bit_diameter,
                                     self.hole_diameter_var.get(),
                                     self.num_holes_var.get(),
                                     self.HCD_var.get())

        self.g_code += G.endProgram()

        return self.g_code
    def generateCode(self):
        feed_rate, safe_Z, max_cut_per_pass, bit_diameter, stock_thickness = self.setup.getAllData()

        self.g_code = G.startProgram(feed_rate)

        self.g_code += G.polar_holes(safe_Z,
                          stock_thickness,
                          max_cut_per_pass,
                          0,
                          bit_diameter,
                          self.hole_diameter_var.get(),
                          self.num_holes_var.get(),
                          self.HCD_var.get())

        self.g_code += G.endProgram()

        return self.g_code
    def generateGcode(self):
        self.assertValid()
        feed_rate = self.machine_params["Feed rate"].getValue()
        safe_Z = self.machine_params["Safe Z travel height"].getValue()
        max_cut_per_pass = self.machine_params["Maximum cut per pass"].getValue()
        bit_diameter = self.machine_params["Cutter diameter"].getValue()
        stock_length = self.stock_length_param.getValue()
        stock_thickness = self.stock_height_param.getValue()
        mid_width = self.stock_width_param.getValue() / 2.0
        bottom_radius = self.bottom_radius_param.getValue()
        bit_radius = bit_diameter / 2.0

        # STOCK POSITIONING ASSUMPTIONS:
        #   - corner of stock is at (bit_diameter,0)
        self.g_code = G.startProgram(feed_rate)
        # Putting the tip of the bit on the top surface of the stock.
        self.g_code += G.G.G0_Z(safe_Z)
        self.g_code += G.G.G0_XY((0, mid_width))
        self.g_code += G.G.G0_Z(stock_thickness)

        length = stock_length + (2 * bit_diameter)

        # Cool! Making another closure for the callback!
        def makeRectAreaCut(bit_center_from_middle, bit_center_Y):
            self.g_code += G.G.set_ABS_mode()
            self.g_code += G.G.G0_Y(mid_width - bit_center_from_middle)
            self.g_code += G.G.G1_Z(bit_center_Y - bit_radius)
            width = (bit_center_from_middle * 2) + bit_diameter
            self.g_code += G.rectAreaByOutline((length, width), bit_diameter)

        self._passDistributionAlgorithm(makeRectAreaCut)

        self.g_code += G.G.G0_Y(mid_width)
        self.g_code += G.G.G1_Z(stock_thickness - bottom_radius)
        self.g_code += G.G.set_INCR_mode()
        self.g_code += G.G.G1_X(length - bit_diameter)
        self.g_code += G.G.set_ABS_mode()

        self.g_code += G.G.G0_Z(safe_Z)
        self.g_code += G.endProgram()
        return self.g_code
    def generateGcode(self):
        """
        Four cutting operations to program:
        - 2 mortises (uses the rectangular pocket)
            . rectangularPocket(area, target_depth, stock_thickness, safe_Z, cut_per_pass, bit_diameter, debug=False)
        - 2 tenons   (requires new machining pattern)

        Variable reference points, hold in MC_defaults.py:
        - machine's Y-axis coordinate of centers of location holes
        - width of holding jig
        - offset of machine location holes (centers) and centerline of holding jig
        - offset from machine's X-axis reference point and mortise reference faces
        - offset from machine's X-axis reference point and tenon reference faces

        Expanded bit definitions:
        - depth of cut, use in assertValid()
        """
        self.assertValid()
        feed_rate = self.machine_params["Feed rate"].getValue()
        safe_Z = self.machine_params["Safe Z travel height"].getValue()
        max_cut_per_pass = self.machine_params["Maximum cut per pass"].getValue()
        bit_diameter = self.machine_params["Cutter diameter"].getValue()
        bit_radius = bit_diameter / 2.0

        mortise_w = self.mortise_width_param.getValue()
        mortise_l = self.mortise_length_param.getValue()
        mortise_d = self.mortise_depth_param.getValue()
        mortise_offest_from_face = self.mortise_offest_from_face_param.getValue()
        mortise_offest_from_end = self.mortise_offest_from_end_param.getValue()
        stile_face_width = self.stile_face_width_param.getValue()
        stile_edge_width = self.stile_edge_width_param.getValue()

        if self.rail_face_width_param != 0:
            rail_face_width = self.rail_face_width_param.getValue()
        else:
            rail_face_width = stile_face_width

        # BIT POSITIONING ASSUMPTIONS:
        #   - bit position is assumed to be calibrated to the machine's jig locating holes
        #   - no other assumptions required
        self.g_code = G.startProgram(feed_rate)
        # Find the first corner pocket
        originABX = mortisingJig['stileEndReference'] - mortise_offest_from_end - mortise_l + bit_radius

        stileReferenceFaceA = mortisingJig['locationHoleYcoord'] - (mortisingJig['jigWidth'] / 2.0) + mortisingJig['jigCenterlineOffset']
        stileReferenceFaceB = mortisingJig['locationHoleYcoord'] + (mortisingJig['jigWidth'] / 2.0) + mortisingJig['jigCenterlineOffset']
        originAY = stileReferenceFaceA - mortise_offest_from_face - mortise_w + bit_radius
        originBY = stileReferenceFaceB + mortise_offest_from_face + bit_radius

        self.g_code += G.G.set_ABS_mode()
        self.g_code += G.G.G0_Z(safe_Z)

        self.g_code += G.G.G0_XY((originABX, originAY))
        self.g_code += G.rectangularPocket((mortise_l, mortise_w), stile_face_width - mortise_d, stile_face_width, safe_Z, max_cut_per_pass, bit_diameter, True)

        self.g_code += G.G.G0_XY((originABX, originBY))
        self.g_code += G.rectangularPocket((mortise_l, mortise_w), stile_face_width - mortise_d, stile_face_width, safe_Z, max_cut_per_pass, bit_diameter, True)

        # Pause now to mount the rails in the holding jig for the first set of tenon cuts
        self.g_code += G.G.pause()

        originABX = mortisingJig['railEndReference'] + mortise_offest_from_end
        originAY = stileReferenceFaceA - mortisingJig['railFaceReferenceOffset'] - stile_edge_width
        originBY = stileReferenceFaceB + mortisingJig['railFaceReferenceOffset']

        self.g_code += G.G.G0_XY((originABX, originAY))
        self.g_code += G.tenon((rail_face_width, stile_edge_width), (stile_face_width, stile_edge_width), \
                                (mortise_offest_from_face, mortise_offest_from_end), (mortise_l, mortise_w, mortise_d), \
                                bit_diameter, bit_diameter, safe_Z, max_cut_per_pass)

        alt_face_offset = stile_edge_width - mortise_offest_from_face - mortise_w
        self.g_code += G.G.G0_XY((originABX, originBY))
        self.g_code += G.tenon((rail_face_width, stile_edge_width), (stile_face_width, stile_edge_width), \
                                (alt_face_offset, mortise_offest_from_end), (mortise_l, mortise_w, mortise_d), \
                                bit_diameter, bit_diameter, safe_Z, max_cut_per_pass)

        self.g_code += G.endProgram()
        return self.g_code