class FlatCAMInfoBar(QWidget): def __init__(self, parent=None): super(FlatCAMInfoBar, self).__init__(parent=parent) self.icon = QLabel(self) self.icon.setGeometry(0, 0, 12, 12) self.pmap = QtGui.QPixmap('share/graylight12.png') self.icon.setPixmap(self.pmap) layout = QHBoxLayout() layout.setContentsMargins(5, 0, 5, 0) self.setLayout(layout) layout.addWidget(self.icon) self.text = QLabel(self) self.text.setText("Hello!") self.text.setToolTip("Hello!") layout.addWidget(self.text) layout.addStretch() def set_text_(self, text): self.text.setText(text) self.text.setToolTip(text) def set_status(self, text, level="info"): level = str(level) self.pmap.fill() if level == "error": self.pmap = QtGui.QPixmap('share/redlight12.png') elif level == "success": self.pmap = QtGui.QPixmap('share/greenlight12.png') elif level == "warning": self.pmap = QtGui.QPixmap('share/yellowlight12.png') else: self.pmap = QtGui.QPixmap('share/graylight12.png') self.icon.setPixmap(self.pmap) self.set_text_(text)
class DblSidedTool(FlatCAMTool): toolName = "Double-Sided PCB Tool" def __init__(self, app): FlatCAMTool.__init__(self, app) ## Title title_label = QLabel("<font size=4><b>%s</b></font>" % self.toolName) self.layout.addWidget(title_label) ## Form Layout form_layout = QFormLayout() self.layout.addLayout(form_layout) ## Layer to mirror self.object_combo = QComboBox() self.object_combo.setModel(self.app.collection.model) self.botlay_label = QLabel("Bottom Layer:") self.botlay_label.setToolTip("Layer to be mirrorer.") # form_layout.addRow("Bottom Layer:", self.object_combo) form_layout.addRow(self.botlay_label, self.object_combo) ## Axis self.mirror_axis = RadioSet([{ 'label': 'X', 'value': 'X' }, { 'label': 'Y', 'value': 'Y' }]) self.mirax_label = QLabel("Mirror Axis:") self.mirax_label.setToolTip( "Mirror vertically (X) or horizontally (Y).") # form_layout.addRow("Mirror Axis:", self.mirror_axis) form_layout.addRow(self.mirax_label, self.mirror_axis) ## Axis Location self.axis_location = RadioSet([{ 'label': 'Point', 'value': 'point' }, { 'label': 'Box', 'value': 'box' }]) self.axloc_label = QLabel("Axis Location:") self.axloc_label.setToolTip( "The axis should pass through a <b>point</b> or cut " "a specified <b>box</b> (in a Geometry object) in " "the middle.") # form_layout.addRow("Axis Location:", self.axis_location) form_layout.addRow(self.axloc_label, self.axis_location) ## Point/Box self.point_box_container = QVBoxLayout() self.pb_label = QLabel("Point/Box:") self.pb_label.setToolTip( "Specify the point (x, y) through which the mirror axis " "passes or the Geometry object containing a rectangle " "that the mirror axis cuts in half.") # form_layout.addRow("Point/Box:", self.point_box_container) form_layout.addRow(self.pb_label, self.point_box_container) self.point = EvalEntry() self.point_box_container.addWidget(self.point) self.box_combo = QComboBox() self.box_combo.setModel(self.app.collection.model) self.point_box_container.addWidget(self.box_combo) self.box_combo.hide() ## Alignment holes self.alignment_holes = EvalEntry() self.ah_label = QLabel("Alignment Holes:") self.ah_label.setToolTip("Alignment holes (x1, y1), (x2, y2), ... " "on one side of the mirror axis.") form_layout.addRow(self.ah_label, self.alignment_holes) ## Drill diameter for alignment holes self.drill_dia = LengthEntry() self.dd_label = QLabel("Drill diam.:") self.dd_label.setToolTip("Diameter of the drill for the " "alignment holes.") form_layout.addRow(self.dd_label, self.drill_dia) ## Buttons hlay = QHBoxLayout() self.layout.addLayout(hlay) hlay.addStretch() self.create_alignment_hole_button = QPushButton( "Create Alignment Drill") self.create_alignment_hole_button.setToolTip( "Creates an Excellon Object containing the " "specified alignment holes and their mirror " "images.") self.mirror_object_button = QPushButton("Mirror Object") self.mirror_object_button.setToolTip( "Mirrors (flips) the specified object around " "the specified axis. Does not create a new " "object, but modifies it.") hlay.addWidget(self.create_alignment_hole_button) hlay.addWidget(self.mirror_object_button) self.layout.addStretch() ## Signals self.create_alignment_hole_button.clicked.connect( self.on_create_alignment_holes) self.mirror_object_button.clicked.connect(self.on_mirror) self.axis_location.group_toggle_fn = self.on_toggle_pointbox ## Initialize form self.mirror_axis.set_value('X') self.axis_location.set_value('point') def on_create_alignment_holes(self): axis = self.mirror_axis.get_value() mode = self.axis_location.get_value() if mode == "point": px, py = self.point.get_value() else: selection_index = self.box_combo.currentIndex() bb_obj = self.app.collection.object_list[ selection_index] # TODO: Direct access?? xmin, ymin, xmax, ymax = bb_obj.bounds() px = 0.5 * (xmin + xmax) py = 0.5 * (ymin + ymax) xscale, yscale = {"X": (1.0, -1.0), "Y": (-1.0, 1.0)}[axis] dia = self.drill_dia.get_value() tools = {"1": {"C": dia}} # holes = self.alignment_holes.get_value() holes = eval('[{}]'.format(self.alignment_holes.text())) drills = [] for hole in holes: point = Point(hole) point_mirror = affinity.scale(point, xscale, yscale, origin=(px, py)) drills.append({"point": point, "tool": "1"}) drills.append({"point": point_mirror, "tool": "1"}) def obj_init(obj_inst, app_inst): obj_inst.tools = tools obj_inst.drills = drills obj_inst.create_geometry() self.app.new_object("excellon", "Alignment Drills", obj_init) def on_mirror(self): selection_index = self.object_combo.currentIndex() fcobj = self.app.collection.object_list[selection_index] # For now, lets limit to Gerbers and Excellons. # assert isinstance(gerb, FlatCAMGerber) if not isinstance(fcobj, FlatCAMGerber) and \ not isinstance(fcobj, FlatCAMExcellon) and \ not isinstance(fcobj, FlatCAMGeometry): self.app.inform.emit( "ERROR: Only Gerber, Excellon and Geometry objects can be mirrored." ) return axis = self.mirror_axis.get_value() mode = self.axis_location.get_value() if mode == "point": px, py = self.point.get_value() else: selection_index = self.box_combo.currentIndex() bb_obj = self.app.collection.object_list[ selection_index] # TODO: Direct access?? xmin, ymin, xmax, ymax = bb_obj.bounds() px = 0.5 * (xmin + xmax) py = 0.5 * (ymin + ymax) # Ensure that the selected object will display when it is mirrored. # If an object's plot setting is False it will still be available in # the combo box. If the plot is not enforced to True then the user # gets no feedback of the operation. fcobj.options["plot"] = True fcobj.mirror(axis, [px, py]) fcobj.plot() def on_toggle_pointbox(self): if self.axis_location.get_value() == "point": self.point.show() self.box_combo.hide() else: self.point.hide() self.box_combo.show()
class ToolTransform(FlatCAMTool): toolName = "Object Transformation" rotateName = "Rotate Transformation" skewName = "Skew/Shear Transformation" flipName = "Flip Transformation" def __init__(self, app): FlatCAMTool.__init__(self, app) self.transform_lay = QVBoxLayout() self.layout.addLayout(self.transform_lay) ## Title title_label = QLabel("<font size=4><b>%s</b></font><br>" % self.toolName) self.transform_lay.addWidget(title_label) self.empty_label = QLabel("") self.empty_label.setFixedWidth(80) self.empty_label1 = QLabel("") self.empty_label1.setFixedWidth(80) self.empty_label2 = QLabel("") self.empty_label2.setFixedWidth(80) self.transform_lay.addWidget(self.empty_label) ## Rotate Title rotate_title_label = QLabel("<font size=3><b>%s</b></font>" % self.rotateName) self.transform_lay.addWidget(rotate_title_label) ## Form Layout form_layout = QFormLayout() self.transform_lay.addLayout(form_layout) self.rotate_entry = FCEntry() self.rotate_entry.setFixedWidth(70) self.rotate_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.rotate_label = QLabel("Angle Rotation:") self.rotate_label.setToolTip("Angle for Rotation action, in degrees.\n" "Float number between -360 and 359.\n" "Positive numbers for CW motion.\n" "Negative numbers for CCW motion.") self.rotate_label.setFixedWidth(80) self.rotate_button = FCButton() self.rotate_button.set_value("Rotate") self.rotate_button.setToolTip( "Rotate the selected object(s).\n" "The point of reference is the middle of\n" "the bounding box for all selected objects.\n") self.rotate_button.setFixedWidth(70) form_layout.addRow(self.rotate_label, self.rotate_entry) form_layout.addRow(self.empty_label, self.rotate_button) self.transform_lay.addWidget(self.empty_label1) ## Skew Title skew_title_label = QLabel("<font size=3><b>%s</b></font>" % self.skewName) self.transform_lay.addWidget(skew_title_label) ## Form Layout form1_layout = QFormLayout() self.transform_lay.addLayout(form1_layout) self.skewx_entry = FCEntry() self.skewx_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.skewx_entry.setFixedWidth(70) self.skewx_label = QLabel("Angle SkewX:") self.skewx_label.setToolTip("Angle for Skew action, in degrees.\n" "Float number between -360 and 359.") self.skewx_label.setFixedWidth(80) self.skewx_button = FCButton() self.skewx_button.set_value("Skew_X") self.skewx_button.setToolTip( "Skew/shear the selected object(s).\n" "The point of reference is the middle of\n" "the bounding box for all selected objects.\n") self.skewx_button.setFixedWidth(70) self.skewy_entry = FCEntry() self.skewy_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.skewy_entry.setFixedWidth(70) self.skewy_label = QLabel("Angle SkewY:") self.skewy_label.setToolTip("Angle for Skew action, in degrees.\n" "Float number between -360 and 359.") self.skewy_label.setFixedWidth(80) self.skewy_button = FCButton() self.skewy_button.set_value("Skew_Y") self.skewy_button.setToolTip( "Skew/shear the selected object(s).\n" "The point of reference is the middle of\n" "the bounding box for all selected objects.\n") self.skewy_button.setFixedWidth(70) form1_layout.addRow(self.skewx_label, self.skewx_entry) form1_layout.addRow(self.empty_label, self.skewx_button) form1_layout.addRow(self.skewy_label, self.skewy_entry) form1_layout.addRow(self.empty_label, self.skewy_button) self.transform_lay.addWidget(self.empty_label2) ## Flip Title flip_title_label = QLabel("<font size=3><b>%s</b></font>" % self.flipName) self.transform_lay.addWidget(flip_title_label) ## Form Layout form2_layout = QFormLayout() self.transform_lay.addLayout(form2_layout) self.flipx_button = FCButton() self.flipx_button.set_value("Flip_X") self.flipx_button.setToolTip( "Flip the selected object(s) over the X axis.\n" "Does not create a new object.\n ") self.flipx_button.setFixedWidth(70) self.flipy_button = FCButton() self.flipy_button.set_value("Flip_Y") self.flipy_button.setToolTip( "Flip the selected object(s) over the X axis.\n" "Does not create a new object.\n ") self.flipy_button.setFixedWidth(70) form2_layout.setSpacing(16) form2_layout.addRow(self.flipx_button, self.flipy_button) self.transform_lay.addStretch() ## Signals self.rotate_button.clicked.connect(self.on_rotate) self.skewx_button.clicked.connect(self.on_skewx) self.skewy_button.clicked.connect(self.on_skewy) self.flipx_button.clicked.connect(self.on_flipx) self.flipy_button.clicked.connect(self.on_flipy) self.rotate_entry.returnPressed.connect(self.on_rotate) self.skewx_entry.returnPressed.connect(self.on_skewx) self.skewy_entry.returnPressed.connect(self.on_skewy) ## Initialize form self.rotate_entry.set_value('0') self.skewx_entry.set_value('0') self.skewy_entry.set_value('0') def on_rotate(self): value = float(self.rotate_entry.get_value()) self.on_rotate_action(value) return def on_flipx(self): self.on_flip("Y") return def on_flipy(self): self.on_flip("X") return def on_skewx(self): value = float(self.skewx_entry.get_value()) self.on_skew("X", value) return def on_skewy(self): value = float(self.skewy_entry.get_value()) self.on_skew("Y", value) return def on_rotate_action(self, num): obj_list = self.app.collection.get_selected() xminlist = [] yminlist = [] xmaxlist = [] ymaxlist = [] if not obj_list: self.app.inform.emit("WARNING: No object selected.") msg = "Please Select an object to rotate!" warningbox = QtGui.QMessageBox() warningbox.setText(msg) warningbox.setWindowTitle("Warning ...") warningbox.setWindowIcon(QtGui.QIcon('share/warning.png')) warningbox.setStandardButtons(QtGui.QMessageBox.Ok) warningbox.setDefaultButton(QtGui.QMessageBox.Ok) warningbox.exec_() else: try: # first get a bounding box to fit all for obj in obj_list: xmin, ymin, xmax, ymax = obj.bounds() xminlist.append(xmin) yminlist.append(ymin) xmaxlist.append(xmax) ymaxlist.append(ymax) # get the minimum x,y and maximum x,y for all objects selected xminimal = min(xminlist) yminimal = min(yminlist) xmaximal = max(xmaxlist) ymaximal = max(ymaxlist) for sel_obj in obj_list: px = 0.5 * (xminimal + xmaximal) py = 0.5 * (yminimal + ymaximal) sel_obj.rotate(-num, point=(px, py)) sel_obj.plot() self.app.inform.emit('Object was rotated ...') except Exception as e: self.app.inform.emit( "[ERROR] Due of %s, rotation movement was not executed." % str(e)) raise def on_flip(self, axis): obj_list = self.app.collection.get_selected() xminlist = [] yminlist = [] xmaxlist = [] ymaxlist = [] if not obj_list: self.app.inform.emit("WARNING: No object selected.") msg = "Please Select an object to flip!" warningbox = QtGui.QMessageBox() warningbox.setText(msg) warningbox.setWindowTitle("Warning ...") warningbox.setWindowIcon(QtGui.QIcon('share/warning.png')) warningbox.setStandardButtons(QtGui.QMessageBox.Ok) warningbox.setDefaultButton(QtGui.QMessageBox.Ok) warningbox.exec_() return else: try: # first get a bounding box to fit all for obj in obj_list: xmin, ymin, xmax, ymax = obj.bounds() xminlist.append(xmin) yminlist.append(ymin) xmaxlist.append(xmax) ymaxlist.append(ymax) # get the minimum x,y and maximum x,y for all objects selected xminimal = min(xminlist) yminimal = min(yminlist) xmaximal = max(xmaxlist) ymaximal = max(ymaxlist) px = 0.5 * (xminimal + xmaximal) py = 0.5 * (yminimal + ymaximal) # execute mirroring for obj in obj_list: if axis is 'X': obj.mirror('X', [px, py]) obj.plot() self.app.inform.emit('Flipped on the Y axis ...') elif axis is 'Y': obj.mirror('Y', [px, py]) obj.plot() self.app.inform.emit('Flipped on the X axis ...') except Exception as e: self.app.inform.emit( "[ERROR] Due of %s, Flip action was not executed.") raise def on_skew(self, axis, num): obj_list = self.app.collection.get_selected() xminlist = [] yminlist = [] if not obj_list: self.app.inform.emit("WARNING: No object selected.") msg = "Please Select an object to skew/shear!" warningbox = QtGui.QMessageBox() warningbox.setText(msg) warningbox.setWindowTitle("Warning ...") warningbox.setWindowIcon(QtGui.QIcon('share/warning.png')) warningbox.setStandardButtons(QtGui.QMessageBox.Ok) warningbox.setDefaultButton(QtGui.QMessageBox.Ok) warningbox.exec_() else: try: # first get a bounding box to fit all for obj in obj_list: xmin, ymin, xmax, ymax = obj.bounds() xminlist.append(xmin) yminlist.append(ymin) # get the minimum x,y and maximum x,y for all objects selected xminimal = min(xminlist) yminimal = min(yminlist) for obj in obj_list: if axis is 'X': obj.skew(num, 0, point=(xminimal, yminimal)) elif axis is 'Y': obj.skew(0, num, point=(xminimal, yminimal)) obj.plot() self.app.inform.emit('Object was skewed on %s axis ...' % str(axis)) except Exception as e: self.app.inform.emit( "[ERROR] Due of %s, Skew action was not executed." % str(e)) raise # end of file
def __init__(self, parent=None): OptionsGroupUI.__init__(self, "CNC Job Options", parent=None) ## Plot options self.plot_options_label = QLabel("<b>Plot Options:</b>") self.layout.addWidget(self.plot_options_label) grid0 = QGridLayout() self.layout.addLayout(grid0) # Plot CB # self.plot_cb = QtGui.QCheckBox('Plot') self.plot_cb = FCCheckBox('Plot') self.plot_cb.setToolTip("Plot (show) this object.") grid0.addWidget(self.plot_cb, 0, 0) # Tool dia for plot tdlabel = QLabel('Tool dia:') tdlabel.setToolTip("Diameter of the tool to be\n" "rendered in the plot.") grid0.addWidget(tdlabel, 1, 0) self.tooldia_entry = LengthEntry() grid0.addWidget(self.tooldia_entry, 1, 1) ## Export G-Code self.export_gcode_label = QLabel("<b>Export G-Code:</b>") self.export_gcode_label.setToolTip("Export and save G-Code to\n" "make this object to a file.") self.layout.addWidget(self.export_gcode_label) # Prepend to G-Code prependlabel = QLabel('Prepend to G-Code:') prependlabel.setToolTip( "Type here any G-Code commands you would\n" "like to add at the beginning of the G-Code file.") self.layout.addWidget(prependlabel) self.prepend_text = FCTextArea() self.layout.addWidget(self.prepend_text) # Append text to G-Code appendlabel = QLabel('Append to G-Code:') appendlabel.setToolTip("Type here any G-Code commands you would\n" "like to append to the generated file.\n" "I.e.: M2 (End of program)") self.layout.addWidget(appendlabel) self.append_text = FCTextArea() self.layout.addWidget(self.append_text) # Dwell grid1 = QGridLayout() self.layout.addLayout(grid1) dwelllabel = QLabel('Dwell:') dwelllabel.setToolTip("Pause to allow the spindle to reach its\n" "speed before cutting.") dwelltime = QLabel('Duration [sec.]:') dwelltime.setToolTip("Number of second to dwell.") self.dwell_cb = FCCheckBox() self.dwelltime_cb = FCEntry() grid1.addWidget(dwelllabel, 0, 0) grid1.addWidget(self.dwell_cb, 0, 1) grid1.addWidget(dwelltime, 1, 0) grid1.addWidget(self.dwelltime_cb, 1, 1)
def __init__(self, parent=None): OptionsGroupUI.__init__(self, "Geometry Options", parent=parent) ## Plot options self.plot_options_label = QLabel("<b>Plot Options:</b>") self.layout.addWidget(self.plot_options_label) # Plot CB self.plot_cb = FCCheckBox(label='Plot') self.plot_cb.setToolTip("Plot (show) this object.") self.layout.addWidget(self.plot_cb) # ------------------------------ ## Create CNC Job # ------------------------------ self.cncjob_label = 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.layout.addWidget(self.cncjob_label) grid1 = QGridLayout() self.layout.addLayout(grid1) cutzlabel = 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 = 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 = 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 = 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) spdlabel = 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) # ------------------------------ ## Paint area # ------------------------------ self.paint_label = 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.layout.addWidget(self.paint_label) grid2 = QGridLayout() self.layout.addLayout(grid2) # Tool dia ptdlabel = 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 = 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 = 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 = QLabel('Method:') 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 = 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) # Paint contour contourlabel = QLabel("Contour:") contourlabel.setToolTip("Cut around the perimeter of the polygon\n" "to trim rough edges.") grid2.addWidget(contourlabel, 5, 0) self.contour_cb = FCCheckBox() grid2.addWidget(self.contour_cb, 5, 1) # Polygon selection selectlabel = QLabel('Selection:') selectlabel.setToolTip("How to select the polygons to paint.") grid2.addWidget(selectlabel, 6, 0) # grid3 = QGridLayout() self.selectmethod_combo = RadioSet([ { "label": "Single", "value": "single" }, { "label": "All", "value": "all" }, # {"label": "Rectangle", "value": "rectangle"} ]) grid2.addWidget(self.selectmethod_combo, 6, 1)
def __init__(self, parent=None): OptionsGroupUI.__init__(self, "Excellon Options", parent=parent) ## Plot options self.plot_options_label = QLabel("<b>Plot Options:</b>") self.layout.addWidget(self.plot_options_label) grid0 = QGridLayout() self.layout.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) ## Create CNC Job self.cncjob_label = QLabel('<b>Create CNC Job</b>') self.cncjob_label.setToolTip("Create a CNC Job object\n" "for this drill object.") self.layout.addWidget(self.cncjob_label) grid1 = QGridLayout() self.layout.addLayout(grid1) cutzlabel = 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 = 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 = 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) toolchangezlabel = QLabel('Toolchange Z:') toolchangezlabel.setToolTip("Tool Z where user can change drill bit\n") grid1.addWidget(toolchangezlabel, 3, 0) self.toolchangez_entry = LengthEntry() grid1.addWidget(self.toolchangez_entry, 3, 1) spdlabel = QLabel('Spindle speed:') spdlabel.setToolTip("Speed of the spindle\n" "in RPM (optional)") grid1.addWidget(spdlabel, 4, 0) self.spindlespeed_entry = IntEntry(allow_empty=True) grid1.addWidget(self.spindlespeed_entry, 4, 1) #### Milling Holes #### self.mill_hole_label = QLabel('<b>Mill Holes</b>') self.mill_hole_label.setToolTip("Create Geometry for milling holes.") self.layout.addWidget(self.mill_hole_label) grid1 = QGridLayout() self.layout.addLayout(grid1) tdlabel = 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)
def __init__(self, parent=None): OptionsGroupUI.__init__(self, "Gerber Options", parent=parent) ## Plot options self.plot_options_label = QLabel("<b>Plot Options:</b>") self.layout.addWidget(self.plot_options_label) grid0 = QGridLayout() self.layout.addLayout(grid0) # Plot CB self.plot_cb = FCCheckBox(label='Plot') self.plot_options_label.setToolTip("Plot (show) this object.") grid0.addWidget(self.plot_cb, 0, 0) # Solid CB self.solid_cb = FCCheckBox(label='Solid') self.solid_cb.setToolTip("Solid color polygons.") grid0.addWidget(self.solid_cb, 0, 1) # Multicolored CB self.multicolored_cb = FCCheckBox(label='Multicolored') self.multicolored_cb.setToolTip("Draw polygons in different colors.") grid0.addWidget(self.multicolored_cb, 0, 2) ## Isolation Routing self.isolation_routing_label = QLabel("<b>Isolation Routing:</b>") self.isolation_routing_label.setToolTip( "Create a Geometry object with\n" "toolpaths to cut outside polygons.") self.layout.addWidget(self.isolation_routing_label) grid1 = QGridLayout() self.layout.addLayout(grid1) tdlabel = QLabel('Tool dia:') tdlabel.setToolTip("Diameter of the cutting tool.") grid1.addWidget(tdlabel, 0, 0) self.iso_tool_dia_entry = LengthEntry() grid1.addWidget(self.iso_tool_dia_entry, 0, 1) passlabel = QLabel('Width (# passes):') passlabel.setToolTip("Width of the isolation gap in\n" "number (integer) of tool widths.") grid1.addWidget(passlabel, 1, 0) self.iso_width_entry = IntEntry() grid1.addWidget(self.iso_width_entry, 1, 1) overlabel = QLabel('Pass overlap:') overlabel.setToolTip("How much (fraction of tool width)\n" "to overlap each pass.") grid1.addWidget(overlabel, 2, 0) self.iso_overlap_entry = FloatEntry() grid1.addWidget(self.iso_overlap_entry, 2, 1) self.combine_passes_cb = FCCheckBox(label='Combine Passes') self.combine_passes_cb.setToolTip("Combine all passes into one object") grid1.addWidget(self.combine_passes_cb, 3, 0) ## Board cuttout self.board_cutout_label = QLabel("<b>Board cutout:</b>") self.board_cutout_label.setToolTip("Create toolpaths to cut around\n" "the PCB and separate it from\n" "the original board.") self.layout.addWidget(self.board_cutout_label) grid2 = QGridLayout() self.layout.addLayout(grid2) tdclabel = QLabel('Tool dia:') tdclabel.setToolTip("Diameter of the cutting tool.") grid2.addWidget(tdclabel, 0, 0) self.cutout_tooldia_entry = LengthEntry() grid2.addWidget(self.cutout_tooldia_entry, 0, 1) marginlabel = QLabel('Margin:') marginlabel.setToolTip("Distance from objects at which\n" "to draw the cutout.") grid2.addWidget(marginlabel, 1, 0) self.cutout_margin_entry = LengthEntry() grid2.addWidget(self.cutout_margin_entry, 1, 1) gaplabel = QLabel('Gap size:') gaplabel.setToolTip("Size of the gaps in the toolpath\n" "that will remain to hold the\n" "board in place.") grid2.addWidget(gaplabel, 2, 0) self.cutout_gap_entry = LengthEntry() grid2.addWidget(self.cutout_gap_entry, 2, 1) gapslabel = QLabel('Gaps:') gapslabel.setToolTip("Where to place the gaps, Top/Bottom\n" "Left/Rigt, or on all 4 sides.") grid2.addWidget(gapslabel, 3, 0) self.gaps_radio = RadioSet([{ 'label': '2 (T/B)', 'value': 'tb' }, { 'label': '2 (L/R)', 'value': 'lr' }, { 'label': '4', 'value': '4' }]) grid2.addWidget(self.gaps_radio, 3, 1) ## Non-copper regions self.noncopper_label = QLabel("<b>Non-copper regions:</b>") self.noncopper_label.setToolTip("Create polygons covering the\n" "areas without copper on the PCB.\n" "Equivalent to the inverse of this\n" "object. Can be used to remove all\n" "copper from a specified region.") self.layout.addWidget(self.noncopper_label) grid3 = QGridLayout() self.layout.addLayout(grid3) # Margin bmlabel = QLabel('Boundary Margin:') bmlabel.setToolTip("Specify the edge of the PCB\n" "by drawing a box around all\n" "objects with this minimum\n" "distance.") grid3.addWidget(bmlabel, 0, 0) self.noncopper_margin_entry = LengthEntry() grid3.addWidget(self.noncopper_margin_entry, 0, 1) # Rounded corners self.noncopper_rounded_cb = FCCheckBox(label="Rounded corners") self.noncopper_rounded_cb.setToolTip( "Creates a Geometry objects with polygons\n" "covering the copper-free areas of the PCB.") grid3.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2) ## Bounding box self.boundingbox_label = QLabel('<b>Bounding Box:</b>') self.layout.addWidget(self.boundingbox_label) grid4 = QGridLayout() self.layout.addLayout(grid4) bbmargin = QLabel('Boundary Margin:') bbmargin.setToolTip("Distance of the edges of the box\n" "to the nearest polygon.") grid4.addWidget(bbmargin, 0, 0) self.bbmargin_entry = LengthEntry() grid4.addWidget(self.bbmargin_entry, 0, 1) self.bbrounded_cb = FCCheckBox(label="Rounded corners") self.bbrounded_cb.setToolTip("If the bounding box is \n" "to have rounded corners\n" "their radius is equal to\n" "the margin.") grid4.addWidget(self.bbrounded_cb, 1, 0, 1, 2)