From 8d8a52271418c5a8db6fbcbe4c67c0fc44fb0196 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 28 Sep 2021 05:25:34 +0300 Subject: [PATCH] - changed the circle resolution back to the default of 16 since this value is good for fast rendering of Gerber files - added a shortcut to select all apertures in the Gerber Editor - other minor fixes --- CHANGELOG.md | 6 ++++ README.md | 33 ++++++++++++------- appEditors/AppGerberEditor.py | 61 ++++++++++++++++++++++++++++++----- appGUI/MainGUI.py | 5 +++ app_Main.py | 5 +-- defaults.py | 6 ++-- 6 files changed, 91 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db129ead..c089884f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ CHANGELOG for FlatCAM beta ================================================= +28.09.2021 + +- changed the circle resolution back to the default of 16 since this value is good for fast rendering of Gerber files +- added a shortcut to select all apertures in the Gerber Editor +- other minor fixes + 27.09.2021 - in Gerber Object trying to solve the issue with too little details on plotting geometry with inch units diff --git a/README.md b/README.md index a6762797..6bee2232 100644 --- a/README.md +++ b/README.md @@ -12,18 +12,20 @@ CAD program, and create G-Code for Isolation routing. -------------------------- Installation instructions ---------------- -Works with Python version 3.6 or greater and PyQt5. -More on the YouTube channel: https://www.youtube.com/playlist?list=PLVvP2SYRpx-AQgNlfoxw93tXUXon7G94_ +Works with Python version 3.6 or greater and PyQt6. +More on the YouTube channel: +https://www.youtube.com/playlist?list=PLVvP2SYRpx-AQgNlfoxw93tXUXon7G94_ You can contact me on my email address found in the app in: Menu -> Help -> About FlatCAM -> Programmers -> Marius Stanciu - Make sure that your OS is up-to-date - Download sources from: https://bitbucket.org/jpcgt/flatcam/downloads/ -- Unzip them on a HDD location that your user has permissions for. +- Unzip them on an HDD location that your user has permissions for. +************************************************************************** 1.Windows - +************************************************************************** - download the provided installer (for your OS flavor 64bit or 32bit) from: https://bitbucket.org/jpcgt/flatcam/downloads/ - execute the installer and install the program. It is recommended to install as a Local User. @@ -31,23 +33,28 @@ https://bitbucket.org/jpcgt/flatcam/downloads/ or from sources: - download the sources from the same location - unzip them on a safe location on your HDD that your user has permissions for -- install WinPython e.g WinPython 3.8 downloaded from here: https://sourceforge.net/projects/winpython/files/WinPython_3.8/ +- install WinPython e.g. WinPython 3.9 downloaded from here: +https://sourceforge.net/projects/winpython/files/WinPython_3.9/ Use one of the versions (64bit or 32it) that are compatible with your OS. -To save space use one of the versions that have the smaller size (they offer 2 versions: one with size of few hundred MB and one smaller with size of few tens of MB) +To save space use one of the versions that have the smaller size (they offer 2 versions: +one with size of few hundred MB and one smaller with size of few tens of MB) -- add Python folder and Python\Scripts folder to your Windows Path (https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ee537574(v%3Doffice.14)) +- add Python folder and Python\Scripts folder to your Windows Path +- (https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ee537574(v%3Doffice.14)) - verify that the pip package can be run by opening Command Prompt(Admin) and running the command: ``` pip -V ``` -- look in the requirements.txt file (found in the sources folder) and install all the dependencies using the pip package. +- look in the requirements.txt file (found in the sources folder) and install all the dependencies using +the pip package. The required wheels can be downloaded either from: https://www.lfd.uci.edu/~gohlke/pythonlibs/ (Recommended) or if the required modules cannot be found in the previous source use: https://pypi.org/ -You can download all the required wheels files into a folder (e.g D:\my_folder) and install them from Command Prompt like this: +You can download all the required wheels files into a folder (e.g D:\my_folder) and install them from +Command Prompt like this: ``` cd D:\my_folder @@ -62,7 +69,9 @@ Run FlatCAM beta from the installation folder (e.g D:\FlatCAM_beta) in the Comma cd D:\FlatCAM_beta python FlatCAM.py +************************************************************************** 2.Linux +************************************************************************** - create a folder to hold the sources somewhere on your HDD: mkdir FlatCAM-beta @@ -73,8 +82,8 @@ wget https://bitbucket.org/jpcgt/flatcam/downloads/FlatCAM_beta_8.995_sources.zi unzip FlatCAM_beta_8.995_sources.zip cd FlatCAM_beta_8.995_sources -- make sure that Python 3.8 is installed on your OS and that the command: python3 -V confirm it -- verify that the pip package is installed for your Python installation (e.g 3.8) by running the command: +- make sure that Python 3.9 is installed on your OS and that the command: python3 -V confirm it +- verify that the pip package is installed for your Python installation (e.g 3.9) by running the command: ``` pip3 -V ``` @@ -85,7 +94,7 @@ sudo apt-get install python3-pip ``` or: ``` -sudo apt-get install python3.8-pip +sudo apt-get install python3.9-pip ``` - verify that the file setup_ubuntu.sh has Linux line-endings (LF) and that it is executable (chmod +x setup_ubuntu.sh) - run the file setup_ubuntu.sh and install all the dependencies with the command: diff --git a/appEditors/AppGerberEditor.py b/appEditors/AppGerberEditor.py index 61736084..0767e4a4 100644 --- a/appEditors/AppGerberEditor.py +++ b/appEditors/AppGerberEditor.py @@ -3437,6 +3437,7 @@ class AppGerberEditor(QtCore.QObject): self.ui.delaperture_btn.clicked.connect(self.on_aperture_delete) self.ui.apertures_table.cellPressed.connect(self.on_row_selected) + self.ui.apertures_table.selectionModel().selectionChanged.connect(self.on_table_selection) self.ui.array_type_radio.activated_custom.connect(self.on_array_type_radio) self.ui.pad_axis_radio.activated_custom.connect(self.on_linear_angle_radio) @@ -4121,6 +4122,9 @@ class AppGerberEditor(QtCore.QObject): geo_el = geo['geo'] self.add_gerber_shape(DrawToolShape(geo_el), storage=stora) + is_sel_all = self.on_table_selection() + if is_sel_all: + return self.plot_all() self.app.worker_task.emit({'fcn': task_job, 'params': []}) @@ -5044,14 +5048,55 @@ class AppGerberEditor(QtCore.QObject): self.plot_all() - # def toolbar_tool_toggle(self, key): - # """ - # - # :param key: key to update in self.options dictionary - # :return: - # """ - # self.options[key] = self.sender().isChecked() - # return self.options[key] + def on_table_selection(self): + selected_rows = self.ui.apertures_table.selectionModel().selectedRows(0) + + if len(selected_rows) == self.ui.apertures_table.rowCount(): + for row in range(self.ui.apertures_table.rowCount()): + try: + selected_ap_code = int(self.ui.apertures_table.item(row, 1).text()) + self.last_aperture_selected = copy(selected_ap_code) + + for obj in self.storage_dict[selected_ap_code]['geometry']: + self.selected.append(obj) + except Exception as e: + self.app.log.error("AppGerberEditor.on_row_selected() --> %s" % str(e)) + + # ######################################################################################################### + # ######################### calculate vertex numbers for all selected shapes ############################## + # ######################################################################################################### + vertex_nr = 0 + for sha in self.selected: + sha_geo = sha.geo + if 'solid' in sha_geo: + sha_geo_solid = sha_geo['solid'] + if sha_geo_solid.geom_type == 'Polygon': + sha_geo_solid_coords = list(sha_geo_solid.exterior.coords) + elif sha_geo_solid.geom_type in ['LinearRing', 'LineString']: + sha_geo_solid_coords = list(sha_geo_solid.coords) + else: + sha_geo_solid_coords = [] + + vertex_nr += len(sha_geo_solid_coords) + + self.ui.geo_vertex_entry.set_value(vertex_nr) + + # ######################################################################################################### + # ######################### calculate total area for all selected shapes ################################## + # ######################################################################################################### + t_area = 0 + for sha in self.selected: + sha_geo = sha.geo + if 'solid' in sha_geo: + sha_geo_solid = sha_geo['solid'] + if sha_geo_solid.geom_type == 'Polygon': + t_area += sha_geo_solid.area + + self.ui.area_entry.set_value(t_area) + + self.plot_all() + return True + return False def on_grb_shape_complete(self, storage=None, specific_shape=None, no_plot=False): """ diff --git a/appGUI/MainGUI.py b/appGUI/MainGUI.py index 87d4c17e..549316ae 100644 --- a/appGUI/MainGUI.py +++ b/appGUI/MainGUI.py @@ -3594,6 +3594,11 @@ class MainGUI(QtWidgets.QMainWindow): elif self.app.call_source == 'grb_editor': # CTRL if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier: + # Select All + if key == QtCore.Qt.Key.Key_E or key == 'A': + self.app.grb_editor.ui.apertures_table.selectAll() + return + # Eraser Tool if key == QtCore.Qt.Key.Key_E or key == 'E': self.app.grb_editor.on_eraser() diff --git a/app_Main.py b/app_Main.py index 0f64fbd2..f00e7429 100644 --- a/app_Main.py +++ b/app_Main.py @@ -8228,7 +8228,8 @@ class App(QtCore.QObject): self.log.debug("Recent items list has been populated.") def on_properties_tab_click(self): - if self.ui.properties_scroll_area.widget().objectName() == 'default_properties': + tab_wdg = self.ui.properties_scroll_area.widget() + if tab_wdg and tab_wdg.objectName() == 'default_properties': self.setup_default_properties_tab() def setup_default_properties_tab(self): @@ -9043,7 +9044,7 @@ class MenuFileHandlers(QtCore.QObject): self.splash = self.app.splash self.worker_task = self.app.worker_task self.defaults = self.app.defaults - + self.app_units = self.app.app_units self.pagesize = {} self.app.new_project_signal.connect(self.on_new_project_house_keeping) diff --git a/defaults.py b/defaults.py index 85674c4d..c454bf23 100644 --- a/defaults.py +++ b/defaults.py @@ -165,7 +165,7 @@ class FlatCAMDefaults: "gerber_color_list": [], "gerber_store_color_list": True, - "gerber_circle_steps": 64, + "gerber_circle_steps": 16, "gerber_use_buffer_for_union": True, "gerber_clean_apertures": True, "gerber_extra_buffering": True, @@ -298,7 +298,7 @@ class FlatCAMDefaults: # Geometry General "geometry_plot": True, "geometry_multicolored": False, - "geometry_circle_steps": 64, + "geometry_circle_steps": 16, "geometry_merge_fuse_tools": True, "geometry_plot_line": "#FF0000", @@ -688,7 +688,7 @@ class FlatCAMDefaults: "tools_copper_thieving_area": 0.1, "tools_copper_thieving_reference": 'itself', "tools_copper_thieving_box_type": 'rect', - "tools_copper_thieving_circle_steps": 64, + "tools_copper_thieving_circle_steps": 16, "tools_copper_thieving_fill_type": 'solid', "tools_copper_thieving_dots_dia": 1.0, "tools_copper_thieving_dots_spacing": 2.0,