Browse Source

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

Marius Stanciu 5 năm trước cách đây
mục cha
commit
935d556c93
4 tập tin đã thay đổi với 396 bổ sung693 xóa
  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 requirements.txt file
 - 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 
 

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 321 - 647
flatcamTools/ToolPaint.py


+ 45 - 25
tclCommands/TclCommandCopperClear.py

@@ -122,8 +122,21 @@ class TclCommandCopperClear(TclCommand):
 
         if 'method' in args:
             method = args['method']
+            if method == "standard":
+                method_data = _("Standard")
+            elif method == "seed":
+                method_data = _("Seed")
+            else:
+                method_data = _("Lines")
         else:
             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:
             try:
@@ -155,11 +168,34 @@ class TclCommandCopperClear(TclCommand):
         except AttributeError:
             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
         default_data = {}
         default_data.update({
-            "name": '_paint',
-            "plot": self.app.defaults["geometry_plot"],
+            "name": outname,
+            "plot": False,
             "cutz": self.app.defaults["geometry_cutz"],
             "vtipdia": 0.1,
             "vtipangle": 30,
@@ -183,12 +219,12 @@ class TclCommandCopperClear(TclCommand):
             "startz": self.app.defaults["geometry_startz"],
 
             "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 = {}
 
@@ -206,23 +242,7 @@ class TclCommandCopperClear(TclCommand):
                     '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
         if 'all' in args:

+ 28 - 21
tclCommands/TclCommandPaint.py

@@ -66,7 +66,7 @@ class TclCommandPaint(TclCommand):
                       '"no" -> the order used is the one provided.'
                       '"fwd" -> tools are ordered from smallest to biggest.'
                       '"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)'),
             ('contour', 'Cut around the perimeter of the painting. True (1) or False (0)'),
             ('all', 'If used, paint all polygons in the object.'),
@@ -121,6 +121,16 @@ class TclCommandPaint(TclCommand):
 
         if 'method' in args:
             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:
             method = str(self.app.defaults["tools_paintmethod"])
 
@@ -147,6 +157,14 @@ class TclCommandPaint(TclCommand):
         else:
             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:
             tools = [float(eval(dia)) for dia in tooldia.split(",") if dia != '']
         except AttributeError:
@@ -154,8 +172,8 @@ class TclCommandPaint(TclCommand):
         # store here the default data for Geometry Data
         default_data = {}
         default_data.update({
-            "name": '_paint',
-            "plot": self.app.defaults["geometry_plot"],
+            "name": outname,
+            "plot": False,
             "cutz": self.app.defaults["geometry_cutz"],
             "vtipdia": 0.1,
             "vtipangle": 30,
@@ -180,12 +198,12 @@ class TclCommandPaint(TclCommand):
             "startz": self.app.defaults["geometry_startz"],
 
             "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 = {}
 
@@ -203,6 +221,7 @@ class TclCommandPaint(TclCommand):
                     'solid_geometry': []
                 }
             })
+            paint_tools[int(tooluid)]['data']['tooldia'] = float('%.*f' % (obj.decimals, tool))
 
         if obj is None:
             return "Object not found: %s" % name
@@ -211,13 +230,9 @@ class TclCommandPaint(TclCommand):
         if 'all' in args:
             self.app.paint_tool.paint_poly_all(obj=obj,
                                                tooldia=tooldia,
-                                               overlap=overlap,
                                                order=order,
-                                               margin=margin,
                                                method=method,
                                                outname=outname,
-                                               connect=connect,
-                                               contour=contour,
                                                tools_storage=paint_tools,
                                                plot=False,
                                                run_threaded=False)
@@ -234,13 +249,9 @@ class TclCommandPaint(TclCommand):
                 self.app.paint_tool.paint_poly(obj=obj,
                                                inside_pt=[x, y],
                                                tooldia=tooldia,
-                                               overlap=overlap,
                                                order=order,
-                                               margin=margin,
                                                method=method,
                                                outname=outname,
-                                               connect=connect,
-                                               contour=contour,
                                                tools_storage=paint_tools,
                                                plot=False,
                                                run_threaded=False)
@@ -264,13 +275,9 @@ class TclCommandPaint(TclCommand):
             self.app.paint_tool.paint_poly_ref(obj=obj,
                                                sel_obj=box_obj,
                                                tooldia=tooldia,
-                                               overlap=overlap,
                                                order=order,
-                                               margin=margin,
                                                method=method,
                                                outname=outname,
-                                               connect=connect,
-                                               contour=contour,
                                                tools_storage=paint_tools,
                                                plot=False,
                                                run_threaded=False)

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác