- fixed the Tcl command Cncjob: there was a problem reported as issue #416. The command did not work due of the dpp parameter
- modified the Tcl command Cncjob such that if some of the parameters are not used then the default values will be used (set with set_sys) - modified the Tcl command Drillcncjob to use the defaults when some of the parameters are not used
This commit is contained in:
parent
4ff5fb6b55
commit
267db756e1
@ -22,8 +22,9 @@ CHANGELOG for FlatCAM beta
|
||||
- modified the HUD in Legacy2D when using Dark Theme to use different colors
|
||||
- modified how the graphic engine change act in Preferences: now only by clicking Apply(or Save) the change will happen. And there is also a message asking for confirmation
|
||||
- re-added the position labels in the status bar; they will be useful if HUD is Off (Altium does the same :) so learn from the best)
|
||||
|
||||
|
||||
- fixed the Tcl command Cncjob: there was a problem reported as issue #416. The command did not work due of the dpp parameter
|
||||
- modified the Tcl command Cncjob such that if some of the parameters are not used then the default values will be used (set with set_sys)
|
||||
- modified the Tcl command Drillcncjob to use the defaults when some of the parameters are not used
|
||||
|
||||
10.05.2020
|
||||
|
||||
|
@ -2869,7 +2869,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
|
||||
# Open Project
|
||||
if key == QtCore.Qt.Key_O:
|
||||
self.app.on_file_openproject()
|
||||
self.app.on_file_openproject(signal=None)
|
||||
|
||||
# Open Project
|
||||
if key == QtCore.Qt.Key_P:
|
||||
|
@ -2092,19 +2092,11 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
else:
|
||||
self.app.new_object("cncjob", outname, job_init_multi_geometry, plot=plot)
|
||||
|
||||
def generatecncjob(
|
||||
self, outname=None,
|
||||
dia=None, offset=None,
|
||||
z_cut=None, z_move=None,
|
||||
feedrate=None, feedrate_z=None, feedrate_rapid=None,
|
||||
spindlespeed=None, dwell=None, dwelltime=None,
|
||||
multidepth=None, depthperpass=None,
|
||||
toolchange=None, toolchangez=None, toolchangexy=None,
|
||||
extracut=None, extracut_length=None, startz=None, endz=None,
|
||||
pp=None,
|
||||
segx=None, segy=None,
|
||||
use_thread=True,
|
||||
plot=True):
|
||||
def generatecncjob(self, outname=None, dia=None, offset=None, z_cut=None, z_move=None,
|
||||
feedrate=None, feedrate_z=None, feedrate_rapid=None, spindlespeed=None, dwell=None, dwelltime=None,
|
||||
multidepth=None, dpp=None, toolchange=None, toolchangez=None, toolchangexy=None,
|
||||
extracut=None, extracut_length=None, startz=None, endz=None, pp=None, segx=None, segy=None,
|
||||
use_thread=True, plot=True):
|
||||
"""
|
||||
Only used by the TCL Command Cncjob.
|
||||
Creates a CNCJob out of this Geometry object. The actual
|
||||
@ -2123,7 +2115,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
:param dwell:
|
||||
:param dwelltime:
|
||||
:param multidepth:
|
||||
:param depthperpass:
|
||||
:param dpp: Depth for each pass when multidepth parameter is True
|
||||
:param toolchange:
|
||||
:param toolchangez:
|
||||
:param toolchangexy:
|
||||
@ -2150,7 +2142,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
feedrate_rapid = feedrate_rapid if feedrate_rapid is not None else float(self.options["feedrate_rapid"])
|
||||
|
||||
multidepth = multidepth if multidepth is not None else self.options["multidepth"]
|
||||
depthperpass = depthperpass if depthperpass is not None else float(self.options["depthperpass"])
|
||||
depthperpass = dpp if dpp is not None else float(self.options["depthperpass"])
|
||||
|
||||
segx = segx if segx is not None else float(self.app.defaults['geometry_segx'])
|
||||
segy = segy if segy is not None else float(self.app.defaults['geometry_segy'])
|
||||
|
@ -124,16 +124,18 @@ class TclCommandCncjob(TclCommandSignaled):
|
||||
else:
|
||||
return
|
||||
|
||||
args["dia"] = args["dia"] if "dia" in args and args["dia"] else obj.options["cnctooldia"]
|
||||
args["dia"] = args["dia"] if "dia" in args and args["dia"] else self.app.defaults["geometry_cnctooldia"]
|
||||
|
||||
args["z_cut"] = args["z_cut"] if "z_cut" in args and args["z_cut"] else obj.options["cutz"]
|
||||
args["z_move"] = args["z_move"] if "z_move" in args and args["z_move"] else obj.options["travelz"]
|
||||
args["z_cut"] = args["z_cut"] if "z_cut" in args and args["z_cut"] else self.app.defaults["geometry_cutz"]
|
||||
args["z_move"] = args["z_move"] if "z_move" in args and args["z_move"] else \
|
||||
self.app.defaults["geometry_travelz"]
|
||||
|
||||
args["feedrate"] = args["feedrate"] if "feedrate" in args and args["feedrate"] else obj.options["feedrate"]
|
||||
args["feedrate"] = args["feedrate"] if "feedrate" in args and args["feedrate"] else \
|
||||
self.app.defaults["geometry_feedrate"]
|
||||
args["feedrate_z"] = args["feedrate_z"] if "feedrate_z" in args and args["feedrate_z"] else \
|
||||
obj.options["feedrate_z"]
|
||||
self.app.defaults["geometry_feedrate_z"]
|
||||
args["feedrate_rapid"] = args["feedrate_rapid"] if "feedrate_rapid" in args and args["feedrate_rapid"] else \
|
||||
obj.options["feedrate_rapid"]
|
||||
self.app.defaults["geometry_feedrate_rapid"]
|
||||
|
||||
if "extracut_length" in args:
|
||||
args["extracut"] = True
|
||||
@ -142,20 +144,22 @@ class TclCommandCncjob(TclCommandSignaled):
|
||||
else:
|
||||
args["extracut_length"] = float(args["extracut_length"])
|
||||
else:
|
||||
args["extracut"] = False
|
||||
args["extracut"] = self.app.defaults["geometry_extracut"]
|
||||
args["extracut_length"] = self.app.defaults["geometry_extracut_length"]
|
||||
|
||||
if "dpp" in args:
|
||||
args["multidepth"] = True
|
||||
if args["dpp"] is None:
|
||||
args["dpp"] = obj.options["dpp"]
|
||||
args["dpp"] =self.app.defaults["geometry_depthperpass"]
|
||||
else:
|
||||
args["dpp"] = float(args["dpp"])
|
||||
else:
|
||||
args["multidepth"] = False
|
||||
args["multidepth"] = self.app.defaults["geometry_multidepth"]
|
||||
args["dpp"] = self.app.defaults["geometry_depthperpass"]
|
||||
|
||||
args["startz"] = args["startz"] if "startz" in args and args["startz"] else \
|
||||
self.app.defaults["geometry_startz"]
|
||||
args["endz"] = args["endz"] if "endz" in args and args["endz"] else obj.options["endz"]
|
||||
args["endz"] = args["endz"] if "endz" in args and args["endz"] else self.app.defaults["geometry_endz"]
|
||||
|
||||
args["spindlespeed"] = args["spindlespeed"] if "spindlespeed" in args and args["spindlespeed"] != 0 else None
|
||||
|
||||
@ -166,10 +170,10 @@ class TclCommandCncjob(TclCommandSignaled):
|
||||
else:
|
||||
args["dwelltime"] = float(args['dwelltime'])
|
||||
else:
|
||||
args["dwell"] = False
|
||||
args["dwelltime"] = 0.0
|
||||
args["dwell"] = self.app.defaults["geometry_dwell"]
|
||||
args["dwelltime"] = self.app.defaults["geometry_dwelltime"]
|
||||
|
||||
args["pp"] = args["pp"] if "pp" in args and args["pp"] else obj.options["ppname_g"]
|
||||
args["pp"] = args["pp"] if "pp" in args and args["pp"] else self.app.defaults["geometry_ppname_g"]
|
||||
|
||||
if "toolchangez" in args:
|
||||
args["toolchange"] = True
|
||||
@ -178,8 +182,8 @@ class TclCommandCncjob(TclCommandSignaled):
|
||||
else:
|
||||
args["toolchangez"] = obj.options["toolchangez"]
|
||||
else:
|
||||
args["toolchange"] = False
|
||||
args["toolchangez"] = 0.0
|
||||
args["toolchange"] = self.app.defaults["geometry_toolchange"]
|
||||
args["toolchangez"] = self.app.defaults["geometry_toolchangez"]
|
||||
|
||||
args["toolchangexy"] = args["toolchangexy"] if "toolchangexy" in args and args["toolchangexy"] else \
|
||||
self.app.defaults["geometry_toolchangexy"]
|
||||
@ -201,7 +205,7 @@ class TclCommandCncjob(TclCommandSignaled):
|
||||
|
||||
# HACK !!! Should be solved elsewhere!!!
|
||||
# default option for multidepth is False
|
||||
obj.options['multidepth'] = False
|
||||
# obj.options['multidepth'] = False
|
||||
|
||||
if not obj.multigeo:
|
||||
obj.generatecncjob(use_thread=False, plot=False, **args)
|
||||
|
@ -227,17 +227,24 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
||||
else:
|
||||
toolchangez = obj.options["toolchangez"]
|
||||
else:
|
||||
toolchange = False
|
||||
toolchangez = 0.0
|
||||
toolchange = self.app.defaults["excellon_toolchange"]
|
||||
toolchangez = float(self.app.defaults["excellon_toolchangez"])
|
||||
|
||||
xy_toolchange = args["toolchangexy"] if "toolchangexy" in args and args["toolchangexy"] else \
|
||||
obj.options["toolchangexy"]
|
||||
self.app.defaults["excellon_toolchangexy"]
|
||||
xy_toolchange = ','.join([xy_toolchange[0], xy_toolchange[2]])
|
||||
|
||||
endz = args["endz"] if "endz" in args and args["endz"] is not None else obj.options["endz"]
|
||||
xy_end = args["endxy"] if "endxy" in args and args["endxy"] else '0,0'
|
||||
endz = args["endz"] if "endz" in args and args["endz"] is not None else self.app.defaults["excellon_endz"]
|
||||
if "endxy" in args and args["endxy"]:
|
||||
xy_end = args["endxy"]
|
||||
else:
|
||||
if self.app.defaults["excellon_endxy"]:
|
||||
xy_end = self.app.defaults["excellon_endxy"]
|
||||
else:
|
||||
xy_end = (0, 0)
|
||||
|
||||
xy_end = ','.join([xy_end[0], xy_end[2]])
|
||||
print(xy_end)
|
||||
|
||||
opt_type = args["opt_type"] if "opt_type" in args and args["opt_type"] else 'B'
|
||||
|
||||
# ##########################################################################################
|
||||
@ -248,7 +255,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
||||
job_obj.options['Tools_in_use'] = used_tools_info
|
||||
job_obj.options['type'] = 'Excellon'
|
||||
|
||||
pp_excellon_name = args["pp"] if "pp" in args and args["pp"] else obj.options["ppname_e"]
|
||||
pp_excellon_name = args["pp"] if "pp" in args and args["pp"] else self.app.defaults["excellon_ppname_e"]
|
||||
job_obj.pp_excellon_name = pp_excellon_name
|
||||
job_obj.options['ppname_e'] = pp_excellon_name
|
||||
|
||||
@ -259,16 +266,19 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
||||
else:
|
||||
job_obj.z_depthpercut = float(obj.options["dpp"])
|
||||
else:
|
||||
job_obj.multidepth = False
|
||||
job_obj.z_depthpercut = 0.0
|
||||
job_obj.multidepth = self.app.defaults["excellon_multidepth"]
|
||||
job_obj.z_depthpercut = self.app.defaults["excellon_depthperpass"]
|
||||
|
||||
job_obj.z_move = float(args["travelz"]) if "travelz" in args and args["travelz"] else \
|
||||
self.app.defaults["excellon_travelz"]
|
||||
|
||||
job_obj.z_move = float(args["travelz"]) if "travelz" in args and args["travelz"] else obj.options["travelz"]
|
||||
job_obj.feedrate = float(args["feedrate_z"]) if "feedrate_z" in args and args["feedrate_z"] else \
|
||||
obj.options["feedrate_z"]
|
||||
self.app.defaults["excellon_feedrate_z"]
|
||||
job_obj.z_feedrate = float(args["feedrate_z"]) if "feedrate_z" in args and args["feedrate_z"] else \
|
||||
obj.options["feedrate_z"]
|
||||
self.app.defaults["excellon_feedrate_z"]
|
||||
|
||||
job_obj.feedrate_rapid = float(args["feedrate_rapid"]) \
|
||||
if "feedrate_rapid" in args and args["feedrate_rapid"] else obj.options["feedrate_rapid"]
|
||||
if "feedrate_rapid" in args and args["feedrate_rapid"] else self.app.defaults["excellon_feedrate_rapid"]
|
||||
|
||||
job_obj.spindlespeed = float(args["spindlespeed"]) if "spindlespeed" in args else None
|
||||
job_obj.spindledir = self.app.defaults['excellon_spindledir']
|
||||
@ -277,10 +287,10 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
||||
if args['dwelltime'] is not None:
|
||||
job_obj.dwelltime = float(args['dwelltime'])
|
||||
else:
|
||||
job_obj.dwelltime = float(obj.options["dwelltime"])
|
||||
job_obj.dwelltime = float(self.app.defaults["excellon_dwelltime"])
|
||||
else:
|
||||
job_obj.dwell = False
|
||||
job_obj.dwelltime = 0.0
|
||||
job_obj.dwell = self.app.defaults["excellon_dwell"]
|
||||
job_obj.dwelltime = self.app.defaults["excellon_dwelltime"]
|
||||
|
||||
job_obj.toolchange_xy_type = "excellon"
|
||||
job_obj.coords_decimals = int(self.app.defaults["cncjob_coords_decimals"])
|
||||
@ -295,7 +305,15 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
||||
job_obj.toolchange = toolchange
|
||||
job_obj.xy_toolchange = xy_toolchange
|
||||
job_obj.z_toolchange = float(toolchangez)
|
||||
job_obj.startz = float(args["startz"]) if "endz" in args and args["endz"] is not None else (0, 0)
|
||||
|
||||
if "startz" in args and args["startz"] is not None:
|
||||
job_obj.startz = float(args["startz"])
|
||||
else:
|
||||
if self.app.defaults["excellon_startz"]:
|
||||
job_obj.startz = self.app.defaults["excellon_startz"]
|
||||
else:
|
||||
job_obj.startz = (0, 0)
|
||||
|
||||
job_obj.endz = float(endz)
|
||||
job_obj.xy_end = xy_end
|
||||
job_obj.excellon_optimization_type = opt_type
|
||||
|
Loading…
Reference in New Issue
Block a user