- 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:
Marius Stanciu
2020-10-28 13:15:38 +02:00
committed by Marius
parent 7ca44fa107
commit 9c97ce49b9
10 changed files with 70 additions and 47 deletions

View File

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

View File

@@ -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,8 +223,8 @@ 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"],
"tools_ncc_operation": self.app.defaults["tools_ncc_operation"],
"tooldia": tooldia,
"tools_ncc_operation": self.app.defaults["tools_ncc_operation"],
"tools_ncc_margin": margin,
"tools_ncc_method": method_data,
@@ -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:

View File

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

View File

@@ -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,13 +202,13 @@ 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"],
"tools_paint_offset": offset,
"tools_paint_method": method,
"tools_paint_selectmethod": select,
"tools_paint_connect": connect,
"tools_paint_contour": contour,
"tools_paint_overlap": overlap
"tooldia": tooldia,
"tools_paint_offset": offset,
"tools_paint_method": method,
"tools_paint_selectmethod": select,
"tools_paint_connect": connect,
"tools_paint_contour": contour,
"tools_paint_overlap": overlap
})
paint_tools = {}
@@ -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,15 +257,17 @@ class TclCommandPaint(TclCommand):
x = coords_xy[0]
y = coords_xy[1]
self.app.paint_tool.paint_poly(obj=obj,
inside_pt=[x, y],
tooldia=tooldia,
order=order,
method=method,
outname=outname,
tools_storage=paint_tools,
plot=False,
run_threaded=False)
ret_val = self.app.paint_tool.paint_poly(obj=obj,
inside_pt=[x, y],
tooldia=tooldia,
order=order,
method=method,
outname=outname,
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