فهرست منبع

- more work in the new Laser Mode in the Paint Tool

Marius Stanciu 6 سال پیش
والد
کامیت
25c9a31179
3فایلهای تغییر یافته به همراه919 افزوده شده و 155 حذف شده
  1. 1 0
      README.md
  2. 49 33
      camlib.py
  3. 869 122
      flatcamTools/ToolPaint.py

+ 1 - 0
README.md

@@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing.
 
 
 - in Paint Tool added a new method of painting named Combo who will pass through all the methods until the polygon is cleared
 - in Paint Tool added a new method of painting named Combo who will pass through all the methods until the polygon is cleared
 - in Paint Tool attempting to add a new mode suitable for Laser usage
 - in Paint Tool attempting to add a new mode suitable for Laser usage
+- more work in the new Laser Mode in the Paint Tool
 
 
 14.02.2020
 14.02.2020
 
 

+ 49 - 33
camlib.py

@@ -1582,7 +1582,7 @@ class Geometry(object):
         """
         """
 
 
         # log.debug("camlib.fill_with_lines()")
         # log.debug("camlib.fill_with_lines()")
-        if not isinstance(line, LineString) or not isinstance(line, MultiLineString):
+        if not isinstance(line, LineString) and not isinstance(line, MultiLineString):
             log.debug("camlib.Geometry.fill_with_lines() --> Not a LineString/MultiLineString but %s" % str(type(line)))
             log.debug("camlib.Geometry.fill_with_lines() --> Not a LineString/MultiLineString but %s" % str(type(line)))
             return None
             return None
 
 
@@ -1596,10 +1596,10 @@ class Geometry(object):
 
 
         lines_trimmed = []
         lines_trimmed = []
 
 
-        polygon = line.buffer(aperture_size / 1.99999999999999999, int(steps_per_circle))
+        polygon = line.buffer(aperture_size / 2.0, int(steps_per_circle))
 
 
         try:
         try:
-            margin_poly = polygon.buffer(-tooldia / 1.99999999, int(steps_per_circle))
+            margin_poly = polygon.buffer(-tooldia / 2.0, int(steps_per_circle))
         except Exception:
         except Exception:
             log.debug("camlib.Geometry.fill_with_lines() --> Could not buffer the Polygon, tool diameter too high")
             log.debug("camlib.Geometry.fill_with_lines() --> Could not buffer the Polygon, tool diameter too high")
             return None
             return None
@@ -1615,40 +1615,50 @@ class Geometry(object):
                 # provide the app with a way to process the GUI events when in a blocking loop
                 # provide the app with a way to process the GUI events when in a blocking loop
                 QtWidgets.QApplication.processEvents()
                 QtWidgets.QApplication.processEvents()
 
 
-                line = line.parallel_offset(distance=delta, side='left', resolution=int(steps_per_circle))
-                line = line.intersection(margin_poly)
-                lines_trimmed.append(line)
+                new_line = line.parallel_offset(distance=delta, side='left', resolution=int(steps_per_circle))
+                new_line = new_line.intersection(margin_poly)
+                lines_trimmed.append(new_line)
 
 
-                line = line.parallel_offset(distance=delta, side='right', resolution=int(steps_per_circle))
-                line = line.intersection(margin_poly)
-                lines_trimmed.append(line)
+                new_line = line.parallel_offset(distance=delta, side='right', resolution=int(steps_per_circle))
+                new_line = new_line.intersection(margin_poly)
+                lines_trimmed.append(new_line)
 
 
                 delta += tooldia * (1 - overlap)
                 delta += tooldia * (1 - overlap)
                 if prog_plot:
                 if prog_plot:
-                    self.plot_temp_shapes(line)
+                    self.plot_temp_shapes(new_line)
                     self.temp_shapes.redraw()
                     self.temp_shapes.redraw()
 
 
             # Last line
             # Last line
-            delta = aperture_size / 2
+            delta = (aperture_size / 2) - (tooldia / 2.00000001)
 
 
-            line = line.parallel_offset(distance=delta, side='left', resolution=int(steps_per_circle))
-            line = line.intersection(margin_poly)
+            new_line = line.parallel_offset(distance=delta, side='left', resolution=int(steps_per_circle))
+            new_line = new_line.intersection(margin_poly)
+        except Exception as e:
+            log.debug('camlib.Geometry.fill_with_lines() Processing poly --> %s' % str(e))
+            return None
 
 
-            for ll in line:
+        try:
+            for ll in new_line:
                 lines_trimmed.append(ll)
                 lines_trimmed.append(ll)
                 if prog_plot:
                 if prog_plot:
-                    self.plot_temp_shapes(line)
+                    self.plot_temp_shapes(ll)
+        except TypeError:
+            lines_trimmed.append(new_line)
+            if prog_plot:
+                self.plot_temp_shapes(new_line)
 
 
-            line = line.parallel_offset(distance=delta, side='left', resolution=int(steps_per_circle))
-            line = line.intersection(margin_poly)
+        new_line = line.parallel_offset(distance=delta, side='right', resolution=int(steps_per_circle))
+        new_line = new_line.intersection(margin_poly)
 
 
-            for ll in line:
+        try:
+            for ll in new_line:
                 lines_trimmed.append(ll)
                 lines_trimmed.append(ll)
                 if prog_plot:
                 if prog_plot:
-                    self.plot_temp_shapes(line)
-        except Exception as e:
-            log.debug('camlib.Geometry.fill_with_lines() Processing poly --> %s' % str(e))
-            return None
+                    self.plot_temp_shapes(ll)
+        except TypeError:
+            lines_trimmed.append(new_line)
+            if prog_plot:
+                self.plot_temp_shapes(new_line)
 
 
         if prog_plot:
         if prog_plot:
             self.temp_shapes.redraw()
             self.temp_shapes.redraw()
@@ -3434,10 +3444,13 @@ class CNCjob(Geometry):
         self.f_plunge = self.app.defaults["geometry_f_plunge"]
         self.f_plunge = self.app.defaults["geometry_f_plunge"]
 
 
         if self.z_cut is None:
         if self.z_cut is None:
-            self.app.inform.emit('[ERROR_NOTCL] %s' %
-                                 _("Cut_Z parameter is None or zero. Most likely a bad combinations of "
-                                   "other parameters."))
-            return 'fail'
+            if 'laser' not in self.pp_geometry_name:
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Cut_Z parameter is None or zero. Most likely a bad combinations of "
+                                       "other parameters."))
+                return 'fail'
+            else:
+                self.z_cut = 0
 
 
         if self.machinist_setting == 0:
         if self.machinist_setting == 0:
             if self.z_cut > 0:
             if self.z_cut > 0:
@@ -3448,7 +3461,7 @@ class CNCjob(Geometry):
                                        "therefore the app will convert the value to negative."
                                        "therefore the app will convert the value to negative."
                                        "Check the resulting CNC code (Gcode etc)."))
                                        "Check the resulting CNC code (Gcode etc)."))
                 self.z_cut = -self.z_cut
                 self.z_cut = -self.z_cut
-            elif self.z_cut == 0:
+            elif self.z_cut == 0 and 'laser' not in self.pp_geometry_name:
                 self.app.inform.emit('[WARNING] %s: %s' %
                 self.app.inform.emit('[WARNING] %s: %s' %
                                      (_("The Cut Z parameter is zero. There will be no cut, skipping file"),
                                      (_("The Cut Z parameter is zero. There will be no cut, skipping file"),
                                       self.options['name']))
                                       self.options['name']))
@@ -3793,11 +3806,14 @@ class CNCjob(Geometry):
 
 
         if self.machinist_setting == 0:
         if self.machinist_setting == 0:
             if self.z_cut is None:
             if self.z_cut is None:
-                self.app.inform.emit(
-                    '[ERROR_NOTCL] %s' % _("Cut_Z parameter is None or zero. Most likely a bad combinations of "
-                                           "other parameters.")
-                )
-                return 'fail'
+                if 'laser' not in self.pp_geometry_name:
+                    self.app.inform.emit(
+                        '[ERROR_NOTCL] %s' % _("Cut_Z parameter is None or zero. Most likely a bad combinations of "
+                                               "other parameters.")
+                    )
+                    return 'fail'
+                else:
+                    self.z_cut = 0.0
 
 
             if self.z_cut > 0:
             if self.z_cut > 0:
                 self.app.inform.emit('[WARNING] %s' %
                 self.app.inform.emit('[WARNING] %s' %
@@ -3807,7 +3823,7 @@ class CNCjob(Geometry):
                                        "therefore the app will convert the value to negative."
                                        "therefore the app will convert the value to negative."
                                        "Check the resulting CNC code (Gcode etc)."))
                                        "Check the resulting CNC code (Gcode etc)."))
                 self.z_cut = -self.z_cut
                 self.z_cut = -self.z_cut
-            elif self.z_cut == 0:
+            elif self.z_cut == 0 and 'laser' not in self.pp_geometry_name:
                 self.app.inform.emit(
                 self.app.inform.emit(
                     '[WARNING] %s: %s' % (_("The Cut Z parameter is zero. There will be no cut, skipping file"),
                     '[WARNING] %s: %s' % (_("The Cut Z parameter is zero. There will be no cut, skipping file"),
                                           geometry.options['name'])
                                           geometry.options['name'])

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 869 - 122
flatcamTools/ToolPaint.py


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است