示例#1
0
    def __init__(self, parent=None):
        ObjectUI.__init__(self,
                          title='Excellon Object',
                          icon_file='share/drill32.png',
                          parent=parent)

        #### Plot options ####

        self.plot_options_label = QtWidgets.QLabel("<b>Plot Options:</b>")
        self.custom_box.addWidget(self.plot_options_label)

        grid0 = QtWidgets.QGridLayout()
        self.custom_box.addLayout(grid0)
        self.plot_cb = FCCheckBox(label='Plot')
        self.plot_cb.setToolTip("Plot (show) this object.")
        grid0.addWidget(self.plot_cb, 0, 0)
        self.solid_cb = FCCheckBox(label='Solid')
        self.solid_cb.setToolTip("Solid circles.")
        grid0.addWidget(self.solid_cb, 0, 1)

        #### Tools ####

        self.tools_table_label = QtWidgets.QLabel('<b>Tools</b>')
        self.tools_table_label.setToolTip("Tools in this Excellon object.")
        self.custom_box.addWidget(self.tools_table_label)
        self.tools_table = QtWidgets.QTableWidget()
        self.tools_table.setFixedHeight(100)
        self.custom_box.addWidget(self.tools_table)

        #### Create CNC Job ####

        self.cncjob_label = QtWidgets.QLabel('<b>Create CNC Job</b>')
        self.cncjob_label.setToolTip("Create a CNC Job object\n"
                                     "for this drill object.")
        self.custom_box.addWidget(self.cncjob_label)

        grid1 = QtWidgets.QGridLayout()
        self.custom_box.addLayout(grid1)

        cutzlabel = QtWidgets.QLabel('Cut Z:')
        cutzlabel.setToolTip("Drill depth (negative)\n"
                             "below the copper surface.")
        grid1.addWidget(cutzlabel, 0, 0)
        self.cutz_entry = LengthEntry()
        grid1.addWidget(self.cutz_entry, 0, 1)

        travelzlabel = QtWidgets.QLabel('Travel Z:')
        travelzlabel.setToolTip("Tool height when travelling\n"
                                "across the XY plane.")
        grid1.addWidget(travelzlabel, 1, 0)
        self.travelz_entry = LengthEntry()
        grid1.addWidget(self.travelz_entry, 1, 1)

        frlabel = QtWidgets.QLabel('Feed rate:')
        frlabel.setToolTip("Tool speed while drilling\n"
                           "(in units per minute).")
        grid1.addWidget(frlabel, 2, 0)
        self.feedrate_entry = LengthEntry()
        grid1.addWidget(self.feedrate_entry, 2, 1)

        # Tool change:
        toolchlabel = QtWidgets.QLabel("Tool change:")
        toolchlabel.setToolTip("Include tool-change sequence\n"
                               "in G-Code (Pause for tool change).")
        self.toolchange_cb = FCCheckBox()
        grid1.addWidget(toolchlabel, 3, 0)
        grid1.addWidget(self.toolchange_cb, 3, 1)

        # Tool change Z:
        toolchzlabel = QtWidgets.QLabel("Tool change Z:")
        toolchzlabel.setToolTip("Z-axis position (height) for\n"
                                "tool change.")
        grid1.addWidget(toolchzlabel, 4, 0)
        self.toolchangez_entry = LengthEntry()
        grid1.addWidget(self.toolchangez_entry, 4, 1)
        self.ois_tcz = OptionalInputSection(self.toolchange_cb,
                                            [self.toolchangez_entry])

        # Spindlespeed
        spdlabel = QtWidgets.QLabel('Spindle speed:')
        spdlabel.setToolTip("Speed of the spindle\n" "in RPM (optional)")
        grid1.addWidget(spdlabel, 5, 0)
        self.spindlespeed_entry = IntEntry(allow_empty=True)
        grid1.addWidget(self.spindlespeed_entry, 5, 1)

        choose_tools_label = QtWidgets.QLabel(
            "Select from the tools section above\n"
            "the tools you want to include.")
        self.custom_box.addWidget(choose_tools_label)

        self.generate_cnc_button = QtWidgets.QPushButton('Generate')
        self.generate_cnc_button.setToolTip("Generate the CNC Job.")
        self.custom_box.addWidget(self.generate_cnc_button)

        #### Milling Holes ####
        self.mill_hole_label = QtWidgets.QLabel('<b>Mill Holes</b>')
        self.mill_hole_label.setToolTip("Create Geometry for milling holes.")
        self.custom_box.addWidget(self.mill_hole_label)

        grid1 = QtWidgets.QGridLayout()
        self.custom_box.addLayout(grid1)
        tdlabel = QtWidgets.QLabel('Tool dia:')
        tdlabel.setToolTip("Diameter of the cutting tool.")
        grid1.addWidget(tdlabel, 0, 0)
        self.tooldia_entry = LengthEntry()
        grid1.addWidget(self.tooldia_entry, 0, 1)

        choose_tools_label2 = QtWidgets.QLabel(
            "Select from the tools section above\n"
            "the tools you want to include.")
        self.custom_box.addWidget(choose_tools_label2)

        self.generate_milling_button = QtWidgets.QPushButton(
            'Generate Geometry')
        self.generate_milling_button.setToolTip("Create the Geometry Object\n"
                                                "for milling toolpaths.")
        self.custom_box.addWidget(self.generate_milling_button)
示例#2
0
    def __init__(self, parent=None):
        super(GeometryObjectUI,
              self).__init__(title='Geometry Object',
                             icon_file='share/geometry32.png',
                             parent=parent)

        ## Plot options
        self.plot_options_label = QtWidgets.QLabel("<b>Plot Options:</b>")
        self.custom_box.addWidget(self.plot_options_label)

        # Plot CB
        self.plot_cb = FCCheckBox(label='Plot')
        self.plot_cb.setToolTip("Plot (show) this object.")
        self.custom_box.addWidget(self.plot_cb)

        #-----------------------------------
        # Create CNC Job
        #-----------------------------------
        self.cncjob_label = QtWidgets.QLabel('<b>Create CNC Job:</b>')
        self.cncjob_label.setToolTip("Create a CNC Job object\n"
                                     "tracing the contours of this\n"
                                     "Geometry object.")
        self.custom_box.addWidget(self.cncjob_label)

        grid1 = QtWidgets.QGridLayout()
        self.custom_box.addLayout(grid1)

        cutzlabel = QtWidgets.QLabel('Cut Z:')
        cutzlabel.setToolTip("Cutting depth (negative)\n"
                             "below the copper surface.")
        grid1.addWidget(cutzlabel, 0, 0)
        self.cutz_entry = LengthEntry()
        grid1.addWidget(self.cutz_entry, 0, 1)

        # Travel Z
        travelzlabel = QtWidgets.QLabel('Travel Z:')
        travelzlabel.setToolTip("Height of the tool when\n"
                                "moving without cutting.")
        grid1.addWidget(travelzlabel, 1, 0)
        self.travelz_entry = LengthEntry()
        grid1.addWidget(self.travelz_entry, 1, 1)

        # Feedrate
        frlabel = QtWidgets.QLabel('Feed Rate:')
        frlabel.setToolTip("Cutting speed in the XY\n"
                           "plane in units per minute")
        grid1.addWidget(frlabel, 2, 0)
        self.cncfeedrate_entry = LengthEntry()
        grid1.addWidget(self.cncfeedrate_entry, 2, 1)

        # Tooldia
        tdlabel = QtWidgets.QLabel('Tool dia:')
        tdlabel.setToolTip("The diameter of the cutting\n"
                           "tool (just for display).")
        grid1.addWidget(tdlabel, 3, 0)
        self.cnctooldia_entry = LengthEntry()
        grid1.addWidget(self.cnctooldia_entry, 3, 1)

        # Spindlespeed
        spdlabel = QtWidgets.QLabel('Spindle speed:')
        spdlabel.setToolTip("Speed of the spindle\n" "in RPM (optional)")
        grid1.addWidget(spdlabel, 4, 0)
        self.cncspindlespeed_entry = IntEntry(allow_empty=True)
        grid1.addWidget(self.cncspindlespeed_entry, 4, 1)

        # Multi-pass
        mpasslabel = QtWidgets.QLabel('Multi-Depth:')
        mpasslabel.setToolTip("Use multiple passes to limit\n"
                              "the cut depth in each pass. Will\n"
                              "cut multiple times until Cut Z is\n"
                              "reached.")
        grid1.addWidget(mpasslabel, 5, 0)
        self.mpass_cb = FCCheckBox()
        grid1.addWidget(self.mpass_cb, 5, 1)

        maxdepthlabel = QtWidgets.QLabel('Depth/pass:'******'Generate')
        self.generate_cnc_button.setToolTip("Generate the CNC Job object.")
        self.custom_box.addWidget(self.generate_cnc_button)

        #------------------------------
        # Paint area
        #------------------------------
        self.paint_label = QtWidgets.QLabel('<b>Paint Area:</b>')
        self.paint_label.setToolTip("Creates tool paths to cover the\n"
                                    "whole area of a polygon (remove\n"
                                    "all copper). You will be asked\n"
                                    "to click on the desired polygon.")
        self.custom_box.addWidget(self.paint_label)

        grid2 = QtWidgets.QGridLayout()
        self.custom_box.addLayout(grid2)

        # Tool dia
        ptdlabel = QtWidgets.QLabel('Tool dia:')
        ptdlabel.setToolTip("Diameter of the tool to\n"
                            "be used in the operation.")
        grid2.addWidget(ptdlabel, 0, 0)

        self.painttooldia_entry = LengthEntry()
        grid2.addWidget(self.painttooldia_entry, 0, 1)

        # Overlap
        ovlabel = QtWidgets.QLabel('Overlap:')
        ovlabel.setToolTip("How much (fraction) of the tool\n"
                           "width to overlap each tool pass.")
        grid2.addWidget(ovlabel, 1, 0)
        self.paintoverlap_entry = LengthEntry()
        grid2.addWidget(self.paintoverlap_entry, 1, 1)

        # Margin
        marginlabel = QtWidgets.QLabel('Margin:')
        marginlabel.setToolTip("Distance by which to avoid\n"
                               "the edges of the polygon to\n"
                               "be painted.")
        grid2.addWidget(marginlabel, 2, 0)
        self.paintmargin_entry = LengthEntry()
        grid2.addWidget(self.paintmargin_entry, 2, 1)

        # Method
        methodlabel = QtWidgets.QLabel('Method:')
        methodlabel.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
        methodlabel.setToolTip("Algorithm to paint the polygon:<BR>"
                               "<B>Standard</B>: Fixed step inwards.<BR>"
                               "<B>Seed-based</B>: Outwards from seed.")
        grid2.addWidget(methodlabel, 3, 0)
        self.paintmethod_combo = RadioSet([{
            "label": "Standard",
            "value": "standard"
        }, {
            "label": "Seed-based",
            "value": "seed"
        }, {
            "label": "Straight lines",
            "value": "lines"
        }],
                                          orientation='vertical')
        grid2.addWidget(self.paintmethod_combo, 3, 1)

        # Connect lines
        pathconnectlabel = QtWidgets.QLabel("Connect:")
        pathconnectlabel.setToolTip("Draw lines between resulting\n"
                                    "segments to minimize tool lifts.")
        grid2.addWidget(pathconnectlabel, 4, 0)
        self.pathconnect_cb = FCCheckBox()
        grid2.addWidget(self.pathconnect_cb, 4, 1)

        contourlabel = QtWidgets.QLabel("Contour:")
        contourlabel.setToolTip("Cut around the perimeter of the polygon\n"
                                "to trim rough edges.")
        grid2.addWidget(contourlabel, 5, 0)
        self.paintcontour_cb = FCCheckBox()
        grid2.addWidget(self.paintcontour_cb, 5, 1)

        # Polygon selection
        selectlabel = QtWidgets.QLabel('Selection:')
        selectlabel.setToolTip("How to select the polygons to paint.")
        grid2.addWidget(selectlabel, 6, 0)
        #grid3 = QtWidgets.QGridLayout()
        self.selectmethod_combo = RadioSet([
            {
                "label": "Single",
                "value": "single"
            },
            {
                "label": "All",
                "value": "all"
            },
            #{"label": "Rectangle", "value": "rectangle"}
        ])
        grid2.addWidget(self.selectmethod_combo, 6, 1)

        # GO Button
        self.generate_paint_button = QtWidgets.QPushButton('Generate')
        self.generate_paint_button.setToolTip(
            "After clicking here, click inside\n"
            "the polygon you wish to be painted.\n"
            "A new Geometry object with the tool\n"
            "paths will be created.")
        self.custom_box.addWidget(self.generate_paint_button)