- fixed the TclCommand cncjob to use the -outname parameter

- added some more keywords in the data_model for auto-completer
This commit is contained in:
Marius Stanciu
2019-09-15 16:46:48 +03:00
committed by Marius
parent 30f00abce8
commit 8b3e1b5a77
5 changed files with 37 additions and 14 deletions

View File

@@ -41,7 +41,7 @@ class TclCommandCncjob(TclCommandSignaled):
('spindlespeed', int),
('dwell', bool),
('dwelltime', float),
('ppname_g', str),
('pp', str),
('outname', str)
])
@@ -71,7 +71,7 @@ class TclCommandCncjob(TclCommandSignaled):
('dwell', 'True or False; use (or not) the dwell'),
('dwelltime', 'Time to pause to allow the spindle to reach the full speed'),
('outname', 'Name of the resulting Geometry object.'),
('ppname_g', 'Name of the Geometry postprocessor. No quotes, case sensitive')
('pp', 'Name of the Geometry postprocessor. No quotes, case sensitive')
]),
'examples': ['cncjob geo_name -tooldia 0.5 -z_cut -1.7 -z_move 2 -feedrate 120 -ppname_g default']
}
@@ -92,6 +92,7 @@ class TclCommandCncjob(TclCommandSignaled):
args['outname'] = str(name) + "_cnc"
obj = self.app.collection.get_by_name(str(name), isCaseSensitive=False)
if obj is None:
self.raise_tcl_error("Object not found: %s" % str(name))
@@ -119,7 +120,7 @@ class TclCommandCncjob(TclCommandSignaled):
args["dwell"] = args["dwell"] if "dwell" in args else obj.options["dwell"]
args["dwelltime"] = args["dwelltime"] if "dwelltime" in args else obj.options["dwelltime"]
args["ppname_g"] = args["ppname_g"] if "ppname_g" in args else obj.options["ppname_g"]
args["pp"] = args["pp"] if "pp" in args else obj.options["ppname_g"]
args["toolchange"] = True if "toolchange" in args and args["toolchange"] == 1 else False
args["toolchangez"] = args["toolchangez"] if "toolchangez" in args else obj.options["toolchangez"]
@@ -128,9 +129,19 @@ class TclCommandCncjob(TclCommandSignaled):
del args['name']
for arg in args:
if arg == "toolchange_xy" or arg == "spindlespeed":
continue
else:
if args[arg] is None:
self.raise_tcl_error('One of the command parameters that have to be not None, is None.\n'
'The parameter that is None is in the default values found in the list \n'
'generated by the TclCommand "list_sys geom". or in the arguments.')
# HACK !!! Should be solved elsewhere!!!
# default option for multidepth is False
obj.options['multidepth'] = False
if not obj.multigeo:
obj.generatecncjob(use_thread=False, **args)
else:
@@ -155,7 +166,10 @@ class TclCommandCncjob(TclCommandSignaled):
local_tools_dict[tool_uid]['data']['spindlespeed'] = args["spindlespeed"]
local_tools_dict[tool_uid]['data']['dwell'] = args["dwell"]
local_tools_dict[tool_uid]['data']['dwelltime'] = args["dwelltime"]
local_tools_dict[tool_uid]['data']['ppname_g'] = args["ppname_g"]
print(local_tools_dict[tool_uid]['data'])
obj.mtool_gen_cncjob(tools_dict=local_tools_dict, tools_in_use=[], use_thread=False)
local_tools_dict[tool_uid]['data']['ppname_g'] = args["pp"]
obj.mtool_gen_cncjob(
outname=args['outname'],
tools_dict=local_tools_dict,
tools_in_use=[],
use_thread=False)
# self.raise_tcl_error('The object is a multi-geo geometry which is not supported in cncjob Tcl Command')

View File

@@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
class TclCommandDrillcncjob(TclCommandSignaled):
"""
Tcl shell command to Generates a Drill CNC Job from a Excellon Object.
@@ -27,7 +28,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
('toolchangez', float),
('toolchangexy', tuple),
('endz', float),
('ppname_e', str),
('pp', str),
('outname', str),
('opt_type', str),
('diatol', float)
@@ -52,7 +53,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
('toolchangez', 'Z distance for toolchange (example: 30.0).'),
('toolchangexy', 'X, Y coordonates for toolchange in format (x, y) (example: (2.0, 3.1) ).'),
('endz', 'Z distance at job end (example: 30.0).'),
('ppname_e', 'This is the Excellon postprocessor name: case_sensitive, no_quotes'),
('pp', 'This is the Excellon postprocessor name: case_sensitive, no_quotes'),
('outname', 'Name of the resulting Geometry object.'),
('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 '
@@ -64,7 +65,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
'in Excellon will be processed. Float number.')
]),
'examples': ['drillcncjob test.TXT -drillz -1.5 -travelz 14 -feedrate 222 -feedrate_rapid 456 -spindlespeed 777'
' -toolchange True -toolchangez 33 -endz 22 -ppname_e default\n'
' -toolchange True -toolchangez 33 -endz 22 -pp default\n'
'Usage of -feedrate_rapid matter only when the posptocessor is using it, like -marlin-.']
}
@@ -157,7 +158,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
if "feedrate_rapid" in args else obj.options["feedrate_rapid"]
job_obj.spindlespeed = args["spindlespeed"] if "spindlespeed" in args else None
job_obj.pp_excellon_name = args["ppname_e"] if "ppname_e" in args \
job_obj.pp_excellon_name = args["pp"] if "pp" in args \
else obj.options["ppname_e"]
job_obj.coords_decimals = int(self.app.defaults["cncjob_coords_decimals"])