2019-01-03 19:25:08 +00:00
|
|
|
from tclCommands.TclCommand import TclCommandSignaled
|
2019-10-24 23:10:52 +00:00
|
|
|
|
|
|
|
import collections
|
|
|
|
import math
|
2019-01-03 19:25:08 +00:00
|
|
|
|
2020-04-13 20:43:48 +00:00
|
|
|
import gettext
|
2020-06-03 17:35:59 +00:00
|
|
|
import appTranslation as fcTranslate
|
2020-04-13 20:43:48 +00:00
|
|
|
import builtins
|
|
|
|
|
|
|
|
fcTranslate.apply_language('strings')
|
|
|
|
if '_' not in builtins.__dict__:
|
|
|
|
_ = gettext.gettext
|
|
|
|
|
2019-09-15 13:46:48 +00:00
|
|
|
|
2019-01-03 19:25:08 +00:00
|
|
|
class TclCommandDrillcncjob(TclCommandSignaled):
|
|
|
|
"""
|
|
|
|
Tcl shell command to Generates a Drill CNC Job from a Excellon Object.
|
|
|
|
"""
|
|
|
|
|
|
|
|
# array of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
|
|
|
|
aliases = ['drillcncjob']
|
|
|
|
|
2020-04-13 16:15:20 +00:00
|
|
|
description = '%s %s' % ("--", "Generates a Drill CNC Job object from a Excellon Object.")
|
|
|
|
|
2019-01-03 19:25:08 +00:00
|
|
|
# dictionary of types from Tcl command, needs to be ordered
|
|
|
|
arg_names = collections.OrderedDict([
|
|
|
|
('name', str)
|
|
|
|
])
|
|
|
|
|
|
|
|
# dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
|
|
|
|
option_types = collections.OrderedDict([
|
2019-09-11 18:40:18 +00:00
|
|
|
('drilled_dias', str),
|
2019-01-03 19:25:08 +00:00
|
|
|
('drillz', float),
|
2020-04-13 20:43:48 +00:00
|
|
|
('dpp', float),
|
2019-01-03 19:25:08 +00:00
|
|
|
('travelz', float),
|
2020-04-13 20:43:48 +00:00
|
|
|
('feedrate_z', float),
|
2019-01-03 19:25:08 +00:00
|
|
|
('feedrate_rapid', float),
|
|
|
|
('spindlespeed', int),
|
|
|
|
('toolchangez', float),
|
2020-06-02 15:29:45 +00:00
|
|
|
('toolchangexy', str),
|
2020-04-13 20:43:48 +00:00
|
|
|
('startz', float),
|
2019-01-03 19:25:08 +00:00
|
|
|
('endz', float),
|
2020-06-02 15:29:45 +00:00
|
|
|
('endxy', str),
|
2019-11-27 21:04:38 +00:00
|
|
|
('dwelltime', float),
|
2019-09-15 13:46:48 +00:00
|
|
|
('pp', str),
|
2019-09-11 23:07:32 +00:00
|
|
|
('opt_type', str),
|
2019-09-16 01:23:16 +00:00
|
|
|
('diatol', float),
|
2020-04-13 16:15:20 +00:00
|
|
|
('muted', str),
|
|
|
|
('outname', str)
|
2019-01-03 19:25:08 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
# array of mandatory options for current Tcl command: required = {'name','outname'}
|
|
|
|
required = ['name']
|
|
|
|
|
|
|
|
# structured help for current command, args needs to be ordered
|
|
|
|
help = {
|
|
|
|
'main': "Generates a Drill CNC Job from a Excellon Object.",
|
|
|
|
'args': collections.OrderedDict([
|
|
|
|
('name', 'Name of the source object.'),
|
2019-09-11 18:40:18 +00:00
|
|
|
('drilled_dias',
|
2020-01-01 18:42:59 +00:00
|
|
|
'Comma separated tool diameters of the drills to be drilled (example: 0.6,1.0 or 3.125). '
|
2020-06-02 15:29:45 +00:00
|
|
|
'WARNING: No space allowed'),
|
2020-04-13 20:43:48 +00:00
|
|
|
('drillz', 'Drill depth into material (example: -2.0). Negative value.'),
|
|
|
|
('dpp', 'Progressive drilling into material with a specified step (example: 0.7). Positive value.'),
|
2019-01-03 19:25:08 +00:00
|
|
|
('travelz', 'Travel distance above material (example: 2.0).'),
|
2020-04-13 20:43:48 +00:00
|
|
|
('feedrate_z', 'Drilling feed rate. It is the speed on the Z axis.'),
|
2019-01-03 19:25:08 +00:00
|
|
|
('feedrate_rapid', 'Rapid drilling feed rate.'),
|
|
|
|
('spindlespeed', 'Speed of the spindle in rpm (example: 4000).'),
|
2020-01-01 18:42:59 +00:00
|
|
|
('toolchangez', 'Z distance for toolchange (example: 30.0).\n'
|
|
|
|
'If used in the command then a toolchange event will be included in gcode'),
|
2020-06-02 15:29:45 +00:00
|
|
|
('toolchangexy', 'The X,Y coordinates at Toolchange event in format (x, y) (example: (30.0, 15.2) or '
|
|
|
|
'without parenthesis like: 0.3,1.0). WARNING: no spaces allowed in the value.'),
|
2020-04-13 20:43:48 +00:00
|
|
|
('startz', 'The Z coordinate at job start (example: 30.0).'),
|
|
|
|
('endz', 'The Z coordinate at job end (example: 30.0).'),
|
2020-06-02 15:29:45 +00:00
|
|
|
('endxy', 'The X,Y coordinates at job end in format (x, y) (example: (2.0, 1.2) or without parenthesis'
|
|
|
|
'like: 0.3,1.0). WARNING: no spaces allowed in the value.'),
|
2020-01-01 18:42:59 +00:00
|
|
|
('dwelltime', 'Time to pause to allow the spindle to reach the full speed.\n'
|
|
|
|
'If it is not used in command then it will not be included'),
|
2019-12-06 21:00:43 +00:00
|
|
|
('pp', 'This is the Excellon preprocessor name: case_sensitive, no_quotes'),
|
2019-09-11 23:07:32 +00:00
|
|
|
('opt_type', 'Name of move optimization type. B by default for Basic OR-Tools, M for Metaheuristic OR-Tools'
|
|
|
|
'T from Travelling Salesman Algorithm. B and M works only for 64bit version of FlatCAM and '
|
|
|
|
'T works only for 32bit version of FlatCAM'),
|
2019-09-12 14:28:56 +00:00
|
|
|
('diatol', 'Tolerance. Percentange (0.0 ... 100.0) within which dias in drilled_dias will be judged to be '
|
|
|
|
'the same as the ones in the tools from the Excellon object. E.g: if in drill_dias we have a '
|
|
|
|
'diameter with value 1.0, in the Excellon we have a tool with dia = 1.05 and we set a tolerance '
|
|
|
|
'diatol = 5.0 then the drills with the dia = (0.95 ... 1.05) '
|
2019-09-16 01:23:16 +00:00
|
|
|
'in Excellon will be processed. Float number.'),
|
2020-04-13 16:15:20 +00:00
|
|
|
('muted', 'It will not put errors in the Shell or status bar. Can be True (1) or False (0).'),
|
|
|
|
('outname', 'Name of the resulting Geometry object.')
|
2019-01-03 19:25:08 +00:00
|
|
|
]),
|
2020-04-13 20:43:48 +00:00
|
|
|
'examples': ['drillcncjob test.TXT -drillz -1.5 -travelz 14 -feedrate_z 222 -feedrate_rapid 456 '
|
|
|
|
'-spindlespeed 777 -toolchangez 33 -endz 22 -pp default\n'
|
|
|
|
'Usage of -feedrate_rapid matter only when the preprocessor is using it, like -marlin-.',
|
|
|
|
'drillcncjob test.DRL -drillz -1.7 -dpp 0.5 -travelz 2 -feedrate_z 800 -endxy 3,3']
|
2019-01-03 19:25:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def execute(self, args, unnamed_args):
|
|
|
|
"""
|
|
|
|
execute current TCL shell command
|
|
|
|
|
|
|
|
:param args: array of known named arguments and options
|
|
|
|
:param unnamed_args: array of other values which were passed into command
|
|
|
|
without -somename and we do not have them in known arg_names
|
|
|
|
:return: None or exception
|
|
|
|
"""
|
|
|
|
|
|
|
|
name = args['name']
|
|
|
|
|
2019-12-05 13:18:54 +00:00
|
|
|
obj = self.app.collection.get_by_name(name)
|
|
|
|
|
2019-01-03 19:25:08 +00:00
|
|
|
if 'outname' not in args:
|
|
|
|
args['outname'] = name + "_cnc"
|
|
|
|
|
2019-09-16 01:23:16 +00:00
|
|
|
if 'muted' in args:
|
2020-04-22 11:37:03 +00:00
|
|
|
try:
|
|
|
|
par = args['muted'].capitalize()
|
|
|
|
except AttributeError:
|
|
|
|
par = args['muted']
|
|
|
|
muted = bool(eval(par))
|
2019-09-16 14:20:56 +00:00
|
|
|
else:
|
2019-12-06 23:27:49 +00:00
|
|
|
muted = False
|
|
|
|
|
|
|
|
if obj is None:
|
|
|
|
if muted is False:
|
|
|
|
self.raise_tcl_error("Object not found: %s" % name)
|
|
|
|
else:
|
|
|
|
return "fail"
|
2019-09-16 01:23:16 +00:00
|
|
|
|
2020-04-27 09:34:56 +00:00
|
|
|
if obj.kind != 'excellon':
|
2020-04-13 16:15:20 +00:00
|
|
|
if muted is False:
|
2020-04-27 09:34:56 +00:00
|
|
|
self.raise_tcl_error('Expected ExcellonObject, got %s %s.' % (name, type(obj)))
|
2019-09-16 01:23:16 +00:00
|
|
|
else:
|
2019-09-16 23:58:01 +00:00
|
|
|
return "fail"
|
2019-01-03 19:25:08 +00:00
|
|
|
|
2019-03-17 13:47:17 +00:00
|
|
|
xmin = obj.options['xmin']
|
|
|
|
ymin = obj.options['ymin']
|
|
|
|
xmax = obj.options['xmax']
|
|
|
|
ymax = obj.options['ymax']
|
|
|
|
|
2019-01-03 19:25:08 +00:00
|
|
|
def job_init(job_obj, app_obj):
|
2019-09-11 18:40:18 +00:00
|
|
|
# tools = args["tools"] if "tools" in args else 'all'
|
|
|
|
|
|
|
|
try:
|
|
|
|
if 'drilled_dias' in args and args['drilled_dias'] != 'all':
|
2019-10-24 23:10:52 +00:00
|
|
|
diameters = [x.strip() for x in args['drilled_dias'].split(",") if x != '']
|
2019-09-11 18:40:18 +00:00
|
|
|
nr_diameters = len(diameters)
|
|
|
|
|
2019-09-11 23:07:32 +00:00
|
|
|
req_tools = set()
|
2019-09-11 18:40:18 +00:00
|
|
|
for tool in obj.tools:
|
|
|
|
for req_dia in diameters:
|
2019-12-05 13:18:54 +00:00
|
|
|
obj_dia_form = float('%.*f' % (obj.decimals, float(obj.tools[tool]["C"])))
|
|
|
|
req_dia_form = float('%.*f' % (obj.decimals, float(req_dia)))
|
2019-09-11 18:40:18 +00:00
|
|
|
|
2019-09-12 14:28:56 +00:00
|
|
|
if 'diatol' in args:
|
|
|
|
tolerance = args['diatol'] / 100
|
2019-09-11 23:07:32 +00:00
|
|
|
|
|
|
|
tolerance = 0.0 if tolerance < 0.0 else tolerance
|
|
|
|
tolerance = 1.0 if tolerance > 1.0 else tolerance
|
|
|
|
if math.isclose(obj_dia_form, req_dia_form, rel_tol=tolerance):
|
|
|
|
req_tools.add(tool)
|
|
|
|
nr_diameters -= 1
|
|
|
|
else:
|
|
|
|
if obj_dia_form == req_dia_form:
|
|
|
|
req_tools.add(tool)
|
|
|
|
nr_diameters -= 1
|
2019-09-11 18:40:18 +00:00
|
|
|
|
|
|
|
if nr_diameters > 0:
|
2020-04-13 16:15:20 +00:00
|
|
|
if muted is False:
|
2019-09-16 01:23:16 +00:00
|
|
|
self.raise_tcl_error("One or more tool diameters of the drills to be drilled passed to the "
|
|
|
|
"TclCommand are not actual tool diameters in the Excellon object.")
|
|
|
|
else:
|
2019-09-16 23:58:01 +00:00
|
|
|
return "fail"
|
2019-09-11 18:40:18 +00:00
|
|
|
|
|
|
|
# make a string of diameters separated by comma; this is what generate_from_excellon_by_tool() is
|
|
|
|
# expecting as tools parameter
|
|
|
|
tools = ','.join(req_tools)
|
|
|
|
|
|
|
|
# no longer needed
|
|
|
|
del args['drilled_dias']
|
2019-09-12 14:28:56 +00:00
|
|
|
del args['diatol']
|
2019-09-11 18:40:18 +00:00
|
|
|
|
|
|
|
# Split and put back. We are passing the whole dictionary later.
|
|
|
|
# args['milled_dias'] = [x.strip() for x in args['tools'].split(",")]
|
|
|
|
else:
|
|
|
|
tools = 'all'
|
|
|
|
except Exception as e:
|
|
|
|
tools = 'all'
|
2019-09-16 23:58:01 +00:00
|
|
|
|
2020-04-13 16:15:20 +00:00
|
|
|
if muted is False:
|
2019-09-16 23:58:01 +00:00
|
|
|
self.raise_tcl_error("Bad tools: %s" % str(e))
|
|
|
|
else:
|
|
|
|
return "fail"
|
2019-01-03 19:25:08 +00:00
|
|
|
|
2020-04-13 20:43:48 +00:00
|
|
|
used_tools_info = []
|
|
|
|
used_tools_info.insert(0, [_("Tool_nr"), _("Diameter"), _("Drills_Nr"), _("Slots_Nr")])
|
|
|
|
|
|
|
|
# populate the information's list for used tools
|
|
|
|
if tools == 'all':
|
|
|
|
sort = []
|
|
|
|
for k, v in list(obj.tools.items()):
|
2020-06-16 00:47:26 +00:00
|
|
|
sort.append((k, v.get('tooldia')))
|
2020-04-13 20:43:48 +00:00
|
|
|
sorted_tools = sorted(sort, key=lambda t1: t1[1])
|
|
|
|
use_tools = [i[0] for i in sorted_tools]
|
|
|
|
|
|
|
|
for tool_no in use_tools:
|
2020-06-16 00:47:26 +00:00
|
|
|
tool_dia_used = obj.tools[tool_no]['tooldia']
|
2020-04-13 20:43:48 +00:00
|
|
|
|
|
|
|
drill_cnt = 0 # variable to store the nr of drills per tool
|
|
|
|
slot_cnt = 0 # variable to store the nr of slots per tool
|
|
|
|
|
|
|
|
# Find no of drills for the current tool
|
2020-06-16 00:47:26 +00:00
|
|
|
if 'drills' in obj.tools[tool_no] and obj.tools[tool_no]['drills']:
|
|
|
|
drill_cnt = len(obj.tools[tool_no]['drills'])
|
2020-04-13 20:43:48 +00:00
|
|
|
|
|
|
|
# Find no of slots for the current tool
|
2020-06-16 00:47:26 +00:00
|
|
|
if 'slots' in obj.tools[tool_no] and obj.tools[tool_no]['slots']:
|
|
|
|
slot_cnt = len(obj.tools[tool_no]['slots'])
|
2020-04-13 20:43:48 +00:00
|
|
|
|
|
|
|
used_tools_info.append([str(tool_no), str(tool_dia_used), str(drill_cnt), str(slot_cnt)])
|
|
|
|
|
2020-07-13 12:19:24 +00:00
|
|
|
drillz = args["drillz"] if "drillz" in args and args["drillz"] is not None else \
|
|
|
|
obj.options["tools_drill_cutz"]
|
2020-01-01 18:42:59 +00:00
|
|
|
|
|
|
|
if "toolchangez" in args:
|
|
|
|
toolchange = True
|
|
|
|
if args["toolchangez"] is not None:
|
|
|
|
toolchangez = args["toolchangez"]
|
|
|
|
else:
|
2020-07-13 12:19:24 +00:00
|
|
|
toolchangez = obj.options["tools_drill_toolchangez"]
|
2020-01-01 18:42:59 +00:00
|
|
|
else:
|
2020-07-13 12:19:24 +00:00
|
|
|
toolchange = self.app.defaults["tools_drill_toolchange"]
|
|
|
|
toolchangez = float(self.app.defaults["tools_drill_toolchangez"])
|
2020-01-01 18:42:59 +00:00
|
|
|
|
2020-07-13 12:19:24 +00:00
|
|
|
if "toolchangexy" in args and args["tools_drill_toolchangexy"]:
|
2020-06-02 15:29:45 +00:00
|
|
|
xy_toolchange = args["toolchangexy"]
|
|
|
|
else:
|
2020-07-13 12:19:24 +00:00
|
|
|
if self.app.defaults["tools_drill_toolchangexy"]:
|
2020-10-28 11:15:38 +00:00
|
|
|
xy_toolchange = str(self.app.defaults["tools_drill_toolchangexy"])
|
2020-06-02 15:29:45 +00:00
|
|
|
else:
|
|
|
|
xy_toolchange = '0, 0'
|
|
|
|
if len(eval(xy_toolchange)) != 2:
|
|
|
|
self.raise_tcl_error("The entered value for 'toolchangexy' needs to have the format x,y or "
|
|
|
|
"in format (x, y) - no spaces allowed. But always two comma separated values.")
|
|
|
|
|
2020-07-13 12:19:24 +00:00
|
|
|
endz = args["endz"] if "endz" in args and args["endz"] is not None else \
|
|
|
|
self.app.defaults["tools_drill_endz"]
|
2020-06-02 15:29:45 +00:00
|
|
|
|
|
|
|
if "endxy" in args and args["endxy"]:
|
|
|
|
xy_end = args["endxy"]
|
|
|
|
else:
|
2020-07-13 12:19:24 +00:00
|
|
|
if self.app.defaults["tools_drill_endxy"]:
|
2020-10-28 11:15:38 +00:00
|
|
|
xy_end = str(self.app.defaults["tools_drill_endxy"])
|
2020-06-02 15:29:45 +00:00
|
|
|
else:
|
|
|
|
xy_end = '0, 0'
|
|
|
|
|
|
|
|
if len(eval(xy_end)) != 2:
|
|
|
|
self.raise_tcl_error("The entered value for 'xy_end' needs to have the format x,y or "
|
|
|
|
"in format (x, y) - no spaces allowed. But always two comma separated values.")
|
2020-05-12 00:12:21 +00:00
|
|
|
|
2019-09-16 20:27:02 +00:00
|
|
|
opt_type = args["opt_type"] if "opt_type" in args and args["opt_type"] else 'B'
|
2019-09-11 18:40:18 +00:00
|
|
|
|
2020-04-13 20:43:48 +00:00
|
|
|
# ##########################################################################################
|
|
|
|
# ################# Set parameters #########################################################
|
|
|
|
# ##########################################################################################
|
|
|
|
job_obj.origin_kind = 'excellon'
|
|
|
|
|
|
|
|
job_obj.options['Tools_in_use'] = used_tools_info
|
|
|
|
job_obj.options['type'] = 'Excellon'
|
|
|
|
|
2020-07-13 12:19:24 +00:00
|
|
|
pp_excellon_name = args["pp"] if "pp" in args and args["pp"] else self.app.defaults["tools_drill_ppname_e"]
|
2020-04-13 20:43:48 +00:00
|
|
|
job_obj.pp_excellon_name = pp_excellon_name
|
|
|
|
job_obj.options['ppname_e'] = pp_excellon_name
|
2020-02-10 02:30:32 +00:00
|
|
|
|
2020-04-13 20:43:48 +00:00
|
|
|
if 'dpp' in args:
|
|
|
|
job_obj.multidepth = True
|
|
|
|
if args['dpp'] is not None:
|
|
|
|
job_obj.z_depthpercut = float(args['dpp'])
|
|
|
|
else:
|
|
|
|
job_obj.z_depthpercut = float(obj.options["dpp"])
|
|
|
|
else:
|
2020-07-13 12:19:24 +00:00
|
|
|
job_obj.multidepth = self.app.defaults["tools_drill_multidepth"]
|
|
|
|
job_obj.z_depthpercut = self.app.defaults["tools_drill_depthperpass"]
|
2020-06-02 15:29:45 +00:00
|
|
|
|
|
|
|
job_obj.z_move = float(args["travelz"]) if "travelz" in args and args["travelz"] else \
|
2020-07-13 12:19:24 +00:00
|
|
|
self.app.defaults["tools_drill_travelz"]
|
2020-04-13 20:43:48 +00:00
|
|
|
|
|
|
|
job_obj.feedrate = float(args["feedrate_z"]) if "feedrate_z" in args and args["feedrate_z"] else \
|
2020-07-13 12:19:24 +00:00
|
|
|
self.app.defaults["tools_drill_feedrate_z"]
|
2020-04-13 20:43:48 +00:00
|
|
|
job_obj.z_feedrate = float(args["feedrate_z"]) if "feedrate_z" in args and args["feedrate_z"] else \
|
2020-07-13 12:19:24 +00:00
|
|
|
self.app.defaults["tools_drill_feedrate_z"]
|
2020-06-02 15:29:45 +00:00
|
|
|
|
2020-04-13 20:43:48 +00:00
|
|
|
job_obj.feedrate_rapid = float(args["feedrate_rapid"]) \
|
2020-07-13 12:19:24 +00:00
|
|
|
if "feedrate_rapid" in args and args["feedrate_rapid"] else \
|
|
|
|
self.app.defaults["tools_drill_feedrate_rapid"]
|
2019-01-03 19:25:08 +00:00
|
|
|
|
2020-04-13 20:43:48 +00:00
|
|
|
job_obj.spindlespeed = float(args["spindlespeed"]) if "spindlespeed" in args else None
|
2020-07-13 12:19:24 +00:00
|
|
|
job_obj.spindledir = self.app.defaults['tools_drill_spindlespeed']
|
2020-01-01 18:42:59 +00:00
|
|
|
if 'dwelltime' in args:
|
2019-11-27 21:04:38 +00:00
|
|
|
job_obj.dwell = True
|
2020-01-01 18:42:59 +00:00
|
|
|
if args['dwelltime'] is not None:
|
|
|
|
job_obj.dwelltime = float(args['dwelltime'])
|
|
|
|
else:
|
2020-07-13 12:19:24 +00:00
|
|
|
job_obj.dwelltime = float(self.app.defaults["tools_drill_dwelltime"])
|
2020-01-01 14:13:33 +00:00
|
|
|
else:
|
2020-07-13 12:19:24 +00:00
|
|
|
job_obj.dwell = self.app.defaults["tools_drill_dwell"]
|
|
|
|
job_obj.dwelltime = self.app.defaults["tools_drill_dwelltime"]
|
2019-11-27 21:04:38 +00:00
|
|
|
|
2020-04-13 20:43:48 +00:00
|
|
|
job_obj.toolchange_xy_type = "excellon"
|
2019-03-17 13:47:17 +00:00
|
|
|
job_obj.coords_decimals = int(self.app.defaults["cncjob_coords_decimals"])
|
|
|
|
job_obj.fr_decimals = int(self.app.defaults["cncjob_fr_decimals"])
|
|
|
|
|
|
|
|
job_obj.options['xmin'] = xmin
|
|
|
|
job_obj.options['ymin'] = ymin
|
|
|
|
job_obj.options['xmax'] = xmax
|
|
|
|
job_obj.options['ymax'] = ymax
|
|
|
|
|
2020-04-13 20:43:48 +00:00
|
|
|
job_obj.z_cut = float(drillz)
|
|
|
|
job_obj.toolchange = toolchange
|
|
|
|
job_obj.xy_toolchange = xy_toolchange
|
|
|
|
job_obj.z_toolchange = float(toolchangez)
|
2020-06-02 15:29:45 +00:00
|
|
|
|
|
|
|
if "startz" in args and args["startz"] is not None:
|
|
|
|
job_obj.startz = float(args["startz"])
|
|
|
|
else:
|
2020-10-28 11:15:38 +00:00
|
|
|
if self.app.defaults["tools_drill_startz"]:
|
2020-07-13 12:19:24 +00:00
|
|
|
job_obj.startz = self.app.defaults["tools_drill_startz"]
|
2020-06-02 15:29:45 +00:00
|
|
|
else:
|
2020-10-28 11:15:38 +00:00
|
|
|
job_obj.startz = self.app.defaults["tools_drill_travelz"]
|
2020-06-02 15:29:45 +00:00
|
|
|
|
2020-04-13 20:43:48 +00:00
|
|
|
job_obj.endz = float(endz)
|
|
|
|
job_obj.xy_end = xy_end
|
|
|
|
job_obj.excellon_optimization_type = opt_type
|
2020-10-28 11:15:38 +00:00
|
|
|
job_obj.spindledir = self.app.defaults["tools_drill_spindledir"]
|
2020-04-13 20:43:48 +00:00
|
|
|
|
|
|
|
ret_val = job_obj.generate_from_excellon_by_tool(obj, tools, use_ui=False)
|
2020-07-22 14:08:40 +00:00
|
|
|
job_obj.source_file = ret_val
|
2020-04-13 20:43:48 +00:00
|
|
|
|
|
|
|
if ret_val == 'fail':
|
|
|
|
return 'fail'
|
2020-10-30 00:01:33 +00:00
|
|
|
job_obj.gc_start = ret_val[1]
|
2020-01-01 14:13:33 +00:00
|
|
|
|
|
|
|
for t_item in job_obj.exc_cnc_tools:
|
2020-10-28 11:15:38 +00:00
|
|
|
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']
|
2020-01-01 14:13:33 +00:00
|
|
|
|
2019-01-03 19:25:08 +00:00
|
|
|
job_obj.gcode_parse()
|
|
|
|
job_obj.create_geometry()
|
|
|
|
|
2020-06-02 15:29:45 +00:00
|
|
|
self.app.app_obj.new_object("cncjob", args['outname'], job_init, plot=False)
|