- in Excellon Editor added a protection for Tool_dia field in case numbers using comma as decimal separator are used. Also added a QDoubleValidator forcing a number with max 4 decimals and from 0.0000 to 9.9999
- in Excellon Editor added a shortcut key 'T' that popup a window allowing to enter a new Tool with the set diameter - in App added a shortcut key 'T' that popup a windows allowing to enter a new Tool with set diameter only when the Selected tab is on focus and only if a Geometry object is selected - changed the shortcut key for Transform Tool from 'T' to 'ALT+T' - fixed bug in Geometry Selected tab that generated error when used tool offset was less than half of either total length or half of total width. Now the app signal the issue with a status bar message - added Double Validator for the Offset value so only float numbers can be entered. - in App added a shortcut key 'T' that popup a windows allowing to enter a new Tool with set diameter only when the Tool tab is on focus and only if a NCC Tool or Paint Area Tool object is installed in the Tool Tab
This commit is contained in:
135
FlatCAMObj.py
135
FlatCAMObj.py
@@ -480,7 +480,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||
|
||||
def geo_init(geo_obj, app_obj):
|
||||
assert isinstance(geo_obj, FlatCAMGeometry)
|
||||
bounding_box = self.solid_geometry.envelope.buffer(self.options["noncoppermargin"])
|
||||
bounding_box = self.solid_geometry.envelope.buffer(float(self.options["noncoppermargin"]))
|
||||
if not self.options["noncopperrounded"]:
|
||||
bounding_box = bounding_box.envelope
|
||||
non_copper = bounding_box.difference(self.solid_geometry)
|
||||
@@ -497,7 +497,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||
def geo_init(geo_obj, app_obj):
|
||||
assert isinstance(geo_obj, FlatCAMGeometry)
|
||||
# Bounding box with rounded corners
|
||||
bounding_box = self.solid_geometry.envelope.buffer(self.options["bboxmargin"])
|
||||
bounding_box = self.solid_geometry.envelope.buffer(float(self.options["bboxmargin"]))
|
||||
if not self.options["bboxrounded"]: # Remove rounded corners
|
||||
bounding_box = bounding_box.envelope
|
||||
geo_obj.solid_geometry = bounding_box
|
||||
@@ -557,7 +557,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||
|
||||
def follow_init(follow_obj, app):
|
||||
# Propagate options
|
||||
follow_obj.options["cnctooldia"] = self.options["isotooldia"]
|
||||
follow_obj.options["cnctooldia"] = float(self.options["isotooldia"])
|
||||
follow_obj.solid_geometry = self.solid_geometry
|
||||
|
||||
# TODO: Do something if this is None. Offer changing name?
|
||||
@@ -579,11 +579,11 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||
:return: None
|
||||
"""
|
||||
if dia is None:
|
||||
dia = self.options["isotooldia"]
|
||||
dia = float(self.options["isotooldia"])
|
||||
if passes is None:
|
||||
passes = int(self.options["isopasses"])
|
||||
if overlap is None:
|
||||
overlap = self.options["isooverlap"]
|
||||
overlap = float(self.options["isooverlap"])
|
||||
if combine is None:
|
||||
combine = self.options["combine_passes"]
|
||||
else:
|
||||
@@ -638,7 +638,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||
# TODO: This is ugly. Create way to pass data into init function.
|
||||
def iso_init(geo_obj, app_obj):
|
||||
# Propagate options
|
||||
geo_obj.options["cnctooldia"] = self.options["isotooldia"]
|
||||
geo_obj.options["cnctooldia"] = float(self.options["isotooldia"])
|
||||
geo_obj.solid_geometry = []
|
||||
for i in range(passes):
|
||||
iso_offset = (((2 * i + 1) / 2.0) * dia) - (i * overlap * dia)
|
||||
@@ -693,7 +693,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||
# TODO: This is ugly. Create way to pass data into init function.
|
||||
def iso_init(geo_obj, app_obj):
|
||||
# Propagate options
|
||||
geo_obj.options["cnctooldia"] = self.options["isotooldia"]
|
||||
geo_obj.options["cnctooldia"] = float(self.options["isotooldia"])
|
||||
|
||||
# if milling type is climb then the move is counter-clockwise around features
|
||||
if milling_type == 'cl':
|
||||
@@ -753,8 +753,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||
|
||||
factor = Gerber.convert_units(self, units)
|
||||
|
||||
self.options['isotooldia'] *= factor
|
||||
self.options['bboxmargin'] *= factor
|
||||
self.options['isotooldia'] = float(self.options['isotooldia']) * factor
|
||||
self.options['bboxmargin'] = float(self.options['bboxmargin']) * factor
|
||||
|
||||
def plot(self, **kwargs):
|
||||
"""
|
||||
@@ -1458,7 +1458,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
||||
outname = self.options["name"] + "_mill"
|
||||
|
||||
if tooldia is None:
|
||||
tooldia = self.options["tooldia"]
|
||||
tooldia = float(self.options["tooldia"])
|
||||
|
||||
# Sort tools by diameter. items() -> [('name', diameter), ...]
|
||||
# sorted_tools = sorted(list(self.tools.items()), key=lambda tl: tl[1]) # no longer works in Python3
|
||||
@@ -1545,7 +1545,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
||||
outname = self.options["name"] + "_mill"
|
||||
|
||||
if tooldia is None:
|
||||
tooldia = self.options["slot_tooldia"]
|
||||
tooldia = float(self.options["slot_tooldia"])
|
||||
|
||||
# Sort tools by diameter. items() -> [('name', diameter), ...]
|
||||
# sorted_tools = sorted(list(self.tools.items()), key=lambda tl: tl[1]) # no longer works in Python3
|
||||
@@ -1693,13 +1693,13 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
||||
job_obj.options['ppname_e'] = pp_excellon_name
|
||||
|
||||
app_obj.progress.emit(20)
|
||||
job_obj.z_cut = self.options["drillz"]
|
||||
job_obj.z_move = self.options["travelz"]
|
||||
job_obj.feedrate = self.options["feedrate"]
|
||||
job_obj.feedrate_rapid = self.options["feedrate_rapid"]
|
||||
job_obj.spindlespeed = self.options["spindlespeed"]
|
||||
job_obj.z_cut = float(self.options["drillz"])
|
||||
job_obj.z_move = float(self.options["travelz"])
|
||||
job_obj.feedrate = float(self.options["feedrate"])
|
||||
job_obj.feedrate_rapid = float(self.options["feedrate_rapid"])
|
||||
job_obj.spindlespeed = float(self.options["spindlespeed"])
|
||||
job_obj.dwell = self.options["dwell"]
|
||||
job_obj.dwelltime = self.options["dwelltime"]
|
||||
job_obj.dwelltime = float(self.options["dwelltime"])
|
||||
job_obj.pp_excellon_name = pp_excellon_name
|
||||
|
||||
job_obj.toolchange_xy_type = "excellon"
|
||||
@@ -1738,12 +1738,13 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
||||
|
||||
tools_csv = ','.join(tools)
|
||||
ret_val = job_obj.generate_from_excellon_by_tool(self, tools_csv,
|
||||
drillz=self.options['drillz'],
|
||||
toolchange=self.options["toolchange"],
|
||||
drillz=float(self.options['drillz']),
|
||||
toolchange=float(self.options["toolchange"]),
|
||||
toolchangexy=self.app.defaults["excellon_toolchangexy"],
|
||||
toolchangez=self.options["toolchangez"],
|
||||
startz=self.options["startz"],
|
||||
endz=self.options["endz"],
|
||||
toolchangez=float(self.options["toolchangez"]),
|
||||
startz=float(self.options["startz"]) if
|
||||
self.options["startz"] else None,
|
||||
endz=float(self.options["endz"]),
|
||||
excellon_optimization_type=self.app.defaults[
|
||||
"excellon_optimization_type"])
|
||||
if ret_val == 'fail':
|
||||
@@ -1783,11 +1784,11 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
||||
def convert_units(self, units):
|
||||
factor = Excellon.convert_units(self, units)
|
||||
|
||||
self.options['drillz'] *= factor
|
||||
self.options['travelz'] *= factor
|
||||
self.options['feedrate'] *= factor
|
||||
self.options['feedrate_rapid'] *= factor
|
||||
self.options['toolchangez'] *= factor
|
||||
self.options['drillz'] = float(self.options['drillz']) * factor
|
||||
self.options['travelz'] = float(self.options['travelz']) * factor
|
||||
self.options['feedrate'] = float(self.options['feedrate']) * factor
|
||||
self.options['feedrate_rapid'] = float(self.options['feedrate_rapid']) * factor
|
||||
self.options['toolchangez'] = float(self.options['toolchangez']) * factor
|
||||
|
||||
if self.app.defaults["excellon_toolchangexy"] == '':
|
||||
self.options['toolchangexy'] = "0.0, 0.0"
|
||||
@@ -1802,8 +1803,8 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
||||
self.options['toolchangexy'] = "%f, %f" % (coords_xy[0], coords_xy[1])
|
||||
|
||||
if self.options['startz'] is not None:
|
||||
self.options['startz'] *= factor
|
||||
self.options['endz'] *= factor
|
||||
self.options['startz'] = float(self.options['startz']) * factor
|
||||
self.options['endz'] = float(self.options['endz']) * factor
|
||||
|
||||
def plot(self):
|
||||
|
||||
@@ -2271,7 +2272,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
||||
if not self.tools:
|
||||
self.tools.update({
|
||||
self.tooluid: {
|
||||
'tooldia': self.options["cnctooldia"],
|
||||
'tooldia': float(self.options["cnctooldia"]),
|
||||
'offset': 'Path',
|
||||
'offset_value': 0.0,
|
||||
'type': 'Rough',
|
||||
@@ -2816,8 +2817,28 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
||||
self.ui.cutz_entry.setDisabled(False)
|
||||
|
||||
def update_cutz(self):
|
||||
vdia = float(self.ui.tipdia_entry.get_value())
|
||||
half_vangle = float(self.ui.tipangle_entry.get_value()) / 2
|
||||
try:
|
||||
vdia = float(self.ui.tipdia_entry.get_value())
|
||||
except ValueError:
|
||||
# try to convert comma to decimal point. if it's still not working error message and return
|
||||
try:
|
||||
vdia = float(self.ui.tipdia_entry.get_value().replace(',', '.'))
|
||||
except ValueError:
|
||||
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
|
||||
"use a number.")
|
||||
return
|
||||
|
||||
try:
|
||||
half_vangle = float(self.ui.tipangle_entry.get_value()) / 2
|
||||
except ValueError:
|
||||
# try to convert comma to decimal point. if it's still not working error message and return
|
||||
try:
|
||||
half_vangle = float(self.ui.tipangle_entry.get_value().replace(',', '.')) / 2
|
||||
except ValueError:
|
||||
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
|
||||
"use a number.")
|
||||
return
|
||||
|
||||
|
||||
row = self.ui.geo_tools_table.currentRow()
|
||||
tool_uid = int(self.ui.geo_tools_table.item(row, 5).text())
|
||||
@@ -3615,36 +3636,36 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
||||
:return: None
|
||||
"""
|
||||
|
||||
tooldia = tooldia if tooldia else self.options["cnctooldia"]
|
||||
outname = outname if outname is not None else self.options["name"]
|
||||
tooldia = tooldia if tooldia else float(self.options["cnctooldia"])
|
||||
outname = outname if outname is not None else float(self.options["name"])
|
||||
|
||||
z_cut = z_cut if z_cut is not None else self.options["cutz"]
|
||||
z_move = z_move if z_move is not None else self.options["travelz"]
|
||||
z_cut = z_cut if z_cut is not None else float(self.options["cutz"])
|
||||
z_move = z_move if z_move is not None else float(self.options["travelz"])
|
||||
|
||||
feedrate = feedrate if feedrate is not None else self.options["feedrate"]
|
||||
feedrate_z = feedrate_z if feedrate_z is not None else self.options["feedrate_z"]
|
||||
feedrate_rapid = feedrate_rapid if feedrate_rapid is not None else self.options["feedrate_rapid"]
|
||||
feedrate = feedrate if feedrate is not None else float(self.options["feedrate"])
|
||||
feedrate_z = feedrate_z if feedrate_z is not None else float(self.options["feedrate_z"])
|
||||
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 self.options["depthperpass"]
|
||||
depthperpass = depthperpass if depthperpass 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'])
|
||||
|
||||
extracut = extracut if extracut is not None else self.options["extracut"]
|
||||
startz = startz if startz is not None else self.options["startz"]
|
||||
endz = endz if endz is not None else self.options["endz"]
|
||||
extracut = extracut if extracut is not None else float(self.options["extracut"])
|
||||
startz = startz if startz is not None else float(self.options["startz"])
|
||||
endz = endz if endz is not None else float(self.options["endz"])
|
||||
|
||||
toolchangez = toolchangez if toolchangez else self.options["toolchangez"]
|
||||
toolchangez = toolchangez if toolchangez else float(self.options["toolchangez"])
|
||||
toolchangexy = toolchangexy if toolchangexy else self.options["toolchangexy"]
|
||||
toolchange = toolchange if toolchange else self.options["toolchange"]
|
||||
|
||||
offset = offset if offset else 0.0
|
||||
|
||||
# int or None.
|
||||
spindlespeed = spindlespeed if spindlespeed else self.options['spindlespeed']
|
||||
spindlespeed = spindlespeed if spindlespeed else int(self.options['spindlespeed'])
|
||||
dwell = dwell if dwell else self.options["dwell"]
|
||||
dwelltime = dwelltime if dwelltime else self.options["dwelltime"]
|
||||
dwelltime = dwelltime if dwelltime else float(self.options["dwelltime"])
|
||||
|
||||
ppname_g = ppname_g if ppname_g else self.options["ppname_g"]
|
||||
|
||||
@@ -3827,19 +3848,19 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
||||
|
||||
factor = Geometry.convert_units(self, units)
|
||||
|
||||
self.options['cutz'] *= factor
|
||||
self.options['depthperpass'] *= factor
|
||||
self.options['travelz'] *= factor
|
||||
self.options['feedrate'] *= factor
|
||||
self.options['feedrate_z'] *= factor
|
||||
self.options['feedrate_rapid'] *= factor
|
||||
self.options['endz'] *= factor
|
||||
self.options['cutz'] = float(self.options['cutz']) * factor
|
||||
self.options['depthperpass'] = float(self.options['depthperpass']) * factor
|
||||
self.options['travelz'] = float(self.options['travelz']) * factor
|
||||
self.options['feedrate'] = float(self.options['feedrate']) * factor
|
||||
self.options['feedrate_z'] = float(self.options['feedrate_z']) * factor
|
||||
self.options['feedrate_rapid'] = float(self.options['feedrate_rapid']) * factor
|
||||
self.options['endz'] = float(self.options['endz']) * factor
|
||||
# self.options['cnctooldia'] *= factor
|
||||
# self.options['painttooldia'] *= factor
|
||||
# self.options['paintmargin'] *= factor
|
||||
# self.options['paintoverlap'] *= factor
|
||||
|
||||
self.options["toolchangez"] *= factor
|
||||
self.options["toolchangez"] = float(self.options["toolchangez"]) * factor
|
||||
|
||||
if self.app.defaults["geometry_toolchangexy"] == '':
|
||||
self.options['toolchangexy'] = "0.0, 0.0"
|
||||
@@ -3854,7 +3875,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
||||
self.options['toolchangexy'] = "%f, %f" % (coords_xy[0], coords_xy[1])
|
||||
|
||||
if self.options['startz'] is not None:
|
||||
self.options['startz'] *= factor
|
||||
self.options['startz'] = float(self.options['startz']) * factor
|
||||
|
||||
param_list = ['cutz', 'depthperpass', 'travelz', 'feedrate', 'feedrate_z', 'feedrate_rapid',
|
||||
'endz', 'toolchangez']
|
||||
@@ -4582,7 +4603,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||
|
||||
try:
|
||||
if self.multitool is False: # single tool usage
|
||||
self.plot2(tooldia=self.options["tooldia"], obj=self, visible=visible, kind=kind)
|
||||
self.plot2(tooldia=float(self.options["tooldia"]), obj=self, visible=visible, kind=kind)
|
||||
else:
|
||||
# multiple tools usage
|
||||
for tooluid_key in self.cnc_tools:
|
||||
@@ -4597,7 +4618,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||
def convert_units(self, units):
|
||||
factor = CNCjob.convert_units(self, units)
|
||||
FlatCAMApp.App.log.debug("FlatCAMCNCjob.convert_units()")
|
||||
self.options["tooldia"] *= factor
|
||||
self.options["tooldia"] = float(self.options["tooldia"]) * factor
|
||||
|
||||
param_list = ['cutz', 'depthperpass', 'travelz', 'feedrate', 'feedrate_z', 'feedrate_rapid',
|
||||
'endz', 'toolchangez']
|
||||
|
||||
Reference in New Issue
Block a user