diff --git a/FlatCAMApp.py b/FlatCAMApp.py index a984366f..deab459c 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -439,7 +439,15 @@ class App(QtCore.QObject): "tools_panelize_rows": self.tools_defaults_form.tools_panelize_group.prows, "tools_panelize_constrain": self.tools_defaults_form.tools_panelize_group.pconstrain_cb, "tools_panelize_constrainx": self.tools_defaults_form.tools_panelize_group.px_width_entry, - "tools_panelize_constrainy": self.tools_defaults_form.tools_panelize_group.py_height_entry + "tools_panelize_constrainy": self.tools_defaults_form.tools_panelize_group.py_height_entry, + + "tools_calc_vshape_tip_dia": self.tools_defaults_form.tools_calculators_group.tip_dia_entry, + "tools_calc_vshape_tip_angle": self.tools_defaults_form.tools_calculators_group.tip_angle_entry, + "tools_calc_vshape_cut_z": self.tools_defaults_form.tools_calculators_group.cut_z_entry, + "tools_calc_electro_length": self.tools_defaults_form.tools_calculators_group.pcblength_entry, + "tools_calc_electro_width": self.tools_defaults_form.tools_calculators_group.pcbwidth_entry, + "tools_calc_electro_cdensity": self.tools_defaults_form.tools_calculators_group.cdensity_entry, + "tools_calc_electro_growth": self.tools_defaults_form.tools_calculators_group.growth_entry } # loads postprocessors self.postprocessors = load_postprocessors(self) @@ -625,7 +633,15 @@ class App(QtCore.QObject): "tools_panelize_rows": 1, "tools_panelize_constrain": False, "tools_panelize_constrainx": 0.0, - "tools_panelize_constrainy": 0.0 + "tools_panelize_constrainy": 0.0, + + "tools_calc_vshape_tip_dia": 0.007874, + "tools_calc_vshape_tip_angle": 30, + "tools_calc_vshape_cut_z": 0.000787, + "tools_calc_electro_length": 10.0, + "tools_calc_electro_width": 10.0, + "tools_calc_electro_cdensity":13.0, + "tools_calc_electro_growth": 10.0 }) ############################### diff --git a/FlatCAMGUI.py b/FlatCAMGUI.py index ec23266e..9065d647 100644 --- a/FlatCAMGUI.py +++ b/FlatCAMGUI.py @@ -644,7 +644,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.options_combo.setVisible(False) self.hlay1.addStretch() - self.general_scroll_area = VerticalScrollArea() + self.general_scroll_area = QtWidgets.QScrollArea() self.general_tab_lay.addWidget(self.general_scroll_area) self.gerber_tab = QtWidgets.QWidget() @@ -653,7 +653,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.gerber_tab_lay.setContentsMargins(2, 2, 2, 2) self.gerber_tab.setLayout(self.gerber_tab_lay) - self.gerber_scroll_area = VerticalScrollArea() + self.gerber_scroll_area = QtWidgets.QScrollArea() self.gerber_tab_lay.addWidget(self.gerber_scroll_area) self.excellon_tab = QtWidgets.QWidget() @@ -662,7 +662,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.excellon_tab_lay.setContentsMargins(2, 2, 2, 2) self.excellon_tab.setLayout(self.excellon_tab_lay) - self.excellon_scroll_area = VerticalScrollArea() + self.excellon_scroll_area = QtWidgets.QScrollArea() self.excellon_tab_lay.addWidget(self.excellon_scroll_area) self.geometry_tab = QtWidgets.QWidget() @@ -671,7 +671,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.geometry_tab_lay.setContentsMargins(2, 2, 2, 2) self.geometry_tab.setLayout(self.geometry_tab_lay) - self.geometry_scroll_area = VerticalScrollArea() + self.geometry_scroll_area = QtWidgets.QScrollArea() self.geometry_tab_lay.addWidget(self.geometry_scroll_area) self.cncjob_tab = QtWidgets.QWidget() @@ -680,7 +680,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.cncjob_tab_lay.setContentsMargins(2, 2, 2, 2) self.cncjob_tab.setLayout(self.cncjob_tab_lay) - self.cncjob_scroll_area = VerticalScrollArea() + self.cncjob_scroll_area = QtWidgets.QScrollArea() self.cncjob_tab_lay.addWidget(self.cncjob_scroll_area) self.tools_tab = QtWidgets.QWidget() @@ -689,7 +689,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.tools_tab_lay.setContentsMargins(2, 2, 2, 2) self.tools_tab.setLayout(self.tools_tab_lay) - self.tools_scroll_area = VerticalScrollArea() + self.tools_scroll_area = QtWidgets.QScrollArea() self.tools_tab_lay.addWidget(self.tools_scroll_area) self.pref_tab_bottom_layout = QtWidgets.QHBoxLayout() @@ -2352,21 +2352,24 @@ class ToolsPreferencesUI(QtWidgets.QWidget): self.setLayout(self.layout) self.tools_ncc_group = ToolsNCCPrefGroupUI() - self.tools_ncc_group.setFixedWidth(200) + self.tools_ncc_group.setMinimumWidth(200) self.tools_paint_group = ToolsPaintPrefGroupUI() - self.tools_paint_group.setFixedWidth(200) + self.tools_paint_group.setMinimumWidth(200) self.tools_cutout_group = ToolsCutoutPrefGroupUI() - self.tools_cutout_group.setFixedWidth(220) + self.tools_cutout_group.setMinimumWidth(220) self.tools_2sided_group = Tools2sidedPrefGroupUI() - self.tools_2sided_group.setFixedWidth(220) + self.tools_2sided_group.setMinimumWidth(220) self.tools_film_group = ToolsFilmPrefGroupUI() - self.tools_film_group.setFixedWidth(220) + self.tools_film_group.setMinimumWidth(220) self.tools_panelize_group = ToolsPanelizePrefGroupUI() - self.tools_panelize_group.setFixedWidth(200) + self.tools_panelize_group.setMinimumWidth(220) + + self.tools_calculators_group = ToolsCalculatorsPrefGroupUI() + self.tools_calculators_group.setMinimumWidth(220) self.vlay = QtWidgets.QVBoxLayout() self.vlay.addWidget(self.tools_ncc_group) @@ -2379,6 +2382,7 @@ class ToolsPreferencesUI(QtWidgets.QWidget): self.vlay2 = QtWidgets.QVBoxLayout() self.vlay2.addWidget(self.tools_panelize_group) + self.vlay2.addWidget(self.tools_calculators_group) self.layout.addLayout(self.vlay) self.layout.addLayout(self.vlay1) @@ -2386,6 +2390,7 @@ class ToolsPreferencesUI(QtWidgets.QWidget): self.layout.addStretch() + class CNCJobPreferencesUI(QtWidgets.QWidget): def __init__(self, parent=None): @@ -3409,8 +3414,8 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI): grid2.addWidget(self.excellon_gcode_type_radio, 16, 1) # until I decide to implement this feature those remain disabled - excellon_gcode_type_label.setDisabled(True) - self.excellon_gcode_type_radio.setDisabled(True) + excellon_gcode_type_label.hide() + self.excellon_gcode_type_radio.setVisible(False) #### Milling Holes #### self.mill_hole_label = QtWidgets.QLabel('Mill Holes') @@ -4368,6 +4373,103 @@ class ToolsPanelizePrefGroupUI(OptionsGroupUI): self.layout.addStretch() +class ToolsCalculatorsPrefGroupUI(OptionsGroupUI): + def __init__(self, parent=None): + # OptionsGroupUI.__init__(self, "Calculators Tool Options", parent=parent) + super(ToolsCalculatorsPrefGroupUI, self).__init__(self) + + self.setTitle(str("Calculators Tool Options")) + + ## V-shape Calculator Tool + self.vshape_tool_label = QtWidgets.QLabel("V-Shape Tool Calculator:") + self.vshape_tool_label.setToolTip( + "Calculate the tool diameter for a given V-shape tool,\n" + "having the tip diameter, tip angle and\n" + "depth-of-cut as parameters." + ) + self.layout.addWidget(self.vshape_tool_label) + + grid0 = QtWidgets.QGridLayout() + self.layout.addLayout(grid0) + + ## Tip Diameter + self.tip_dia_entry = FCEntry() + self.tip_dia_label = QtWidgets.QLabel("Tip Diameter:") + self.tip_dia_label.setToolTip( + "This is the tool tip diameter.\n" + "It is specified by manufacturer." + ) + grid0.addWidget(self.tip_dia_label, 0, 0) + grid0.addWidget(self.tip_dia_entry, 0, 1) + + ## Tip angle + self.tip_angle_entry = FCEntry() + self.tip_angle_label = QtWidgets.QLabel("Tip angle:") + self.tip_angle_label.setToolTip( + "This is the angle on the tip of the tool.\n" + "It is specified by manufacturer." + ) + grid0.addWidget(self.tip_angle_label, 1, 0) + grid0.addWidget(self.tip_angle_entry, 1, 1) + + ## Depth-of-cut Cut Z + self.cut_z_entry = FCEntry() + self.cut_z_label = QtWidgets.QLabel("Cut Z:") + self.cut_z_label.setToolTip( + "This is depth to cut into material.\n" + "In the CNCJob object it is the CutZ parameter." + ) + grid0.addWidget(self.cut_z_label, 2, 0) + grid0.addWidget(self.cut_z_entry, 2, 1) + + ## Electroplating Calculator Tool + self.plate_title_label = QtWidgets.QLabel("ElectroPlating Calculator:") + self.plate_title_label.setToolTip( + "This calculator is useful for those who plate the via/pad/drill holes,\n" + "using a method like grahite ink or calcium hypophosphite ink or palladium chloride." + ) + self.layout.addWidget(self.plate_title_label) + + grid1 = QtWidgets.QGridLayout() + self.layout.addLayout(grid1) + + ## PCB Length + self.pcblength_entry = FCEntry() + self.pcblengthlabel = QtWidgets.QLabel("Board Length:") + + self.pcblengthlabel.setToolTip('This is the board length. In centimeters.') + grid1.addWidget(self.pcblengthlabel, 0, 0) + grid1.addWidget(self.pcblength_entry, 0, 1) + + ## PCB Width + self.pcbwidth_entry = FCEntry() + self.pcbwidthlabel = QtWidgets.QLabel("Board Width:") + + self.pcbwidthlabel.setToolTip('This is the board width.In centimeters.') + grid1.addWidget(self.pcbwidthlabel, 1, 0) + grid1.addWidget(self.pcbwidth_entry, 1, 1) + + ## Current Density + self.cdensity_label = QtWidgets.QLabel("Current Density:") + self.cdensity_entry = FCEntry() + + self.cdensity_label.setToolTip("Current density to pass through the board. \n" + "In Amps per Square Feet ASF.") + grid1.addWidget(self.cdensity_label, 2, 0) + grid1.addWidget(self.cdensity_entry, 2, 1) + + ## PCB Copper Growth + self.growth_label = QtWidgets.QLabel("Copper Growth:") + self.growth_entry = FCEntry() + + self.growth_label.setToolTip("How thick the copper growth is intended to be.\n" + "In microns.") + grid1.addWidget(self.growth_label, 3, 0) + grid1.addWidget(self.growth_entry, 3, 1) + + self.layout.addStretch() + + class FlatCAMActivityView(QtWidgets.QWidget): def __init__(self, parent=None): diff --git a/ObjectUI.py b/ObjectUI.py index 0832a430..54e97c42 100644 --- a/ObjectUI.py +++ b/ObjectUI.py @@ -611,7 +611,8 @@ class ExcellonObjectUI(ObjectUI): self.tools_box.addLayout(gcode_box) # temporary action until I finish the feature - self.excellon_gcode_type_radio.setEnabled(False) + self.excellon_gcode_type_radio.setVisible(False) + gcode_type_label.hide() self.generate_cnc_button = QtWidgets.QPushButton('Create GCode') self.generate_cnc_button.setToolTip( diff --git a/README.md b/README.md index 98d63e29..dbc03b4f 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ CAD program, and create G-Code for Isolation routing. 9.02.2019 - added a protection for when saving a file first time, it require a saved path and if none then it use the current working directory +- added into Preferences the Calculator Tools +- made the Preferences window scrollable on the horizontal side (it was only vertically scrollable before) 8.02.2019 diff --git a/flatcamTools/ToolCalculators.py b/flatcamTools/ToolCalculators.py index cd42881e..fc09ebd6 100644 --- a/flatcamTools/ToolCalculators.py +++ b/flatcamTools/ToolCalculators.py @@ -224,27 +224,31 @@ class ToolCalculator(FlatCAMTool): FlatCAMTool.install(self, icon, separator, shortcut='ALT+C', **kwargs) def set_tool_ui(self): + self.units = self.app.general_options_form.general_app_group.units_radio.get_value().upper() + ## Initialize form self.mm_entry.set_value('0') self.inch_entry.set_value('0') - self.pcblength_entry.set_value('10') - self.pcbwidth_entry.set_value('10') - self.cdensity_entry.set_value('13') - self.growth_entry.set_value('10') - self.cvalue_entry.set_value(2.80) - self.time_entry.set_value(33.0) + length = self.app.defaults["tools_calc_electro_length"] + width = self.app.defaults["tools_calc_electro_width"] + density = self.app.defaults["tools_calc_electro_cdensity"] + growth = self.app.defaults["tools_calc_electro_growth"] + self.pcblength_entry.set_value(length) + self.pcbwidth_entry.set_value(width) + self.cdensity_entry.set_value(density) + self.growth_entry.set_value(growth) + self.cvalue_entry.set_value(0.00) + self.time_entry.set_value(0.0) - if self.app.defaults["units"] == 'MM': - self.tipDia_entry.set_value('0.2') - self.tipAngle_entry.set_value('45') - self.cutDepth_entry.set_value('0.25') - self.effectiveToolDia_entry.set_value('0.39') - else: - self.tipDia_entry.set_value('7.87402') - self.tipAngle_entry.set_value('45') - self.cutDepth_entry.set_value('9.84252') - self.effectiveToolDia_entry.set_value('15.35433') + tip_dia = self.app.defaults["tools_calc_vshape_tip_dia"] + tip_angle = self.app.defaults["tools_calc_vshape_tip_angle"] + cut_z = self.app.defaults["tools_calc_vshape_cut_z"] + + self.tipDia_entry.set_value(tip_dia) + self.tipAngle_entry.set_value(tip_angle) + self.cutDepth_entry.set_value(cut_z) + self.effectiveToolDia_entry.set_value('0.0000') def on_calculate_tool_dia(self): # Calculation: