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

This commit is contained in:
Marius Stanciu
2020-02-15 21:11:06 +02:00
committed by Marius
parent d24290a2b6
commit 25c9a31179
3 changed files with 930 additions and 166 deletions

View File

@@ -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

View File

@@ -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,41 +1615,51 @@ 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)) new_line = line.parallel_offset(distance=delta, side='left', resolution=int(steps_per_circle))
line = line.intersection(margin_poly) new_line = new_line.intersection(margin_poly)
lines_trimmed.append(line) lines_trimmed.append(new_line)
line = line.parallel_offset(distance=delta, side='right', resolution=int(steps_per_circle)) new_line = line.parallel_offset(distance=delta, side='right', resolution=int(steps_per_circle))
line = line.intersection(margin_poly) new_line = new_line.intersection(margin_poly)
lines_trimmed.append(line) 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)) new_line = line.parallel_offset(distance=delta, side='left', resolution=int(steps_per_circle))
line = line.intersection(margin_poly) new_line = new_line.intersection(margin_poly)
for ll in line:
lines_trimmed.append(ll)
if prog_plot:
self.plot_temp_shapes(line)
line = line.parallel_offset(distance=delta, side='left', resolution=int(steps_per_circle))
line = line.intersection(margin_poly)
for ll in line:
lines_trimmed.append(ll)
if prog_plot:
self.plot_temp_shapes(line)
except Exception as e: except Exception as e:
log.debug('camlib.Geometry.fill_with_lines() Processing poly --> %s' % str(e)) log.debug('camlib.Geometry.fill_with_lines() Processing poly --> %s' % str(e))
return None return None
try:
for ll in new_line:
lines_trimmed.append(ll)
if prog_plot:
self.plot_temp_shapes(ll)
except TypeError:
lines_trimmed.append(new_line)
if prog_plot:
self.plot_temp_shapes(new_line)
new_line = line.parallel_offset(distance=delta, side='right', resolution=int(steps_per_circle))
new_line = new_line.intersection(margin_poly)
try:
for ll in new_line:
lines_trimmed.append(ll)
if prog_plot:
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' % if 'laser' not in self.pp_geometry_name:
_("Cut_Z parameter is None or zero. Most likely a bad combinations of " self.app.inform.emit('[ERROR_NOTCL] %s' %
"other parameters.")) _("Cut_Z parameter is None or zero. Most likely a bad combinations of "
return 'fail' "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( if 'laser' not in self.pp_geometry_name:
'[ERROR_NOTCL] %s' % _("Cut_Z parameter is None or zero. Most likely a bad combinations of " self.app.inform.emit(
"other parameters.") '[ERROR_NOTCL] %s' % _("Cut_Z parameter is None or zero. Most likely a bad combinations of "
) "other parameters.")
return 'fail' )
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'])

File diff suppressed because it is too large Load Diff