Przeglądaj źródła

- fixed issue in ToolPaint that could not allow area painting of a geometry that was a list and not a Geometric element (polygon or MultiPolygon)
- fixed UI showing before the initialization of FlatCAM is finished when the last state of GUI was maximized
- finished updating the TclCommand cncjob to work for multi-geo Geometry objects with the parameters from the args

Marius Stanciu 6 lat temu
rodzic
commit
30f00abce8
6 zmienionych plików z 68 dodań i 41 usunięć
  1. 7 13
      FlatCAM.py
  2. 6 9
      FlatCAMApp.py
  3. 13 13
      FlatCAMObj.py
  4. 3 0
      README.md
  5. 1 1
      flatcamTools/ToolPaint.py
  6. 38 5
      tclCommands/TclCommandCncjob.py

+ 7 - 13
FlatCAM.py

@@ -58,19 +58,13 @@ if __name__ == '__main__':
     else:
         app.setAttribute(Qt.AA_EnableHighDpiScaling, False)
 
-    # Create and display the splash screen
-    # from here: https://eli.thegreenplace.net/2009/05/09/creating-splash-screens-in-pyqt
-    # splash_pix = QtGui.QPixmap('share/splash.png')
-    # splash = QtWidgets.QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
-    # # splash.setMask(splash_pix.mask())
-    # splash.show()
-    # app.processEvents()
-    # splash.showMessage("FlatCAM is initializing ...",
-    #                    alignment=Qt.AlignBottom | Qt.AlignLeft,
-    #                    color=QtGui.QColor("gray"))
-
     fc = App()
-    # splash.finish(fc.ui)
-    fc.ui.show()
+
+    if settings.contains("maximized_gui"):
+        maximized_ui = settings.value('maximized_gui', type=bool)
+        if maximized_ui is True:
+            fc.ui.showMaximized()
+        else:
+            fc.ui.show()
 
     sys.exit(app.exec_())

+ 6 - 9
FlatCAMApp.py

@@ -2322,6 +2322,9 @@ class App(QtCore.QObject):
 
         self.set_ui_title(name=_("New Project - Not saved"))
 
+        # finish the splash
+        # splash.finish(self.ui)
+
         # ###############################################################################
         # ####################### Finished the CONSTRUCTOR ##############################
         # ###############################################################################
@@ -6493,7 +6496,7 @@ class App(QtCore.QObject):
 
         # Switch plot_area to preferences page
         self.ui.plot_tab_area.setCurrentWidget(self.ui.preferences_tab)
-        self.ui.show()
+        # self.ui.show()
 
         # this disconnect() is done so the slot will be connected only once
         try:
@@ -6948,7 +6951,7 @@ class App(QtCore.QObject):
 
         # Switch plot_area to preferences page
         self.ui.plot_tab_area.setCurrentWidget(self.ui.shortcuts_tab)
-        self.ui.show()
+        # self.ui.show()
 
     def on_select_tab(self, name):
         # if the splitter is hidden, display it, else hide it but only if the current widget is the same
@@ -8320,7 +8323,7 @@ class App(QtCore.QObject):
                     self.ui.code_editor.moveCursor(QtGui.QTextCursor.Start)
 
                     self.handleTextChanged()
-                    self.ui.show()
+                    # self.ui.show()
 
             except Exception as e:
                 log.debug("App.on_fileopenscript() -> %s" % str(e))
@@ -9672,12 +9675,6 @@ class App(QtCore.QObject):
                                 self.defaults["global_def_win_w"],
                                 self.defaults["global_def_win_h"])
             self.ui.splitter.setSizes([self.defaults["global_def_notebook_width"], 0])
-
-            settings = QSettings("Open Source", "FlatCAM")
-            if settings.contains("maximized_gui"):
-                maximized_ui = settings.value('maximized_gui', type=bool)
-                if maximized_ui is True:
-                    self.ui.showMaximized()
         except KeyError as e:
             log.debug("App.restore_main_win_geom() --> %s" % str(e))
 

+ 13 - 13
FlatCAMObj.py

@@ -3247,10 +3247,10 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
             "depthperpass": 0.002,
             "extracut": False,
             "endz": 2.0,
+            "startz": None,
             "toolchange": False,
             "toolchangez": 1.0,
             "toolchangexy": "0.0, 0.0",
-            "startz": None,
             "ppname_g": 'default',
             "z_pdepth": -0.02,
             "feedrate_probe": 3.0,
@@ -4893,18 +4893,18 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
             else:
                 self.app.new_object("cncjob", outname, job_init_multi_geometry)
 
-    def generatecncjob(self, outname=None,
-                       tooldia=None, offset=None,
-                       z_cut=None, z_move=None,
-                       feedrate=None, feedrate_z=None, feedrate_rapid=None,
-                       spindlespeed=None, dwell=None, dwelltime=None,
-                       multidepth=None, depthperpass=None,
-                       toolchange=None, toolchangez=None, toolchangexy=None,
-                       extracut=None, startz=None, endz=None,
-                       ppname_g=None,
-                       segx=None,
-                       segy=None,
-                       use_thread=True):
+    def generatecncjob(
+            self, outname=None,
+            tooldia=None, offset=None,
+            z_cut=None, z_move=None,
+            feedrate=None, feedrate_z=None, feedrate_rapid=None,
+            spindlespeed=None, dwell=None, dwelltime=None,
+            multidepth=None, depthperpass=None,
+            toolchange=None, toolchangez=None, toolchangexy=None,
+            extracut=None, startz=None, endz=None,
+            ppname_g=None,
+            segx=None, segy=None,
+            use_thread=True):
         """
         Only used for TCL Command.
         Creates a CNCJob out of this Geometry object. The actual

+ 3 - 0
README.md

@@ -14,6 +14,9 @@ CAD program, and create G-Code for Isolation routing.
 - refactored FlatCAMGeometry.mtool_gen_cncjob() method
 - fixed the TclCommandCncjob to work for multigeometry Geometry objects; still I had to fix the list of tools parameter, right now I am setting it to an empty list
 - update the Tcl Command isolate to be able to isolate exteriors, interiors besides the full isolation, using the iso_type parameter
+- fixed issue in ToolPaint that could not allow area painting of a geometry that was a list and not a Geometric element (polygon or MultiPolygon)
+- fixed UI showing before the initialization of FlatCAM is finished when the last state of GUI was maximized
+- finished updating the TclCommand cncjob to work for multi-geo Geometry objects with the parameters from the args
 
 14.09.2019
 

+ 1 - 1
flatcamTools/ToolPaint.py

@@ -2057,7 +2057,7 @@ class ToolPaint(FlatCAMTool, Gerber):
                 pass
 
             # this is were heavy lifting is done and creating the geometry to be painted
-            target_geo = obj.solid_geometry
+            target_geo = MultiPolygon(obj.solid_geometry)
 
             if isinstance(obj, FlatCAMGerber):
                 if self.app.defaults["tools_paint_plotting"] == 'progressive':

+ 38 - 5
tclCommands/TclCommandCncjob.py

@@ -98,21 +98,33 @@ class TclCommandCncjob(TclCommandSignaled):
         if not isinstance(obj, FlatCAMGeometry):
             self.raise_tcl_error('Expected FlatCAMGeometry, got %s %s.' % (str(name), type(obj)))
 
+        args["tooldia"] = args["tooldia"] if "tooldia" in args else obj.options["cnctooldia"]
+
         args["z_cut"] = args["z_cut"] if "z_cut" in args else obj.options["cutz"]
         args["z_move"] = args["z_move"] if "z_move" in args else obj.options["travelz"]
+
         args["feedrate"] = args["feedrate"] if "feedrate" in args else obj.options["feedrate"]
+        args["feedrate_z"] = args["feedrate_z"] if "feedrate_z" in args else obj.options["feedrate_z"]
         args["feedrate_rapid"] = args["feedrate_rapid"] if "feedrate_rapid" in args else obj.options["feedrate_rapid"]
-        args["spindlespeed"] = args["spindlespeed"] if "spindlespeed" in args else None
-        args["tooldia"] = args["tooldia"] if "tooldia" in args else obj.options["cnctooldia"]
+
         args["multidepth"] = args["multidepth"] if "multidepth" in args else obj.options["multidepth"]
-        args["depthperpass"] = args["depthperpass"] if "depthperpass" in args else obj.options["depthperpass"]
         args["extracut"] = args["extracut"] if "extracut" in args else obj.options["extracut"]
+        args["depthperpass"] = args["depthperpass"] if "depthperpass" in args else obj.options["depthperpass"]
+
+        args["startz"] = args["startz"] if "startz" in args else \
+            self.app.defaults["geometry_startz"]
         args["endz"] = args["endz"] if "endz" in args else obj.options["endz"]
+
+        args["spindlespeed"] = args["spindlespeed"] if "spindlespeed" in args else None
+        args["dwell"] = args["dwell"] if "dwell" in args else obj.options["dwell"]
+        args["dwelltime"] = args["dwelltime"] if "dwelltime" in args else obj.options["dwelltime"]
+
         args["ppname_g"] = args["ppname_g"] if "ppname_g" in args else obj.options["ppname_g"]
 
         args["toolchange"] = True if "toolchange" in args and args["toolchange"] == 1 else False
         args["toolchangez"] = args["toolchangez"] if "toolchangez" in args else obj.options["toolchangez"]
-        args["toolchangexy"] = args["toolchangexy"] if "toolchangexy" in args else obj.options["toolchangexy"]
+        args["toolchangexy"] = args["toolchangexy"] if "toolchangexy" in args else \
+            self.app.defaults["geometry_toolchangexy"]
 
         del args['name']
 
@@ -122,7 +134,28 @@ class TclCommandCncjob(TclCommandSignaled):
         if not obj.multigeo:
             obj.generatecncjob(use_thread=False, **args)
         else:
-            # TODO: needs to update the local_tools_dict values with the args value
+            # Update the local_tools_dict values with the args value
             local_tools_dict = deepcopy(obj.tools)
+
+            for tool_uid in list(local_tools_dict.keys()):
+                if 'data' in local_tools_dict[tool_uid]:
+                    local_tools_dict[tool_uid]['data']['cutz'] = args["z_cut"]
+                    local_tools_dict[tool_uid]['data']['travelz'] = args["z_move"]
+                    local_tools_dict[tool_uid]['data']['feedrate'] = args["feedrate"]
+                    local_tools_dict[tool_uid]['data']['feedrate_z'] = args["feedrate_z"]
+                    local_tools_dict[tool_uid]['data']['feedrate_rapid'] = args["feedrate_rapid"]
+                    local_tools_dict[tool_uid]['data']['multidepth'] = args["multidepth"]
+                    local_tools_dict[tool_uid]['data']['extracut'] = args["extracut"]
+                    local_tools_dict[tool_uid]['data']['depthperpass'] = args["depthperpass"]
+                    local_tools_dict[tool_uid]['data']['toolchange'] = args["toolchange"]
+                    local_tools_dict[tool_uid]['data']['toolchangez'] = args["toolchangez"]
+                    local_tools_dict[tool_uid]['data']['toolchangexy'] = args["toolchangexy"]
+                    local_tools_dict[tool_uid]['data']['startz'] = args["startz"]
+                    local_tools_dict[tool_uid]['data']['endz'] = args["endz"]
+                    local_tools_dict[tool_uid]['data']['spindlespeed'] = args["spindlespeed"]
+                    local_tools_dict[tool_uid]['data']['dwell'] = args["dwell"]
+                    local_tools_dict[tool_uid]['data']['dwelltime'] = args["dwelltime"]
+                    local_tools_dict[tool_uid]['data']['ppname_g'] = args["ppname_g"]
+                    print(local_tools_dict[tool_uid]['data'])
             obj.mtool_gen_cncjob(tools_dict=local_tools_dict, tools_in_use=[], use_thread=False)
             # self.raise_tcl_error('The object is a multi-geo geometry which is not supported in cncjob Tcl Command')