- brought up-to-date and fixed the Tcl Command Drillcncjob and Cncjob
- fixed Tcl command Isolate to not print messages on message bar in case it is run headless - fixed Tcl command Copper Clear (NCC) - fixed Tcl command Paint
This commit is contained in:
parent
7ca44fa107
commit
9c97ce49b9
|
@ -21,6 +21,10 @@ CHANGELOG for FlatCAM beta
|
|||
- added a new string to the translatable strings
|
||||
- fixed an error that sometime showed in Legacy Mode when moving the mouse outside canvas
|
||||
- reactivated the shortcut key 'S' in TCL Shell, to close the shell dock when it was open (of course the focus has to be not on the command line)
|
||||
- brought up-to-date and fixed the Tcl Command Drillcncjob and Cncjob
|
||||
- fixed Tcl command Isolate to not print messages on message bar in case it is run headless
|
||||
- fixed Tcl command Copper Clear (NCC)
|
||||
- fixed Tcl command Paint
|
||||
|
||||
27.10.2020
|
||||
|
||||
|
|
|
@ -372,7 +372,12 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
|||
dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, float(tooldia_key)))
|
||||
nr_drills_item = QtWidgets.QTableWidgetItem('%d' % int(dia_value['nr_drills']))
|
||||
nr_slots_item = QtWidgets.QTableWidgetItem('%d' % int(dia_value['nr_slots']))
|
||||
cutz_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, float(dia_value['offset']) + self.z_cut))
|
||||
try:
|
||||
offset_val = self.app.dec_format(float(dia_value['offset']), self.decimals) + self.z_cut
|
||||
except KeyError:
|
||||
offset_val = self.app.dec_format(float(dia_value['offset_z']), self.decimals) + self.z_cut
|
||||
|
||||
cutz_item = QtWidgets.QTableWidgetItem('%f' % offset_val)
|
||||
|
||||
t_id.setFlags(QtCore.Qt.ItemIsEnabled)
|
||||
dia_item.setFlags(QtCore.Qt.ItemIsEnabled)
|
||||
|
|
|
@ -493,7 +493,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
|||
|
||||
geo_obj.solid_geometry = []
|
||||
|
||||
# transfer the Cut Z and Vtip and VAngle values in case that we use the V-Shape tool in Gerber UI
|
||||
# transfer the Cut Z and Vtip and Vangle values in case that we use the V-Shape tool in Gerber UI
|
||||
if geo_obj.tool_type.lower() == 'v':
|
||||
new_cutz = self.app.defaults["tools_iso_tool_cutz"]
|
||||
new_vtipdia = self.app.defaults["tools_iso_tool_vtipdia"]
|
||||
|
@ -555,6 +555,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
|||
follow=follow, nr_passes=nr_pass)
|
||||
|
||||
if geom == 'fail':
|
||||
if plot:
|
||||
app_obj.inform.emit('[ERROR_NOTCL] %s' % _("Isolation geometry could not be generated."))
|
||||
return 'fail'
|
||||
geo_obj.solid_geometry.append(geom)
|
||||
|
@ -580,7 +581,9 @@ class GerberObject(FlatCAMObj, Gerber):
|
|||
if empty_cnt == len(geo_obj.solid_geometry):
|
||||
raise ValidationError("Empty Geometry", None)
|
||||
else:
|
||||
app_obj.inform.emit('[success] %s" %s' % (_("Isolation geometry created"), geo_obj.options["name"]))
|
||||
if plot:
|
||||
app_obj.inform.emit('[success] %s: %s' %
|
||||
(_("Isolation geometry created"), geo_obj.options["name"]))
|
||||
|
||||
# even if combine is checked, one pass is still single-geo
|
||||
geo_obj.multigeo = True if passes > 1 else False
|
||||
|
@ -629,6 +632,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
|||
follow=follow, nr_passes=i)
|
||||
|
||||
if geom == 'fail':
|
||||
if plot:
|
||||
app_obj.inform.emit('[ERROR_NOTCL] %s' % _("Isolation geometry could not be generated."))
|
||||
return 'fail'
|
||||
|
||||
|
@ -706,6 +710,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
|||
if empty_cnt == len(geo_obj.solid_geometry):
|
||||
raise ValidationError("Empty Geometry", None)
|
||||
else:
|
||||
if plot:
|
||||
app_obj.inform.emit('[success] %s: %s' %
|
||||
(_("Isolation geometry created"), geo_obj.options["name"]))
|
||||
geo_obj.multigeo = False
|
||||
|
|
|
@ -2836,10 +2836,10 @@ class NonCopperClear(AppTool, Gerber):
|
|||
# Generate area for each tool
|
||||
offset_a = sum(sorted_tools)
|
||||
current_uid = int(1)
|
||||
try:
|
||||
tool = eval(self.app.defaults["tools_ncc_tools"])[0]
|
||||
except TypeError:
|
||||
tool = eval(self.app.defaults["tools_ncc_tools"])
|
||||
# try:
|
||||
# tool = eval(self.app.defaults["tools_ncc_tools"])[0]
|
||||
# except TypeError:
|
||||
# tool = eval(self.app.defaults["tools_ncc_tools"])
|
||||
|
||||
# ###################################################################################################
|
||||
# Calculate the empty area by subtracting the solid_geometry from the object bounding box geometry ##
|
||||
|
@ -2854,6 +2854,8 @@ class NonCopperClear(AppTool, Gerber):
|
|||
sol_geo = ncc_obj.solid_geometry.buffer(0)
|
||||
else:
|
||||
sol_geo = ncc_obj.solid_geometry
|
||||
if isinstance(sol_geo, list):
|
||||
sol_geo = unary_union(sol_geo)
|
||||
|
||||
if has_offset is True:
|
||||
app_obj.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering"))
|
||||
|
|
|
@ -2234,7 +2234,9 @@ class ToolPaint(AppTool, Gerber):
|
|||
self.app.inform.emit('%s %s' % (_("Paint Tool."), _("Normal painting polygon task started.")))
|
||||
|
||||
if inside_pt and poly_list is None:
|
||||
polygon_list = [self.find_polygon(point=inside_pt, geoset=obj.solid_geometry)]
|
||||
polygon_list = self.find_polygon(point=inside_pt, geoset=obj.solid_geometry)
|
||||
if polygon_list:
|
||||
polygon_list = [polygon_list]
|
||||
elif (inside_pt is None and poly_list) or (inside_pt and poly_list):
|
||||
polygon_list = poly_list
|
||||
else:
|
||||
|
@ -2244,7 +2246,7 @@ class ToolPaint(AppTool, Gerber):
|
|||
if polygon_list is None:
|
||||
self.app.log.warning('No polygon found.')
|
||||
self.app.inform.emit('[WARNING] %s' % _('No polygon found.'))
|
||||
return
|
||||
return "fail"
|
||||
|
||||
self.paint_geo(obj, polygon_list, tooldia=tooldia, order=order, method=method, outname=outname,
|
||||
tools_storage=tools_storage, plot=plot, run_threaded=run_threaded)
|
||||
|
|
|
@ -3596,6 +3596,7 @@ class CNCjob(Geometry):
|
|||
for k, v in list(self.options.items()):
|
||||
default_data[k] = deepcopy(v)
|
||||
|
||||
# it[1] is the tool diameter
|
||||
self.exc_cnc_tools[it[1]] = {}
|
||||
self.exc_cnc_tools[it[1]]['tool'] = it[0]
|
||||
self.exc_cnc_tools[it[1]]['nr_drills'] = drill_no
|
||||
|
@ -6349,10 +6350,11 @@ class CNCjob(Geometry):
|
|||
# Current path: temporary storage until tool is
|
||||
# lifted or lowered.
|
||||
if self.toolchange_xy_type == "excellon":
|
||||
if self.app.defaults["excellon_toolchangexy"] == '' or self.app.defaults["excellon_toolchangexy"] is None:
|
||||
if self.app.defaults["tools_drill_toolchangexy"] == '' or \
|
||||
self.app.defaults["tools_drill_toolchangexy"] is None:
|
||||
pos_xy = (0, 0)
|
||||
else:
|
||||
pos_xy = self.app.defaults["excellon_toolchangexy"]
|
||||
pos_xy = self.app.defaults["tools_drill_toolchangexy"]
|
||||
try:
|
||||
pos_xy = [float(eval(a)) for a in pos_xy.split(",")]
|
||||
except Exception:
|
||||
|
|
|
@ -169,7 +169,7 @@ class TclCommandCncjob(TclCommandSignaled):
|
|||
args["endxy"] = args["endxy"]
|
||||
else:
|
||||
if self.app.defaults["geometry_endxy"]:
|
||||
args["endxy"] = self.app.defaults["geometry_endxy"]
|
||||
args["endxy"] = str(self.app.defaults["geometry_endxy"])
|
||||
else:
|
||||
args["endxy"] = '0, 0'
|
||||
if len(eval(args["endxy"])) != 2:
|
||||
|
@ -204,7 +204,7 @@ class TclCommandCncjob(TclCommandSignaled):
|
|||
args["toolchangexy"] = args["toolchangexy"]
|
||||
else:
|
||||
if self.app.defaults["geometry_toolchangexy"]:
|
||||
args["toolchangexy"] = self.app.defaults["geometry_toolchangexy"]
|
||||
args["toolchangexy"] = str(self.app.defaults["geometry_toolchangexy"])
|
||||
else:
|
||||
args["toolchangexy"] = '0, 0'
|
||||
if len(eval(args["toolchangexy"])) != 2:
|
||||
|
|
|
@ -103,7 +103,7 @@ class TclCommandCopperClear(TclCommand):
|
|||
if 'tooldia' in args:
|
||||
tooldia = str(args['tooldia'])
|
||||
else:
|
||||
tooldia = self.app.defaults["tools_ncc_tools"]
|
||||
tooldia = str(self.app.defaults["tools_ncc_tools"])
|
||||
|
||||
if 'overlap' in args:
|
||||
overlap = float(args['overlap']) / 100.0
|
||||
|
@ -223,7 +223,7 @@ class TclCommandCopperClear(TclCommand):
|
|||
"area_strategy": self.app.defaults["geometry_area_strategy"],
|
||||
"area_overz": float(self.app.defaults["geometry_area_overz"]),
|
||||
|
||||
"tooldia": self.app.defaults["tools_paint_tooldia"],
|
||||
"tooldia": tooldia,
|
||||
"tools_ncc_operation": self.app.defaults["tools_ncc_operation"],
|
||||
|
||||
"tools_ncc_margin": margin,
|
||||
|
@ -253,7 +253,7 @@ class TclCommandCopperClear(TclCommand):
|
|||
'solid_geometry': []
|
||||
}
|
||||
})
|
||||
ncc_tools[int(tooluid)]['data']['tooldia'] = float('%.*f' % (obj.decimals, tool))
|
||||
ncc_tools[int(tooluid)]['data']['tooldia'] = self.app.dec_format(tool, obj.decimals)
|
||||
|
||||
# Non-Copper clear all polygons in the non-copper clear object
|
||||
if 'all' in args:
|
||||
|
|
|
@ -235,7 +235,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
|||
xy_toolchange = args["toolchangexy"]
|
||||
else:
|
||||
if self.app.defaults["tools_drill_toolchangexy"]:
|
||||
xy_toolchange = self.app.defaults["tools_drill_toolchangexy"]
|
||||
xy_toolchange = str(self.app.defaults["tools_drill_toolchangexy"])
|
||||
else:
|
||||
xy_toolchange = '0, 0'
|
||||
if len(eval(xy_toolchange)) != 2:
|
||||
|
@ -249,7 +249,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
|||
xy_end = args["endxy"]
|
||||
else:
|
||||
if self.app.defaults["tools_drill_endxy"]:
|
||||
xy_end = self.app.defaults["tools_drill_endxy"]
|
||||
xy_end = str(self.app.defaults["tools_drill_endxy"])
|
||||
else:
|
||||
xy_end = '0, 0'
|
||||
|
||||
|
@ -322,14 +322,15 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
|||
if "startz" in args and args["startz"] is not None:
|
||||
job_obj.startz = float(args["startz"])
|
||||
else:
|
||||
if self.app.defaults["excellon_startz"]:
|
||||
if self.app.defaults["tools_drill_startz"]:
|
||||
job_obj.startz = self.app.defaults["tools_drill_startz"]
|
||||
else:
|
||||
job_obj.startz = (0, 0)
|
||||
job_obj.startz = self.app.defaults["tools_drill_travelz"]
|
||||
|
||||
job_obj.endz = float(endz)
|
||||
job_obj.xy_end = xy_end
|
||||
job_obj.excellon_optimization_type = opt_type
|
||||
job_obj.spindledir = self.app.defaults["tools_drill_spindledir"]
|
||||
|
||||
ret_val = job_obj.generate_from_excellon_by_tool(obj, tools, use_ui=False)
|
||||
job_obj.source_file = ret_val
|
||||
|
@ -338,9 +339,9 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
|||
return 'fail'
|
||||
|
||||
for t_item in job_obj.exc_cnc_tools:
|
||||
job_obj.exc_cnc_tools[t_item]['data']['offset'] = \
|
||||
float(job_obj.exc_cnc_tools[t_item]['offset']) + float(drillz)
|
||||
job_obj.exc_cnc_tools[t_item]['data']['ppname_e'] = obj.options['ppname_e']
|
||||
job_obj.exc_cnc_tools[t_item]['data']['tools_drill_offset'] = \
|
||||
float(job_obj.exc_cnc_tools[t_item]['offset_z']) + float(drillz)
|
||||
job_obj.exc_cnc_tools[t_item]['data']['tools_drill_ppname_e'] = job_obj.options['ppname_e']
|
||||
|
||||
job_obj.gcode_parse()
|
||||
job_obj.create_geometry()
|
||||
|
|
|
@ -102,7 +102,7 @@ class TclCommandPaint(TclCommand):
|
|||
if 'tooldia' in args:
|
||||
tooldia = str(args['tooldia'])
|
||||
else:
|
||||
tooldia = float(self.app.defaults["tools_paint_overlap"])
|
||||
tooldia = str(self.app.defaults["tools_paint_tooldia"])
|
||||
|
||||
if 'overlap' in args:
|
||||
overlap = float(args['overlap']) / 100.0
|
||||
|
@ -202,7 +202,7 @@ class TclCommandPaint(TclCommand):
|
|||
"area_strategy": self.app.defaults["geometry_area_strategy"],
|
||||
"area_overz": float(self.app.defaults["geometry_area_overz"]),
|
||||
|
||||
"tooldia": self.app.defaults["tools_paint_tooldia"],
|
||||
"tooldia": tooldia,
|
||||
"tools_paint_offset": offset,
|
||||
"tools_paint_method": method,
|
||||
"tools_paint_selectmethod": select,
|
||||
|
@ -217,7 +217,7 @@ class TclCommandPaint(TclCommand):
|
|||
tooluid += 1
|
||||
paint_tools.update({
|
||||
int(tooluid): {
|
||||
'tooldia': float('%.*f' % (obj.decimals, tool)),
|
||||
'tooldia': self.app.dec_format(float(tool), self.app.decimals),
|
||||
'offset': 'Path',
|
||||
'offset_value': 0.0,
|
||||
'type': 'Iso',
|
||||
|
@ -226,7 +226,7 @@ class TclCommandPaint(TclCommand):
|
|||
'solid_geometry': []
|
||||
}
|
||||
})
|
||||
paint_tools[int(tooluid)]['data']['tooldia'] = float('%.*f' % (obj.decimals, tool))
|
||||
paint_tools[int(tooluid)]['data']['tooldia'] = self.app.dec_format(float(tool), self.app.decimals)
|
||||
|
||||
if obj is None:
|
||||
return "Object not found: %s" % name
|
||||
|
@ -257,7 +257,7 @@ class TclCommandPaint(TclCommand):
|
|||
x = coords_xy[0]
|
||||
y = coords_xy[1]
|
||||
|
||||
self.app.paint_tool.paint_poly(obj=obj,
|
||||
ret_val = self.app.paint_tool.paint_poly(obj=obj,
|
||||
inside_pt=[x, y],
|
||||
tooldia=tooldia,
|
||||
order=order,
|
||||
|
@ -266,6 +266,8 @@ class TclCommandPaint(TclCommand):
|
|||
tools_storage=paint_tools,
|
||||
plot=False,
|
||||
run_threaded=False)
|
||||
if ret_val == 'fail':
|
||||
return "Could not find a Polygon at the specified location."
|
||||
return
|
||||
|
||||
# Paint all polygons found within the box object from the the painted object
|
||||
|
|
Loading…
Reference in New Issue