- fixed some issues with the recent preparation for dark icons resource usage

- added a new preprocessor file contributed by Daniel Friderich and added fixes for it
- RELEASE 8.99
This commit is contained in:
Marius Stanciu 2019-12-15 17:26:56 +02:00 committed by Marius
parent ba3a6138dc
commit 0eabc57e70
19 changed files with 8091 additions and 7930 deletions

View File

@ -6624,6 +6624,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
gcode = ''
roland = False
hpgl = False
isel_icp = False
try:
if self.special_group:
@ -6641,20 +6642,47 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
if self.cnc_tools[key]['data']['ppname_g'] == 'Roland_MDX_20':
roland = True
break
if self.cnc_tools[key]['data']['ppname_g'] == 'hpgl':
hpgl = True
break
except Exception as e:
except Exception:
try:
for key in self.cnc_tools:
if self.cnc_tools[key]['data']['ppname_e'] == 'Roland_MDX_20':
roland = True
break
except Exception as e:
except Exception:
pass
# detect if using HPGL preprocessor
try:
for key in self.cnc_tools:
if self.cnc_tools[key]['data']['ppname_g'] == 'hpgl':
hpgl = True
break
except Exception:
try:
for key in self.cnc_tools:
if self.cnc_tools[key]['data']['ppname_e'] == 'hpgl':
hpgl = True
break
except Exception:
pass
# detect if using ISEL_ICP_CNC preprocessor
try:
for key in self.cnc_tools:
if 'ISEL_ICP' in self.cnc_tools[key]['data']['ppname_g'].upper():
isel_icp = True
break
except Exception:
try:
for key in self.cnc_tools:
if 'ISEL_ICP' in self.cnc_tools[key]['data']['ppname_e'].upper():
isel_icp = True
break
except Exception:
pass
# do not add gcode_header when using the Roland preprocessor, add it for every other preprocessor
if roland is False and hpgl is False:
if roland is False and hpgl is False and isel_icp is False:
gcode = self.gcode_header()
# detect if using multi-tool and make the Gcode summation correctly for each case
@ -6680,7 +6708,8 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
g_idx = gcode.rfind('G21')
# if it did not find 'G20' and it did not find 'G21' then there is an error and return
if g_idx == -1:
# but only when the preprocessor is not ISEL_ICP who is allowed not to have the G20/G21 command
if g_idx == -1 and isel_icp is False:
self.app.inform.emit('[ERROR_NOTCL] %s' % _("G-code does not have a units code: either G20 or G21"))
return

View File

@ -17,6 +17,8 @@ CAD program, and create G-Code for Isolation routing.
- updated the languages
- fixed a typo
- fixed layout on first launch of the app
- fixed some issues with the recent preparation for dark icons resource usage
- added a new preprocessor file contributed by Daniel Friderich and added fixes for it
- RELEASE 8.99
14.12.2019

View File

@ -1934,11 +1934,13 @@ class FCCircle(FCShapeTool):
DrawTool.__init__(self, draw_app)
self.name = 'circle'
self.draw_app = draw_app
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception:
pass
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.app.resource_location + '/aero_circle_geo.png'))
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.draw_app.app.resource_location + '/aero_circle_geo.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
self.draw_app.app.inform.emit(_("Click on Center point ..."))
@ -1986,11 +1988,13 @@ class FCArc(FCShapeTool):
DrawTool.__init__(self, draw_app)
self.name = 'arc'
self.draw_app = draw_app
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception:
pass
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.app.resource_location + '/aero_arc.png'))
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.draw_app.resource_location + '/aero_arc.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
self.draw_app.app.inform.emit(_("Click on Center point ..."))
@ -2204,12 +2208,13 @@ class FCRectangle(FCShapeTool):
def __init__(self, draw_app):
DrawTool.__init__(self, draw_app)
self.name = 'rectangle'
self.draw_app = draw_app
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception:
pass
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.app.resource_location + '/aero.png'))
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.draw_app.app.resource_location + '/aero.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
self.draw_app.app.inform.emit(_("Click on 1st corner ..."))
@ -2258,12 +2263,13 @@ class FCPolygon(FCShapeTool):
def __init__(self, draw_app):
DrawTool.__init__(self, draw_app)
self.name = 'polygon'
self.draw_app = draw_app
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception:
pass
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.app.resource_location + '/aero.png'))
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.draw_app.app.resource_location + '/aero.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
self.draw_app.app.inform.emit(_("Click on 1st corner ..."))
@ -2321,12 +2327,13 @@ class FCPath(FCPolygon):
"""
def __init__(self, draw_app):
FCPolygon.__init__(self, draw_app)
self.draw_app = draw_app
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception:
pass
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.app.resource_location + '/aero_path5.png'))
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.draw_app.app.resource_location + '/aero_path5.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
def make(self):
@ -2365,6 +2372,7 @@ class FCSelect(DrawTool):
def __init__(self, draw_app):
DrawTool.__init__(self, draw_app)
self.name = 'select'
self.draw_app = draw_app
try:
QtGui.QGuiApplication.restoreOverrideCursor()
@ -2443,12 +2451,11 @@ class FCExplode(FCShapeTool):
def __init__(self, draw_app):
FCShapeTool.__init__(self, draw_app)
self.name = 'explode'
self.draw_app = draw_app
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e:
except Exception:
pass
self.storage = self.draw_app.storage
@ -2457,8 +2464,7 @@ class FCExplode(FCShapeTool):
self.draw_app.active_tool = self
if len(self.draw_app.get_selected()) == 0:
self.draw_app.app.inform.emit('[WARNING_NOTCL] %s...' %
_("No shape selected. Select a shape to explode"))
self.draw_app.app.inform.emit('[WARNING_NOTCL] %s...' % ("No shape selected. Select a shape to explode"))
else:
self.make()
@ -2498,6 +2504,7 @@ class FCMove(FCShapeTool):
def __init__(self, draw_app):
FCShapeTool.__init__(self, draw_app)
self.name = 'move'
self.draw_app = draw_app
try:
QtGui.QGuiApplication.restoreOverrideCursor()
@ -2673,24 +2680,22 @@ class FCCopy(FCMove):
self.geometry = [DrawToolShape(affinity.translate(geom.geo, xoff=dx, yoff=dy))
for geom in self.draw_app.get_selected()]
self.complete = True
self.draw_app.app.inform.emit('[success] %s' %
_("Done. Geometry(s) Copy completed."))
self.draw_app.app.inform.emit('[success] %s' % _("Done. Geometry(s) Copy completed."))
class FCText(FCShapeTool):
def __init__(self, draw_app):
FCShapeTool.__init__(self, draw_app)
self.name = 'text'
self.draw_app = draw_app
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception:
pass
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.app.resource_location + '/aero_text.png'))
self.cursor = QtGui.QCursor(QtGui.QPixmap(self.draw_app.app.resource_location + '/aero_text.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
# self.shape_buffer = self.draw_app.shape_buffer
self.draw_app = draw_app
self.app = draw_app.app
self.draw_app.app.inform.emit(_("Click on 1st corner ..."))
@ -2762,8 +2767,7 @@ class FCBuffer(FCShapeTool):
def on_buffer(self):
if not self.draw_app.selected:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_("Buffer cancelled. No shape selected."))
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Buffer cancelled. No shape selected."))
return
try:
@ -2876,6 +2880,7 @@ class FCEraser(FCShapeTool):
def __init__(self, draw_app):
DrawTool.__init__(self, draw_app)
self.name = 'eraser'
self.draw_app = draw_app
self.origin = None
self.destination = None
@ -2982,8 +2987,6 @@ class FCPaint(FCShapeTool):
def __init__(self, draw_app):
FCShapeTool.__init__(self, draw_app)
self.name = 'paint'
# self.shape_buffer = self.draw_app.shape_buffer
self.draw_app = draw_app
self.app = draw_app.app
@ -2997,7 +3000,6 @@ class FCTransform(FCShapeTool):
FCShapeTool.__init__(self, draw_app)
self.name = 'transformation'
# self.shape_buffer = self.draw_app.shape_buffer
self.draw_app = draw_app
self.app = draw_app.app

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,139 @@
# ########################################################## ##
# FlatCAM: 2D Post-processing for Manufacturing #
# http://flatcam.org #
# File Author: Matthieu Berthomé, Daniel Friderich #
# Date: 12/15/2019 #
# MIT Licence #
# ########################################################## ##
from FlatCAMPostProc import *
class ISEL_ICP_CNC(FlatCAMPostProc):
def start_code(self, p):
units = ' ' + str(p['units']).lower()
coords_xy = p['xy_toolchange']
gcode = ''
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
xmax = '%.*f' % (p.coords_decimals, p['options']['xmax'])
ymin = '%.*f' % (p.coords_decimals, p['options']['ymin'])
ymax = '%.*f' % (p.coords_decimals, p['options']['ymax'])
gcode += 'IMF_PBL flatcam\r\n'
if str(p['options']['type']) == 'Geometry':
gcode += '; TOOL DIAMETER: ' + str(p['options']['tool_dia']) + units + '\r\n'
gcode += '; Spindle Speed: %s RPM\r\n' % str(p['spindlespeed'])
gcode += '; Feedrate: ' + str(p['feedrate']) + units + '/min' + '\r\n'
if str(p['options']['type']) == 'Geometry':
gcode += '; Feedrate_Z: ' + str(p['z_feedrate']) + units + '/min' + '\r\n'
gcode += '; Feedrate rapids ' + str(p['feedrate_rapid']) + units + '/min' + '\r\n\r\n'
gcode += '; Z_Cut: ' + str(p['z_cut']) + units + '\r\n'
if str(p['options']['type']) == 'Geometry':
if p['multidepth'] is True:
gcode += '; DepthPerCut: ' + str(p['z_depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['z_depthpercut'])) + ' passes' + '\r\n'
gcode += '; Z_Move: ' + str(p['z_move']) + units + '\r\n'
gcode += '; Z Toolchange: ' + str(p['z_toolchange']) + units + '\r\n'
if coords_xy is not None:
gcode += '; X,Y Toolchange: ' + "%.*f, %.*f" % (p.decimals, coords_xy[0],
p.decimals, coords_xy[1]) + units + '\r\n'
else:
gcode += '; X,Y Toolchange: ' + "None" + units + '\r\n'
gcode += '; Z Start: ' + str(p['startz']) + units + '\r\n'
gcode += '; Z End: ' + str(p['z_end']) + units + '\r\n'
gcode += '; Steps per circle: ' + str(p['steps_per_circle']) + '\r\n'
if str(p['options']['type']) == 'Excellon' or str(p['options']['type']) == 'Excellon Geometry':
gcode += '; Preprocessor Excellon: ' + str(p['pp_excellon_name']) + '\r\n'
else:
gcode += '; Preprocessor Geometry: ' + str(p['pp_geometry_name']) + '\r\n'
gcode += '; X range: ' + '{: >9s}'.format(xmin) + ' ... ' + '{: >9s}'.format(xmax) + ' ' + units + '\r\n'
gcode += '; Y range: ' + '{: >9s}'.format(ymin) + ' ... ' + '{: >9s}'.format(ymax) + ' ' + units + '\r\n'
return gcode
def startz_code(self, p):
if p.startz is not None:
return 'FASTABS Z' + str(int(p.startz * 1000))
else:
return ''
def lift_code(self, p):
return 'FASTABS Z' + str(int(p.z_move * 1000))
def down_code(self, p):
return 'MOVEABS Z' + str(int(p.z_cut * 1000))
def toolchange_code(self, p):
f_plunge = p.f_plunge
no_drills = 1
toolC_formatted = '%.*f' % (p.decimals, p.toolC)
if str(p['options']['type']) == 'Excellon':
for i in p['options']['Tools_in_use']:
if i[0] == p.tool:
no_drills = i[2]
gcode = "GETTOOL {tool}\r\n; Changed to Tool Dia = {toolC}".format(tool=int(p.tool), t_drills=no_drills, toolC=toolC_formatted)
if f_plunge is True:
gcode += '\r\nFASTABS Z' + str(int(p.z_move * 1000))
return gcode
else:
gcode = "GETTOOL {tool}\r\n; Changed to Tool Dia = {toolC})".format(tool=int(p.tool), toolC=toolC_formatted)
if f_plunge is True:
gcode += '\r\nFASTABS Z' + str(int(p.z_move * 1000))
return gcode
def up_to_zero_code(self, p):
return 'MOVEABS Z0'
def position_code(self, p):
return ('X' + str(int(p.x * 1000)) + ' Y' + str(int(p.y * 1000)))
def rapid_code(self, p):
return ('FASTABS ' + self.position_code(p)).format(**p)
def linear_code(self, p):
return ('MOVEABS ' + self.position_code(p)).format(**p)
def end_code(self, p):
gcode = ''
gcode += 'WPCLEAR\r\n'
gcode += 'FASTABS Z0\r\n'
gcode += 'FASTABS X0 Y0\r\n'
gcode += 'PROGEND'
return gcode
def feedrate_code(self, p):
return 'VEL ' + str(int(p.feedrate / 60 * 1000))
def z_feedrate_code(self, p):
return 'VEL ' + str(int(p.z_feedrate / 60 * 1000))
def spindle_code(self, p):
sdir = {'CW': 'SPINDLE CW', 'CCW': 'SPINDLE CCW'}[p.spindledir]
if p.spindlespeed:
return '%s RPM%s' % (sdir, str(int(p.spindlespeed)))
else:
return sdir
def dwell_code(self, p):
if p.dwelltime:
return 'WAIT ' + str(int(p.dwelltime * 1000))
def spindle_stop_code(self,p):
return 'SPINDLE OFF'