Просмотр исходного кода

- updated Paint Tool for the new Tool DB
- updated the Tcl commands CopperClear and Paint

Marius Stanciu 5 лет назад
Родитель
Сommit
935d556c93
4 измененных файлов с 396 добавлено и 693 удалено
  1. 2 0
      CHANGELOG.md
  2. 321 647
      flatcamTools/ToolPaint.py
  3. 45 25
      tclCommands/TclCommandCopperClear.py
  4. 28 21
      tclCommands/TclCommandPaint.py

+ 2 - 0
CHANGELOG.md

@@ -20,6 +20,8 @@ CHANGELOG for FlatCAM beta
 - updated the Readme file with the steps for installation for MacOS
 - updated the Readme file with the steps for installation for MacOS
 - updated the requirements.txt file
 - updated the requirements.txt file
 - updated some of the icons in the dark_resources folder (some added, some modified)
 - updated some of the icons in the dark_resources folder (some added, some modified)
+- updated Paint Tool for the new Tool DB
+- updated the Tcl commands CopperClear and Paint
 
 
 23.04.2020 
 23.04.2020 
 
 

Разница между файлами не показана из-за своего большого размера
+ 321 - 647
flatcamTools/ToolPaint.py


+ 45 - 25
tclCommands/TclCommandCopperClear.py

@@ -122,8 +122,21 @@ class TclCommandCopperClear(TclCommand):
 
 
         if 'method' in args:
         if 'method' in args:
             method = args['method']
             method = args['method']
+            if method == "standard":
+                method_data = _("Standard")
+            elif method == "seed":
+                method_data = _("Seed")
+            else:
+                method_data = _("Lines")
         else:
         else:
             method = str(self.app.defaults["tools_nccmethod"])
             method = str(self.app.defaults["tools_nccmethod"])
+            method_data = method
+            if method == _("Standard"):
+                method = "standard"
+            elif method == _("Seed"):
+                method = "seed"
+            else:
+                method = "lines"
 
 
         if 'connect' in args:
         if 'connect' in args:
             try:
             try:
@@ -155,11 +168,34 @@ class TclCommandCopperClear(TclCommand):
         except AttributeError:
         except AttributeError:
             tools = [float(tooldia)]
             tools = [float(tooldia)]
 
 
+        if 'rest' in args:
+            try:
+                par = args['rest'].capitalize()
+            except AttributeError:
+                par = args['rest']
+            rest = bool(eval(par))
+        else:
+            rest = bool(eval(str(self.app.defaults["tools_nccrest"])))
+
+        if 'outname' in args:
+            outname = args['outname']
+        else:
+            if rest is True:
+                outname = name + "_ncc"
+            else:
+                outname = name + "_ncc_rm"
+
+        # used only to have correct information's in the obj.tools[tool]['data'] dict
+        if "all" in args:
+            select = _("Itself")
+        else:
+            select = _("Reference Object")
+
         # store here the default data for Geometry Data
         # store here the default data for Geometry Data
         default_data = {}
         default_data = {}
         default_data.update({
         default_data.update({
-            "name": '_paint',
-            "plot": self.app.defaults["geometry_plot"],
+            "name": outname,
+            "plot": False,
             "cutz": self.app.defaults["geometry_cutz"],
             "cutz": self.app.defaults["geometry_cutz"],
             "vtipdia": 0.1,
             "vtipdia": 0.1,
             "vtipangle": 30,
             "vtipangle": 30,
@@ -183,12 +219,12 @@ class TclCommandCopperClear(TclCommand):
             "startz": self.app.defaults["geometry_startz"],
             "startz": self.app.defaults["geometry_startz"],
 
 
             "tooldia": self.app.defaults["tools_painttooldia"],
             "tooldia": self.app.defaults["tools_painttooldia"],
-            "paintmargin": self.app.defaults["tools_paintmargin"],
-            "paintmethod": self.app.defaults["tools_paintmethod"],
-            "selectmethod": self.app.defaults["tools_selectmethod"],
-            "pathconnect": self.app.defaults["tools_pathconnect"],
-            "paintcontour": self.app.defaults["tools_paintcontour"],
-            "paintoverlap": self.app.defaults["tools_paintoverlap"]
+            "tools_nccmargin": margin,
+            "tools_nccmethod": method_data,
+            "tools_nccref": select,
+            "tools_nccconnect": connect,
+            "tools_ncccontour": contour,
+            "tools_nccoverlap": overlap
         })
         })
         ncc_tools = {}
         ncc_tools = {}
 
 
@@ -206,23 +242,7 @@ class TclCommandCopperClear(TclCommand):
                     'solid_geometry': []
                     'solid_geometry': []
                 }
                 }
             })
             })
-
-        if 'rest' in args:
-            try:
-                par = args['rest'].capitalize()
-            except AttributeError:
-                par = args['rest']
-            rest = bool(eval(par))
-        else:
-            rest = bool(eval(str(self.app.defaults["tools_nccrest"])))
-
-        if 'outname' in args:
-            outname = args['outname']
-        else:
-            if rest is True:
-                outname = name + "_ncc"
-            else:
-                outname = name + "_ncc_rm"
+            ncc_tools[int(tooluid)]['data']['tooldia'] = float('%.*f' % (obj.decimals, tool))
 
 
         # Non-Copper clear all polygons in the non-copper clear object
         # Non-Copper clear all polygons in the non-copper clear object
         if 'all' in args:
         if 'all' in args:

+ 28 - 21
tclCommands/TclCommandPaint.py

@@ -66,7 +66,7 @@ class TclCommandPaint(TclCommand):
                       '"no" -> the order used is the one provided.'
                       '"no" -> the order used is the one provided.'
                       '"fwd" -> tools are ordered from smallest to biggest.'
                       '"fwd" -> tools are ordered from smallest to biggest.'
                       '"rev" -> tools are ordered from biggest to smallest.'),
                       '"rev" -> tools are ordered from biggest to smallest.'),
-            ('method', 'Algorithm for painting. Can be: "standard", "seed" or "lines".'),
+            ('method', 'Algorithm for painting. Can be: "standard", "seed", "lines", "laser_lines", "combo".'),
             ('connect', 'Draw lines to minimize tool lifts. True (1) or False (0)'),
             ('connect', 'Draw lines to minimize tool lifts. True (1) or False (0)'),
             ('contour', 'Cut around the perimeter of the painting. True (1) or False (0)'),
             ('contour', 'Cut around the perimeter of the painting. True (1) or False (0)'),
             ('all', 'If used, paint all polygons in the object.'),
             ('all', 'If used, paint all polygons in the object.'),
@@ -121,6 +121,16 @@ class TclCommandPaint(TclCommand):
 
 
         if 'method' in args:
         if 'method' in args:
             method = args['method']
             method = args['method']
+            if method == "standard":
+                method = _("Standard")
+            elif method == "seed":
+                method = _("Seed")
+            elif method == "lines":
+                method = _("Lines")
+            elif method == "laser_lines":
+                method = _("Laser_lines")
+            else:
+                method = _("Combo")
         else:
         else:
             method = str(self.app.defaults["tools_paintmethod"])
             method = str(self.app.defaults["tools_paintmethod"])
 
 
@@ -147,6 +157,14 @@ class TclCommandPaint(TclCommand):
         else:
         else:
             outname = name + "_paint"
             outname = name + "_paint"
 
 
+        # used only to have correct information's in the obj.tools[tool]['data'] dict
+        if "all" in args:
+            select = _("All Polygons")
+        elif "single" in args:
+            select = _("Polygon Selection")
+        else:
+            select = _("Reference Object")
+
         try:
         try:
             tools = [float(eval(dia)) for dia in tooldia.split(",") if dia != '']
             tools = [float(eval(dia)) for dia in tooldia.split(",") if dia != '']
         except AttributeError:
         except AttributeError:
@@ -154,8 +172,8 @@ class TclCommandPaint(TclCommand):
         # store here the default data for Geometry Data
         # store here the default data for Geometry Data
         default_data = {}
         default_data = {}
         default_data.update({
         default_data.update({
-            "name": '_paint',
-            "plot": self.app.defaults["geometry_plot"],
+            "name": outname,
+            "plot": False,
             "cutz": self.app.defaults["geometry_cutz"],
             "cutz": self.app.defaults["geometry_cutz"],
             "vtipdia": 0.1,
             "vtipdia": 0.1,
             "vtipangle": 30,
             "vtipangle": 30,
@@ -180,12 +198,12 @@ class TclCommandPaint(TclCommand):
             "startz": self.app.defaults["geometry_startz"],
             "startz": self.app.defaults["geometry_startz"],
 
 
             "tooldia": self.app.defaults["tools_painttooldia"],
             "tooldia": self.app.defaults["tools_painttooldia"],
-            "paintmargin": self.app.defaults["tools_paintmargin"],
-            "paintmethod": self.app.defaults["tools_paintmethod"],
-            "selectmethod": self.app.defaults["tools_selectmethod"],
-            "pathconnect": self.app.defaults["tools_pathconnect"],
-            "paintcontour": self.app.defaults["tools_paintcontour"],
-            "paintoverlap": self.app.defaults["tools_paintoverlap"]
+            "paintmargin": margin,
+            "paintmethod": method,
+            "selectmethod": select,
+            "pathconnect": connect,
+            "paintcontour": contour,
+            "paintoverlap": overlap
         })
         })
         paint_tools = {}
         paint_tools = {}
 
 
@@ -203,6 +221,7 @@ class TclCommandPaint(TclCommand):
                     'solid_geometry': []
                     'solid_geometry': []
                 }
                 }
             })
             })
+            paint_tools[int(tooluid)]['data']['tooldia'] = float('%.*f' % (obj.decimals, tool))
 
 
         if obj is None:
         if obj is None:
             return "Object not found: %s" % name
             return "Object not found: %s" % name
@@ -211,13 +230,9 @@ class TclCommandPaint(TclCommand):
         if 'all' in args:
         if 'all' in args:
             self.app.paint_tool.paint_poly_all(obj=obj,
             self.app.paint_tool.paint_poly_all(obj=obj,
                                                tooldia=tooldia,
                                                tooldia=tooldia,
-                                               overlap=overlap,
                                                order=order,
                                                order=order,
-                                               margin=margin,
                                                method=method,
                                                method=method,
                                                outname=outname,
                                                outname=outname,
-                                               connect=connect,
-                                               contour=contour,
                                                tools_storage=paint_tools,
                                                tools_storage=paint_tools,
                                                plot=False,
                                                plot=False,
                                                run_threaded=False)
                                                run_threaded=False)
@@ -234,13 +249,9 @@ class TclCommandPaint(TclCommand):
                 self.app.paint_tool.paint_poly(obj=obj,
                 self.app.paint_tool.paint_poly(obj=obj,
                                                inside_pt=[x, y],
                                                inside_pt=[x, y],
                                                tooldia=tooldia,
                                                tooldia=tooldia,
-                                               overlap=overlap,
                                                order=order,
                                                order=order,
-                                               margin=margin,
                                                method=method,
                                                method=method,
                                                outname=outname,
                                                outname=outname,
-                                               connect=connect,
-                                               contour=contour,
                                                tools_storage=paint_tools,
                                                tools_storage=paint_tools,
                                                plot=False,
                                                plot=False,
                                                run_threaded=False)
                                                run_threaded=False)
@@ -264,13 +275,9 @@ class TclCommandPaint(TclCommand):
             self.app.paint_tool.paint_poly_ref(obj=obj,
             self.app.paint_tool.paint_poly_ref(obj=obj,
                                                sel_obj=box_obj,
                                                sel_obj=box_obj,
                                                tooldia=tooldia,
                                                tooldia=tooldia,
-                                               overlap=overlap,
                                                order=order,
                                                order=order,
-                                               margin=margin,
                                                method=method,
                                                method=method,
                                                outname=outname,
                                                outname=outname,
-                                               connect=connect,
-                                               contour=contour,
                                                tools_storage=paint_tools,
                                                tools_storage=paint_tools,
                                                plot=False,
                                                plot=False,
                                                run_threaded=False)
                                                run_threaded=False)

Некоторые файлы не были показаны из-за большого количества измененных файлов