Merge remote-tracking branch 'origin/Beta' into Beta
This commit is contained in:
@@ -46,4 +46,3 @@ class LoudDict(dict):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
|
|
||||||
|
|||||||
162
FlatCAMObj.py
162
FlatCAMObj.py
@@ -35,9 +35,9 @@ class ValidationError(Exception):
|
|||||||
|
|
||||||
self.errors = errors
|
self.errors = errors
|
||||||
|
|
||||||
# ##################################### ##
|
# #######################################
|
||||||
# # FlatCAMObj # ##
|
# # FlatCAMObj ##
|
||||||
# ##################################### ##
|
# #######################################
|
||||||
|
|
||||||
|
|
||||||
class FlatCAMObj(QtCore.QObject):
|
class FlatCAMObj(QtCore.QObject):
|
||||||
@@ -581,7 +581,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
try:
|
try:
|
||||||
# if connected, disconnect the signal from the slot on item_changed as it creates issues
|
# if connected, disconnect the signal from the slot on item_changed as it creates issues
|
||||||
self.ui.apertures_table.itemChanged.disconnect()
|
self.ui.apertures_table.itemChanged.disconnect()
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.apertures_row = 0
|
self.apertures_row = 0
|
||||||
@@ -903,7 +903,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
geo_obj.options["cnctooldia"] = str(self.options["isotooldia"])
|
geo_obj.options["cnctooldia"] = str(self.options["isotooldia"])
|
||||||
geo_obj.solid_geometry = []
|
geo_obj.solid_geometry = []
|
||||||
for i in range(passes):
|
for i in range(passes):
|
||||||
iso_offset = (((2 * i + 1) / 2.0) * dia) - (i * overlap * dia)
|
iso_offset = dia * ((2 * i + 1) / 2.0) - (i * overlap * dia)
|
||||||
|
|
||||||
# if milling type is climb then the move is counter-clockwise around features
|
# if milling type is climb then the move is counter-clockwise around features
|
||||||
if milling_type == 'cl':
|
if milling_type == 'cl':
|
||||||
@@ -929,6 +929,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
empty_cnt += 1
|
empty_cnt += 1
|
||||||
|
|
||||||
if empty_cnt == len(geo_obj.solid_geometry):
|
if empty_cnt == len(geo_obj.solid_geometry):
|
||||||
raise ValidationError("Empty Geometry", None)
|
raise ValidationError("Empty Geometry", None)
|
||||||
geo_obj.multigeo = False
|
geo_obj.multigeo = False
|
||||||
@@ -938,7 +939,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
else:
|
else:
|
||||||
for i in range(passes):
|
for i in range(passes):
|
||||||
|
|
||||||
offset = (2 * i + 1) / 2.0 * dia - i * overlap * dia
|
offset = dia * ((2 * i + 1) / 2.0) - (i * overlap * dia)
|
||||||
if passes > 1:
|
if passes > 1:
|
||||||
if self.iso_type == 0:
|
if self.iso_type == 0:
|
||||||
iso_name = self.options["name"] + "_ext_iso" + str(i + 1)
|
iso_name = self.options["name"] + "_ext_iso" + str(i + 1)
|
||||||
@@ -1645,7 +1646,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
|||||||
if option is not 'name':
|
if option is not 'name':
|
||||||
try:
|
try:
|
||||||
exc_final.options[option] = exc.options[option]
|
exc_final.options[option] = exc.options[option]
|
||||||
except:
|
except Exception as e:
|
||||||
exc.app.log.warning("Failed to copy option.", option)
|
exc.app.log.warning("Failed to copy option.", option)
|
||||||
|
|
||||||
for drill in exc.drills:
|
for drill in exc.drills:
|
||||||
@@ -1789,7 +1790,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
|||||||
try:
|
try:
|
||||||
# if connected, disconnect the signal from the slot on item_changed as it creates issues
|
# if connected, disconnect the signal from the slot on item_changed as it creates issues
|
||||||
self.ui.tools_table.itemChanged.disconnect()
|
self.ui.tools_table.itemChanged.disconnect()
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
n = len(self.tools)
|
n = len(self.tools)
|
||||||
@@ -2074,12 +2075,12 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
|||||||
for row in range(self.ui.tools_table.rowCount()):
|
for row in range(self.ui.tools_table.rowCount()):
|
||||||
try:
|
try:
|
||||||
self.ui.tools_table.cellWidget(row, 5).clicked.disconnect()
|
self.ui.tools_table.cellWidget(row, 5).clicked.disconnect()
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.ui.plot_cb.stateChanged.disconnect()
|
self.ui.plot_cb.stateChanged.disconnect()
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def on_tool_offset_edit(self):
|
def on_tool_offset_edit(self):
|
||||||
@@ -2961,7 +2962,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
})
|
})
|
||||||
|
|
||||||
if "cnctooldia" not in self.options:
|
if "cnctooldia" not in self.options:
|
||||||
self.options["cnctooldia"] = self.app.defaults["geometry_cnctooldia"]
|
self.options["cnctooldia"] = self.app.defaults["geometry_cnctooldia"]
|
||||||
# try:
|
# try:
|
||||||
# self.options["cnctooldia"] = [
|
# self.options["cnctooldia"] = [
|
||||||
# float(eval(dia)) for dia in str(self.app.defaults["geometry_cnctooldia"]).split(",")
|
# float(eval(dia)) for dia in str(self.app.defaults["geometry_cnctooldia"]).split(",")
|
||||||
@@ -3257,7 +3258,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
self.tools.update({
|
self.tools.update({
|
||||||
self.tooluid: {
|
self.tooluid: {
|
||||||
'tooldia': float(toold),
|
'tooldia': float(toold),
|
||||||
'offset': ('Path'),
|
'offset': 'Path',
|
||||||
'offset_value': 0.0,
|
'offset_value': 0.0,
|
||||||
'type': _('Rough'),
|
'type': _('Rough'),
|
||||||
'tool_type': 'C1',
|
'tool_type': 'C1',
|
||||||
@@ -3340,7 +3341,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
tool_offset = self.ui.geo_tools_table.cellWidget(current_row, 2)
|
tool_offset = self.ui.geo_tools_table.cellWidget(current_row, 2)
|
||||||
if tool_offset is not None:
|
if tool_offset is not None:
|
||||||
tool_offset_txt = tool_offset.currentText()
|
tool_offset_txt = tool_offset.currentText()
|
||||||
if tool_offset_txt == ('Custom'):
|
if tool_offset_txt == 'Custom':
|
||||||
self.ui.tool_offset_entry.show()
|
self.ui.tool_offset_entry.show()
|
||||||
self.ui.tool_offset_lbl.show()
|
self.ui.tool_offset_lbl.show()
|
||||||
else:
|
else:
|
||||||
@@ -3580,7 +3581,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
# we do this HACK to make sure the tools attribute to be serialized is updated in the self.ser_attrs list
|
# we do this HACK to make sure the tools attribute to be serialized is updated in the self.ser_attrs list
|
||||||
try:
|
try:
|
||||||
self.ser_attrs.remove('tools')
|
self.ser_attrs.remove('tools')
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
self.ser_attrs.append('tools')
|
self.ser_attrs.append('tools')
|
||||||
|
|
||||||
@@ -3689,7 +3690,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
try:
|
try:
|
||||||
self.ser_attrs.remove('tools')
|
self.ser_attrs.remove('tools')
|
||||||
self.ser_attrs.append('tools')
|
self.ser_attrs.append('tools')
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.app.inform.emit(_(
|
self.app.inform.emit(_(
|
||||||
@@ -3723,9 +3724,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
self.tools = deepcopy(temp_tools)
|
self.tools = deepcopy(temp_tools)
|
||||||
temp_tools.clear()
|
temp_tools.clear()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.app.inform.emit(_(
|
self.app.inform.emit(_("[WARNING_NOTCL] Failed. Select a tool to delete."))
|
||||||
"[WARNING_NOTCL] Failed. Select a tool to delete."
|
|
||||||
))
|
|
||||||
self.build_ui()
|
self.build_ui()
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -3733,9 +3732,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
# deselect the table
|
# deselect the table
|
||||||
# self.ui.geo_tools_table.clearSelection()
|
# self.ui.geo_tools_table.clearSelection()
|
||||||
else:
|
else:
|
||||||
self.app.inform.emit(_(
|
self.app.inform.emit(_("[WARNING_NOTCL] Failed. Select a tool to delete."))
|
||||||
"[WARNING_NOTCL] Failed. Select a tool to delete."
|
|
||||||
))
|
|
||||||
self.build_ui()
|
self.build_ui()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
@@ -3752,14 +3749,12 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
# we do this HACK to make sure the tools attribute to be serialized is updated in the self.ser_attrs list
|
# we do this HACK to make sure the tools attribute to be serialized is updated in the self.ser_attrs list
|
||||||
try:
|
try:
|
||||||
self.ser_attrs.remove('tools')
|
self.ser_attrs.remove('tools')
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
self.ser_attrs.append('tools')
|
self.ser_attrs.append('tools')
|
||||||
|
|
||||||
self.build_ui()
|
self.build_ui()
|
||||||
self.app.inform.emit(_(
|
self.app.inform.emit(_("[success] Tool was deleted in Tool Table."))
|
||||||
"[success] Tool was deleted in Tool Table."
|
|
||||||
))
|
|
||||||
|
|
||||||
obj_active = self.app.collection.get_active()
|
obj_active = self.app.collection.get_active()
|
||||||
# if the object was MultiGeo and now it has no tool at all (therefore no geometry)
|
# if the object was MultiGeo and now it has no tool at all (therefore no geometry)
|
||||||
@@ -3778,7 +3773,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
obj_active.options['ymin'] = ymin
|
obj_active.options['ymin'] = ymin
|
||||||
obj_active.options['xmax'] = xmax
|
obj_active.options['xmax'] = xmax
|
||||||
obj_active.options['ymax'] = ymax
|
obj_active.options['ymax'] = ymax
|
||||||
except:
|
except Exception as e:
|
||||||
obj_active.options['xmin'] = 0
|
obj_active.options['xmin'] = 0
|
||||||
obj_active.options['ymin'] = 0
|
obj_active.options['ymin'] = 0
|
||||||
obj_active.options['xmax'] = 0
|
obj_active.options['xmax'] = 0
|
||||||
@@ -3793,7 +3788,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
if row is None:
|
if row is None:
|
||||||
try:
|
try:
|
||||||
current_row = self.ui.geo_tools_table.currentRow()
|
current_row = self.ui.geo_tools_table.currentRow()
|
||||||
except:
|
except Exception as e:
|
||||||
current_row = 0
|
current_row = 0
|
||||||
else:
|
else:
|
||||||
current_row = row
|
current_row = row
|
||||||
@@ -3889,7 +3884,6 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
))
|
))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
row = self.ui.geo_tools_table.currentRow()
|
row = self.ui.geo_tools_table.currentRow()
|
||||||
tool_uid = int(self.ui.geo_tools_table.item(row, 5).text())
|
tool_uid = int(self.ui.geo_tools_table.item(row, 5).text())
|
||||||
|
|
||||||
@@ -3916,7 +3910,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
cb_txt = cw.currentText()
|
cb_txt = cw.currentText()
|
||||||
if cw_col == 2:
|
if cw_col == 2:
|
||||||
tooluid_value['offset'] = cb_txt
|
tooluid_value['offset'] = cb_txt
|
||||||
if cb_txt == ('Custom'):
|
if cb_txt == 'Custom':
|
||||||
self.ui.tool_offset_entry.show()
|
self.ui.tool_offset_entry.show()
|
||||||
self.ui.tool_offset_lbl.show()
|
self.ui.tool_offset_lbl.show()
|
||||||
else:
|
else:
|
||||||
@@ -3962,7 +3956,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
widget_changed = self.sender()
|
widget_changed = self.sender()
|
||||||
try:
|
try:
|
||||||
widget_idx = self.ui.grid3.indexOf(widget_changed)
|
widget_idx = self.ui.grid3.indexOf(widget_changed)
|
||||||
except:
|
except Exception as e:
|
||||||
return
|
return
|
||||||
|
|
||||||
# those are the indexes for the V-Tip Dia and V-Tip Angle, if edited calculate the new Cut Z
|
# those are the indexes for the V-Tip Dia and V-Tip Angle, if edited calculate the new Cut Z
|
||||||
@@ -3997,8 +3991,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
# try to convert comma to decimal point. if it's still not working error message and return
|
# try to convert comma to decimal point. if it's still not working error message and return
|
||||||
try:
|
try:
|
||||||
offset_value_item = float(self.ui.tool_offset_entry.get_value().replace(',', '.')
|
offset_value_item = float(self.ui.tool_offset_entry.get_value().replace(',', '.'))
|
||||||
)
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_(
|
self.app.inform.emit(_(
|
||||||
"[ERROR_NOTCL] Wrong value format entered, "
|
"[ERROR_NOTCL] Wrong value format entered, "
|
||||||
@@ -4090,7 +4083,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
for tool in self.tools:
|
for tool in self.tools:
|
||||||
multigeo_solid_geometry += self.tools[tool]['solid_geometry']
|
multigeo_solid_geometry += self.tools[tool]['solid_geometry']
|
||||||
else:
|
else:
|
||||||
multigeo_solid_geometry = self.solid_geometry
|
multigeo_solid_geometry = self.solid_geometry
|
||||||
|
|
||||||
for geo in multigeo_solid_geometry:
|
for geo in multigeo_solid_geometry:
|
||||||
if type(geo) == list:
|
if type(geo) == list:
|
||||||
@@ -4130,7 +4123,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
txt = self.ui.geo_tools_table.item(x.row(), column).text()
|
txt = self.ui.geo_tools_table.item(x.row(), column).text()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
txt = self.ui.geo_tools_table.cellWidget(x.row(), column).currentText()
|
txt = self.ui.geo_tools_table.cellWidget(x.row(), column).currentText()
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
r.append(txt)
|
r.append(txt)
|
||||||
table_tools_items.append(r)
|
table_tools_items.append(r)
|
||||||
@@ -4365,7 +4358,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
endz = data_value
|
endz = data_value
|
||||||
|
|
||||||
if data_key == "toolchangez":
|
if data_key == "toolchangez":
|
||||||
toolchangez =data_value
|
toolchangez = data_value
|
||||||
if data_key == "toolchangexy":
|
if data_key == "toolchangexy":
|
||||||
toolchangexy = data_value
|
toolchangexy = data_value
|
||||||
if data_key == "toolchange":
|
if data_key == "toolchange":
|
||||||
@@ -4398,13 +4391,13 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
diadict_key: datadict
|
diadict_key: datadict
|
||||||
})
|
})
|
||||||
|
|
||||||
if dia_cnc_dict['offset'] == ('in'):
|
if dia_cnc_dict['offset'] == 'in':
|
||||||
tool_offset = -dia_cnc_dict['tooldia'] / 2
|
tool_offset = -dia_cnc_dict['tooldia'] / 2
|
||||||
offset_str = 'inside'
|
offset_str = 'inside'
|
||||||
elif dia_cnc_dict['offset'].lower() == ('out'):
|
elif dia_cnc_dict['offset'].lower() == 'out':
|
||||||
tool_offset = dia_cnc_dict['tooldia'] / 2
|
tool_offset = dia_cnc_dict['tooldia'] / 2
|
||||||
offset_str = 'outside'
|
offset_str = 'outside'
|
||||||
elif dia_cnc_dict['offset'].lower() == ('path'):
|
elif dia_cnc_dict['offset'].lower() == 'path':
|
||||||
offset_str = 'onpath'
|
offset_str = 'onpath'
|
||||||
tool_offset = 0.0
|
tool_offset = 0.0
|
||||||
else:
|
else:
|
||||||
@@ -4414,8 +4407,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
# try to convert comma to decimal point. if it's still not working error message and return
|
# try to convert comma to decimal point. if it's still not working error message and return
|
||||||
try:
|
try:
|
||||||
offset_value = float(self.ui.tool_offset_entry.get_value().replace(',', '.')
|
offset_value = float(self.ui.tool_offset_entry.get_value().replace(',', '.'))
|
||||||
)
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_(
|
self.app.inform.emit(_(
|
||||||
"[ERROR_NOTCL] Wrong value format entered, "
|
"[ERROR_NOTCL] Wrong value format entered, "
|
||||||
@@ -4590,7 +4582,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
|
|
||||||
if diadict_key == 'data':
|
if diadict_key == 'data':
|
||||||
for data_key, data_value in diadict_value.items():
|
for data_key, data_value in diadict_value.items():
|
||||||
if data_key == "multidepth":
|
if data_key == "multidepth":
|
||||||
multidepth = data_value
|
multidepth = data_value
|
||||||
if data_key == "depthperpass":
|
if data_key == "depthperpass":
|
||||||
depthpercut = data_value
|
depthpercut = data_value
|
||||||
@@ -4603,7 +4595,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
endz = data_value
|
endz = data_value
|
||||||
|
|
||||||
if data_key == "toolchangez":
|
if data_key == "toolchangez":
|
||||||
toolchangez =data_value
|
toolchangez = data_value
|
||||||
if data_key == "toolchangexy":
|
if data_key == "toolchangexy":
|
||||||
toolchangexy = data_value
|
toolchangexy = data_value
|
||||||
if data_key == "toolchange":
|
if data_key == "toolchange":
|
||||||
@@ -4636,13 +4628,13 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
diadict_key: datadict
|
diadict_key: datadict
|
||||||
})
|
})
|
||||||
|
|
||||||
if dia_cnc_dict['offset'] == ('in'):
|
if dia_cnc_dict['offset'] == 'in':
|
||||||
tool_offset = -dia_cnc_dict['tooldia'] / 2
|
tool_offset = -dia_cnc_dict['tooldia'] / 2
|
||||||
offset_str = 'inside'
|
offset_str = 'inside'
|
||||||
elif dia_cnc_dict['offset'].lower() == ('out'):
|
elif dia_cnc_dict['offset'].lower() == 'out':
|
||||||
tool_offset = dia_cnc_dict['tooldia'] / 2
|
tool_offset = dia_cnc_dict['tooldia'] / 2
|
||||||
offset_str = 'outside'
|
offset_str = 'outside'
|
||||||
elif dia_cnc_dict['offset'].lower() == ('path'):
|
elif dia_cnc_dict['offset'].lower() == 'path':
|
||||||
offset_str = 'onpath'
|
offset_str = 'onpath'
|
||||||
tool_offset = 0.0
|
tool_offset = 0.0
|
||||||
else:
|
else:
|
||||||
@@ -4652,23 +4644,17 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
# try to convert comma to decimal point. if it's still not working error message and return
|
# try to convert comma to decimal point. if it's still not working error message and return
|
||||||
try:
|
try:
|
||||||
offset_value = float(self.ui.tool_offset_entry.get_value().replace(',', '.')
|
offset_value = float(self.ui.tool_offset_entry.get_value().replace(',', '.'))
|
||||||
)
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_(
|
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
|
||||||
"[ERROR_NOTCL] Wrong value format entered, "
|
"use a number."))
|
||||||
"use a number."
|
|
||||||
))
|
|
||||||
return
|
return
|
||||||
if offset_value:
|
if offset_value:
|
||||||
tool_offset = float(offset_value)
|
tool_offset = float(offset_value)
|
||||||
else:
|
else:
|
||||||
self.app.inform.emit(
|
self.app.inform.emit(_(
|
||||||
_(
|
"[WARNING] Tool Offset is selected in Tool Table but no value is provided.\n"
|
||||||
"[WARNING] Tool Offset is selected in Tool Table but no value is provided.\n"
|
"Add a Tool Offset or change the Offset Type."))
|
||||||
"Add a Tool Offset or change the Offset Type."
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
dia_cnc_dict.update({
|
dia_cnc_dict.update({
|
||||||
'offset_value': tool_offset
|
'offset_value': tool_offset
|
||||||
@@ -4913,7 +4899,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
xfactor = float(xfactor)
|
xfactor = float(xfactor)
|
||||||
except:
|
except Exception as e:
|
||||||
self.app.inform.emit(_(
|
self.app.inform.emit(_(
|
||||||
"[ERROR_NOTCL] Scale factor has to be a number: integer or float."))
|
"[ERROR_NOTCL] Scale factor has to be a number: integer or float."))
|
||||||
return
|
return
|
||||||
@@ -4923,10 +4909,8 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
yfactor = float(yfactor)
|
yfactor = float(yfactor)
|
||||||
except:
|
except Exception as e:
|
||||||
self.app.inform.emit(_(
|
self.app.inform.emit(_("[ERROR_NOTCL] Scale factor has to be a number: integer or float."))
|
||||||
"[ERROR_NOTCL] Scale factor has to be a number: integer or float."
|
|
||||||
))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if point is None:
|
if point is None:
|
||||||
@@ -4948,19 +4932,19 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
# self.app.inform.emit("[success] Geometry Scale done.")
|
# self.app.inform.emit("[success] Geometry Scale done.")
|
||||||
|
|
||||||
def scale_recursion(geom):
|
def scale_recursion(geom):
|
||||||
if type(geom) == list:
|
if type(geom) is list:
|
||||||
geoms=list()
|
geoms = list()
|
||||||
for local_geom in geom:
|
for local_geom in geom:
|
||||||
geoms.append(scale_recursion(local_geom))
|
geoms.append(scale_recursion(local_geom))
|
||||||
return geoms
|
return geoms
|
||||||
else:
|
else:
|
||||||
return affinity.scale(geom, xfactor, yfactor, origin=(px, py))
|
return affinity.scale(geom, xfactor, yfactor, origin=(px, py))
|
||||||
|
|
||||||
if self.multigeo is True:
|
if self.multigeo is True:
|
||||||
for tool in self.tools:
|
for tool in self.tools:
|
||||||
self.tools[tool]['solid_geometry'] = scale_recursion(self.tools[tool]['solid_geometry'])
|
self.tools[tool]['solid_geometry'] = scale_recursion(self.tools[tool]['solid_geometry'])
|
||||||
else:
|
else:
|
||||||
self.solid_geometry=scale_recursion(self.solid_geometry)
|
self.solid_geometry = scale_recursion(self.solid_geometry)
|
||||||
|
|
||||||
self.app.inform.emit(_(
|
self.app.inform.emit(_(
|
||||||
"[success] Geometry Scale done."
|
"[success] Geometry Scale done."
|
||||||
@@ -4986,22 +4970,20 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def translate_recursion(geom):
|
def translate_recursion(geom):
|
||||||
if type(geom) == list:
|
if type(geom) is list:
|
||||||
geoms=list()
|
geoms = list()
|
||||||
for local_geom in geom:
|
for local_geom in geom:
|
||||||
geoms.append(translate_recursion(local_geom))
|
geoms.append(translate_recursion(local_geom))
|
||||||
return geoms
|
return geoms
|
||||||
else:
|
else:
|
||||||
return affinity.translate(geom, xoff=dx, yoff=dy)
|
return affinity.translate(geom, xoff=dx, yoff=dy)
|
||||||
|
|
||||||
if self.multigeo is True:
|
if self.multigeo is True:
|
||||||
for tool in self.tools:
|
for tool in self.tools:
|
||||||
self.tools[tool]['solid_geometry'] = translate_recursion(self.tools[tool]['solid_geometry'])
|
self.tools[tool]['solid_geometry'] = translate_recursion(self.tools[tool]['solid_geometry'])
|
||||||
else:
|
else:
|
||||||
self.solid_geometry=translate_recursion(self.solid_geometry)
|
self.solid_geometry = translate_recursion(self.solid_geometry)
|
||||||
self.app.inform.emit(_(
|
self.app.inform.emit(_("[success] Geometry Offset done."))
|
||||||
"[success] Geometry Offset done."
|
|
||||||
))
|
|
||||||
|
|
||||||
def convert_units(self, units):
|
def convert_units(self, units):
|
||||||
self.ui_disconnect()
|
self.ui_disconnect()
|
||||||
@@ -5065,8 +5047,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
# try to convert comma to decimal point. if it's still not working error message and return
|
# try to convert comma to decimal point. if it's still not working error message and return
|
||||||
try:
|
try:
|
||||||
custom_offset = float(self.ui.tool_offset_entry.get_value().replace(',', '.')
|
custom_offset = float(self.ui.tool_offset_entry.get_value().replace(',', '.'))
|
||||||
)
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_(
|
self.app.inform.emit(_(
|
||||||
"[ERROR_NOTCL] Wrong value format entered, "
|
"[ERROR_NOTCL] Wrong value format entered, "
|
||||||
@@ -5147,7 +5128,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
try:
|
try:
|
||||||
# plot solid geometries found as members of self.tools attribute dict
|
# plot solid geometries found as members of self.tools attribute dict
|
||||||
# for MultiGeo
|
# for MultiGeo
|
||||||
if self.multigeo == True: # geo multi tool usage
|
if self.multigeo is True: # geo multi tool usage
|
||||||
for tooluid_key in self.tools:
|
for tooluid_key in self.tools:
|
||||||
solid_geometry = self.tools[tooluid_key]['solid_geometry']
|
solid_geometry = self.tools[tooluid_key]['solid_geometry']
|
||||||
self.plot_element(solid_geometry, visible=visible)
|
self.plot_element(solid_geometry, visible=visible)
|
||||||
@@ -5181,9 +5162,9 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
def on_plot_cb_click_table(self):
|
def on_plot_cb_click_table(self):
|
||||||
# self.ui.cnc_tools_table.cellWidget(row, 2).widget().setCheckState(QtCore.Qt.Unchecked)
|
# self.ui.cnc_tools_table.cellWidget(row, 2).widget().setCheckState(QtCore.Qt.Unchecked)
|
||||||
self.ui_disconnect()
|
self.ui_disconnect()
|
||||||
cw = self.sender()
|
# cw = self.sender()
|
||||||
cw_index = self.ui.geo_tools_table.indexAt(cw.pos())
|
# cw_index = self.ui.geo_tools_table.indexAt(cw.pos())
|
||||||
cw_row = cw_index.row()
|
# cw_row = cw_index.row()
|
||||||
check_row = 0
|
check_row = 0
|
||||||
|
|
||||||
self.shapes.clear(update=True)
|
self.shapes.clear(update=True)
|
||||||
@@ -5259,7 +5240,8 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
|||||||
'tool_type': 'C1',
|
'tool_type': 'C1',
|
||||||
'data': {} # a dict to hold the parameters
|
'data': {} # a dict to hold the parameters
|
||||||
'gcode': "" # a string with the actual GCODE
|
'gcode': "" # a string with the actual GCODE
|
||||||
'gcode_parsed': {} # dictionary holding the CNCJob geometry and type of geometry (cut or move)
|
'gcode_parsed': {} # dictionary holding the CNCJob geometry and type of geometry
|
||||||
|
(cut or move)
|
||||||
'solid_geometry': []
|
'solid_geometry': []
|
||||||
},
|
},
|
||||||
...
|
...
|
||||||
@@ -5521,7 +5503,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
|||||||
self.ui.cnc_tools_table.cellWidget(row, 6).clicked.disconnect(self.on_plot_cb_click_table)
|
self.ui.cnc_tools_table.cellWidget(row, 6).clicked.disconnect(self.on_plot_cb_click_table)
|
||||||
try:
|
try:
|
||||||
self.ui.plot_cb.stateChanged.disconnect(self.on_plot_cb_click)
|
self.ui.plot_cb.stateChanged.disconnect(self.on_plot_cb_click)
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def on_updateplot_button_click(self, *args):
|
def on_updateplot_button_click(self, *args):
|
||||||
@@ -5733,13 +5715,13 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
|||||||
if self.cnc_tools[key]['data']['ppname_g'] == 'hpgl':
|
if self.cnc_tools[key]['data']['ppname_g'] == 'hpgl':
|
||||||
hpgl = True
|
hpgl = True
|
||||||
break
|
break
|
||||||
except:
|
except Exception as e:
|
||||||
try:
|
try:
|
||||||
for key in self.cnc_tools:
|
for key in self.cnc_tools:
|
||||||
if self.cnc_tools[key]['data']['ppname_e'] == 'Roland_MDX_20':
|
if self.cnc_tools[key]['data']['ppname_e'] == 'Roland_MDX_20':
|
||||||
roland = True
|
roland = True
|
||||||
break
|
break
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# do not add gcode_header when using the Roland postprocessor, add it for every other postprocessor
|
# do not add gcode_header when using the Roland postprocessor, add it for every other postprocessor
|
||||||
@@ -5848,7 +5830,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
|||||||
))
|
))
|
||||||
|
|
||||||
def get_gcode(self, preamble='', postamble=''):
|
def get_gcode(self, preamble='', postamble=''):
|
||||||
#we need this to be able get_gcode separatelly for shell command export_gcode
|
# we need this to be able get_gcode separatelly for shell command export_gcode
|
||||||
return preamble + '\n' + self.gcode + "\n" + postamble
|
return preamble + '\n' + self.gcode + "\n" + postamble
|
||||||
|
|
||||||
def get_svg(self):
|
def get_svg(self):
|
||||||
@@ -5875,9 +5857,9 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
|||||||
def on_plot_cb_click_table(self):
|
def on_plot_cb_click_table(self):
|
||||||
# self.ui.cnc_tools_table.cellWidget(row, 2).widget().setCheckState(QtCore.Qt.Unchecked)
|
# self.ui.cnc_tools_table.cellWidget(row, 2).widget().setCheckState(QtCore.Qt.Unchecked)
|
||||||
self.ui_disconnect()
|
self.ui_disconnect()
|
||||||
cw = self.sender()
|
# cw = self.sender()
|
||||||
cw_index = self.ui.cnc_tools_table.indexAt(cw.pos())
|
# cw_index = self.ui.cnc_tools_table.indexAt(cw.pos())
|
||||||
cw_row = cw_index.row()
|
# cw_row = cw_index.row()
|
||||||
|
|
||||||
kind = self.ui.cncplot_method_combo.get_value()
|
kind = self.ui.cncplot_method_combo.get_value()
|
||||||
|
|
||||||
@@ -5920,7 +5902,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
|||||||
visible = visible if visible else self.options['plot']
|
visible = visible if visible else self.options['plot']
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.multitool is False: # single tool usage
|
if self.multitool is False: # single tool usage
|
||||||
self.plot2(tooldia=float(self.options["tooldia"]), obj=self, visible=visible, kind=kind)
|
self.plot2(tooldia=float(self.options["tooldia"]), obj=self, visible=visible, kind=kind)
|
||||||
else:
|
else:
|
||||||
# multiple tools usage
|
# multiple tools usage
|
||||||
|
|||||||
@@ -2,16 +2,19 @@ from PyQt5 import QtCore
|
|||||||
from multiprocessing import Pool
|
from multiprocessing import Pool
|
||||||
import dill
|
import dill
|
||||||
|
|
||||||
|
|
||||||
def run_dill_encoded(what):
|
def run_dill_encoded(what):
|
||||||
fun, args = dill.loads(what)
|
fun, args = dill.loads(what)
|
||||||
print("load", fun, args)
|
print("load", fun, args)
|
||||||
return fun(*args)
|
return fun(*args)
|
||||||
|
|
||||||
|
|
||||||
def apply_async(pool, fun, args):
|
def apply_async(pool, fun, args):
|
||||||
print("...", fun, args)
|
print("...", fun, args)
|
||||||
print("dumps", dill.dumps((fun, args)))
|
print("dumps", dill.dumps((fun, args)))
|
||||||
return pool.map_async(run_dill_encoded, (dill.dumps((fun, args)),))
|
return pool.map_async(run_dill_encoded, (dill.dumps((fun, args)),))
|
||||||
|
|
||||||
|
|
||||||
def func1():
|
def func1():
|
||||||
print("func")
|
print("func")
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
# ########################################################## ##
|
# ##########################################################
|
||||||
# FlatCAM: 2D Post-processing for Manufacturing #
|
# FlatCAM: 2D Post-processing for Manufacturing #
|
||||||
# http://flatcam.org #
|
# http://flatcam.org #
|
||||||
# File Author: Matthieu Berthomé #
|
# File Author: Matthieu Berthomé #
|
||||||
# Date: 5/26/2017 #
|
# Date: 5/26/2017 #
|
||||||
# MIT Licence #
|
# MIT Licence #
|
||||||
# ########################################################## ##
|
# ##########################################################
|
||||||
|
|
||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader
|
||||||
import os
|
import os
|
||||||
@@ -12,19 +12,19 @@ from abc import ABCMeta, abstractmethod
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import math
|
import math
|
||||||
|
|
||||||
#module-root dictionary of postprocessors
|
# module-root dictionary of postprocessors
|
||||||
import FlatCAMApp
|
import FlatCAMApp
|
||||||
|
|
||||||
postprocessors = {}
|
postprocessors = {}
|
||||||
|
|
||||||
|
|
||||||
class ABCPostProcRegister(ABCMeta):
|
class ABCPostProcRegister(ABCMeta):
|
||||||
#handles postprocessors registration on instantation
|
# handles postprocessors registration on instantation
|
||||||
def __new__(cls, clsname, bases, attrs):
|
def __new__(cls, clsname, bases, attrs):
|
||||||
newclass = super(ABCPostProcRegister, cls).__new__(cls, clsname, bases, attrs)
|
newclass = super(ABCPostProcRegister, cls).__new__(cls, clsname, bases, attrs)
|
||||||
if object not in bases:
|
if object not in bases:
|
||||||
if newclass.__name__ in postprocessors:
|
if newclass.__name__ in postprocessors:
|
||||||
FlatCAMApp.App.log.warning('Postprocessor %s has been overriden'%(newclass.__name__))
|
FlatCAMApp.App.log.warning('Postprocessor %s has been overriden' % newclass.__name__)
|
||||||
postprocessors[newclass.__name__] = newclass() # here is your register function
|
postprocessors[newclass.__name__] = newclass() # here is your register function
|
||||||
return newclass
|
return newclass
|
||||||
|
|
||||||
@@ -67,11 +67,11 @@ class FlatCAMPostProc(object, metaclass=ABCPostProcRegister):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def spindle_code(self,p):
|
def spindle_code(self, p):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def spindle_stop_code(self,p):
|
def spindle_stop_code(self, p):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@@ -121,32 +121,32 @@ class FlatCAMPostProc_Tools(object, metaclass=ABCPostProcRegister):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def feedrate_z_dispense_code(self,p):
|
def feedrate_z_dispense_code(self, p):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def spindle_fwd_code(self,p):
|
def spindle_fwd_code(self, p):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def spindle_rev_code(self,p):
|
def spindle_rev_code(self, p):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def spindle_off_code(self,p):
|
def spindle_off_code(self, p):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def dwell_fwd_code(self,p):
|
def dwell_fwd_code(self, p):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def dwell_rev_code(self,p):
|
def dwell_rev_code(self, p):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def load_postprocessors(app):
|
def load_postprocessors(app):
|
||||||
postprocessors_path_search = [os.path.join(app.data_path,'postprocessors','*.py'),
|
postprocessors_path_search = [os.path.join(app.data_path, 'postprocessors', '*.py'),
|
||||||
os.path.join('postprocessors', '*.py')]
|
os.path.join('postprocessors', '*.py')]
|
||||||
import glob
|
import glob
|
||||||
for path_search in postprocessors_path_search:
|
for path_search in postprocessors_path_search:
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
# ########################################################## ##
|
# ##########################################################
|
||||||
# FlatCAM: 2D Post-processing for Manufacturing #
|
# FlatCAM: 2D Post-processing for Manufacturing #
|
||||||
# http://flatcam.org #
|
# http://flatcam.org #
|
||||||
# Author: Juan Pablo Caram (c) #
|
# Author: Juan Pablo Caram (c) #
|
||||||
# Date: 2/5/2014 #
|
# Date: 2/5/2014 #
|
||||||
# MIT Licence #
|
# MIT Licence #
|
||||||
# ########################################################## ##
|
# ##########################################################
|
||||||
|
|
||||||
from flatcamGUI.FlatCAMGUI import FlatCAMActivityView
|
from flatcamGUI.FlatCAMGUI import FlatCAMActivityView
|
||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
|
|||||||
@@ -90,4 +90,3 @@ class FlatCAMTool(QtWidgets.QWidget):
|
|||||||
self.app.ui.tool_scroll_area.widget().setObjectName(self.toolName)
|
self.app.ui.tool_scroll_area.widget().setObjectName(self.toolName)
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ def on_language_apply_click(app, restart=False):
|
|||||||
name.capitalize())
|
name.capitalize())
|
||||||
msgbox.setWindowTitle(_("Apply Language ..."))
|
msgbox.setWindowTitle(_("Apply Language ..."))
|
||||||
msgbox.setWindowIcon(QtGui.QIcon('share/language32.png'))
|
msgbox.setWindowIcon(QtGui.QIcon('share/language32.png'))
|
||||||
bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
|
bt_yes = msgbox.addButton('Yes', QtWidgets.QMessageBox.YesRole)
|
||||||
bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
|
bt_no = msgbox.addButton('No', QtWidgets.QMessageBox.NoRole)
|
||||||
|
|
||||||
msgbox.setDefaultButton(bt_yes)
|
msgbox.setDefaultButton(bt_yes)
|
||||||
msgbox.exec_()
|
msgbox.exec_()
|
||||||
@@ -162,5 +162,3 @@ def restart_program(app):
|
|||||||
app.save_defaults()
|
app.save_defaults()
|
||||||
python = sys.executable
|
python = sys.executable
|
||||||
os.execl(python, python, *sys.argv)
|
os.execl(python, python, *sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class Worker(QtCore.QObject):
|
|||||||
import pydevd
|
import pydevd
|
||||||
pydevd.settrace(suspend=False, trace_only_current_thread=True)
|
pydevd.settrace(suspend=False, trace_only_current_thread=True)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
self.pydevd_failed=True
|
self.pydevd_failed = True
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
|
|
||||||
- PEP8 correction in flatcamTools
|
- PEP8 correction in flatcamTools
|
||||||
- merged the Brazilian-portuguese language from a pull request made by Carlos Stein
|
- merged the Brazilian-portuguese language from a pull request made by Carlos Stein
|
||||||
|
- more PEP8 corrections
|
||||||
|
|
||||||
15.07.2019
|
15.07.2019
|
||||||
|
|
||||||
|
|||||||
@@ -7691,6 +7691,7 @@ def three_point_circle(p1, p2, p3):
|
|||||||
def distance(pt1, pt2):
|
def distance(pt1, pt2):
|
||||||
return sqrt((pt1[0] - pt2[0]) ** 2 + (pt1[1] - pt2[1]) ** 2)
|
return sqrt((pt1[0] - pt2[0]) ** 2 + (pt1[1] - pt2[1]) ** 2)
|
||||||
|
|
||||||
|
|
||||||
def distance_euclidian(x1, y1, x2, y2):
|
def distance_euclidian(x1, y1, x2, y2):
|
||||||
return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
|
return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
|
||||||
|
|
||||||
@@ -7792,7 +7793,7 @@ class FlatCAMRTreeStorage(FlatCAMRTree):
|
|||||||
# super(FlatCAMRTreeStorage, self).insert(idx, obj)
|
# super(FlatCAMRTreeStorage, self).insert(idx, obj)
|
||||||
super().insert(idx, obj)
|
super().insert(idx, obj)
|
||||||
|
|
||||||
#@profile
|
# @profile
|
||||||
def remove(self, obj):
|
def remove(self, obj):
|
||||||
# See note about self.indexes in insert().
|
# See note about self.indexes in insert().
|
||||||
# objidx = self.indexes[obj]
|
# objidx = self.indexes[obj]
|
||||||
|
|||||||
Reference in New Issue
Block a user