- working on Tool Follow, Milling Tool, camlib to adapt them to the new changes in the Geometry Object
This commit is contained in:
@@ -932,7 +932,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
# if this dict is not empty then the object is a Geometry object
|
||||
if self.cnc_tools:
|
||||
first_key = next(iter(self.cnc_tools))
|
||||
include_header = self.app.preprocessors[self.cnc_tools[first_key]['data']['ppname_g']].include_header
|
||||
include_header = self.app.preprocessors[self.cnc_tools[first_key]['data']['tools_mill_ppname_g']]
|
||||
include_header = include_header.include_header
|
||||
|
||||
# if this dict is not empty then the object is an Excellon object
|
||||
if self.exc_cnc_tools:
|
||||
@@ -997,8 +998,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
hpgl = False
|
||||
if self.cnc_tools:
|
||||
for key in self.cnc_tools:
|
||||
if 'ppname_g' in self.cnc_tools[key]['data']:
|
||||
if 'hpgl' in self.cnc_tools[key]['data']['ppname_g']:
|
||||
if 'tools_mill_ppname_g' in self.cnc_tools[key]['data']:
|
||||
if 'hpgl' in self.cnc_tools[key]['data']['tools_mill_ppname_g']:
|
||||
hpgl = True
|
||||
break
|
||||
elif self.exc_cnc_tools:
|
||||
@@ -1238,11 +1239,18 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
# Geometry shapes plotting
|
||||
try:
|
||||
if self.multitool is False: # single tool usage
|
||||
try:
|
||||
dia_plot = float(self.options["tooldia"])
|
||||
except ValueError:
|
||||
# we may have a tuple with only one element and a comma
|
||||
dia_plot = [float(el) for el in self.options["tooldia"].split(',') if el != ''][0]
|
||||
if self.origin_kind == "excellon":
|
||||
try:
|
||||
dia_plot = float(self.options["tooldia"])
|
||||
except ValueError:
|
||||
# we may have a tuple with only one element and a comma
|
||||
dia_plot = [float(el) for el in self.options["tooldia"].split(',') if el != ''][0]
|
||||
else:
|
||||
try:
|
||||
dia_plot = float(self.options["tools_mill_tooldia"])
|
||||
except ValueError:
|
||||
# we may have a tuple with only one element and a comma
|
||||
dia_plot = [float(el) for el in self.options["tools_mill_tooldia"].split(',') if el != ''][0]
|
||||
self.plot2(tooldia=dia_plot, obj=self, visible=visible, kind=kind)
|
||||
else:
|
||||
# I do this so the travel lines thickness will reflect the tool diameter
|
||||
@@ -1261,7 +1269,10 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
# multiple tools usage
|
||||
if self.cnc_tools:
|
||||
for tooluid_key in self.cnc_tools:
|
||||
tooldia = self.app.dec_format(float(self.cnc_tools[tooluid_key]['tooldia']), self.decimals)
|
||||
tooldia = self.app.dec_format(
|
||||
float(self.cnc_tools[tooluid_key]['tools_mill_tooldia']),
|
||||
self.decimals
|
||||
)
|
||||
gcode_parsed = self.cnc_tools[tooluid_key]['gcode_parsed']
|
||||
self.plot2(tooldia=tooldia, obj=self, visible=visible, gcode_parsed=gcode_parsed, kind=kind)
|
||||
|
||||
|
||||
@@ -142,15 +142,15 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
# engine of FlatCAM. Most likely are generated by some of tools and are special cases of geometries.
|
||||
self.special_group = None
|
||||
|
||||
# self.old_pp_state = self.app.defaults["geometry_multidepth"]
|
||||
# self.old_toolchangeg_state = self.app.defaults["geometry_toolchange"]
|
||||
# self.old_pp_state = self.app.defaults["tools_mill_multidepth"]
|
||||
# self.old_toolchangeg_state = self.app.defaults["tools_mill_toolchange"]
|
||||
self.units_found = self.app.defaults['units']
|
||||
|
||||
# this variable can be updated by the Object that generates the geometry
|
||||
self.tool_type = 'C1'
|
||||
|
||||
# save here the old value for the Cut Z before it is changed by selecting a V-shape type tool in the tool table
|
||||
self.old_cutz = self.app.defaults["geometry_cutz"]
|
||||
self.old_cutz = self.app.defaults["tools_mill_cutz"]
|
||||
|
||||
self.fill_color = self.app.defaults['geometry_plot_line']
|
||||
self.outline_color = self.app.defaults['geometry_plot_line']
|
||||
@@ -159,7 +159,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
self.param_fields = {}
|
||||
|
||||
# store here the state of the exclusion checkbox state to be restored after building the UI
|
||||
self.exclusion_area_cb_is_checked = self.app.defaults["geometry_area_exclusion"]
|
||||
self.exclusion_area_cb_is_checked = self.app.defaults["tools_mill_area_exclusion"]
|
||||
|
||||
# Attributes to be included in serialization
|
||||
# Always append to it because it carries contents
|
||||
@@ -431,22 +431,6 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
self.units = self.app.defaults['units'].upper()
|
||||
self.units_found = self.app.defaults['units']
|
||||
|
||||
# # make sure the preprocessor combobox is clear
|
||||
# self.ui.pp_geometry_name_cb.clear()
|
||||
# # populate preprocessor names in the combobox
|
||||
# pp_list = []
|
||||
# for name in list(self.app.preprocessors.keys()):
|
||||
# pp_list.append(name)
|
||||
# pp_list.sort()
|
||||
# if 'default' in pp_list:
|
||||
# pp_list.remove('default')
|
||||
# pp_list.insert(0, 'default')
|
||||
# self.ui.pp_geometry_name_cb.addItems(pp_list)
|
||||
# # add tooltips
|
||||
# for it in range(self.ui.pp_geometry_name_cb.count()):
|
||||
# self.ui.pp_geometry_name_cb.setItemData(
|
||||
# it, self.ui.pp_geometry_name_cb.itemText(it), QtCore.Qt.ToolTipRole)
|
||||
|
||||
self.form_fields.update({
|
||||
"plot": self.ui.plot_cb,
|
||||
"multicolored": self.ui.multicolored_cb,
|
||||
@@ -1743,7 +1727,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
# store the new CutZ value into storage (self.tools)
|
||||
for tooluid_key, tooluid_value in self.tools.items():
|
||||
if int(tooluid_key) == tool_uid:
|
||||
tooluid_value['data']['cutz'] = new_cutz
|
||||
tooluid_value['data']['tools_mill_cutz'] = new_cutz
|
||||
|
||||
def on_tooltable_cellwidget_change(self):
|
||||
cw = self.sender()
|
||||
@@ -1958,13 +1942,13 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
|
||||
def update_common_param_in_storage(self):
|
||||
for tooluid_value in self.tools.values():
|
||||
tooluid_value['data']['toolchange'] = self.ui.toolchangeg_cb.get_value()
|
||||
tooluid_value['data']['toolchangez'] = self.ui.toolchangez_entry.get_value()
|
||||
tooluid_value['data']['endz'] = self.ui.endz_entry.get_value()
|
||||
tooluid_value['data']['endxy'] = self.ui.endxy_entry.get_value()
|
||||
tooluid_value['data']['ppname_g'] = self.ui.pp_geometry_name_cb.get_value()
|
||||
tooluid_value['data']['area_exclusion'] = self.ui.exclusion_cb.get_value()
|
||||
tooluid_value['data']['polish'] = self.ui.polish_cb.get_value()
|
||||
tooluid_value['data']['tools_mill_toolchange'] = self.ui.toolchangeg_cb.get_value()
|
||||
tooluid_value['data']['tools_mill_toolchangez'] = self.ui.toolchangez_entry.get_value()
|
||||
tooluid_value['data']['tools_mill_endz'] = self.ui.endz_entry.get_value()
|
||||
tooluid_value['data']['tools_mill_endxy'] = self.ui.endxy_entry.get_value()
|
||||
tooluid_value['data']['tools_mill_ppname_g'] = self.ui.pp_geometry_name_cb.get_value()
|
||||
tooluid_value['data']['tools_mill_area_exclusion'] = self.ui.exclusion_cb.get_value()
|
||||
tooluid_value['data']['tools_mill_polish'] = self.ui.polish_cb.get_value()
|
||||
|
||||
def select_tools_table_row(self, row, clearsel=None):
|
||||
if clearsel:
|
||||
@@ -2296,8 +2280,8 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
job_obj.segx = segx if segx else float(self.app.defaults["geometry_segx"])
|
||||
job_obj.segy = segy if segy else float(self.app.defaults["geometry_segy"])
|
||||
|
||||
job_obj.z_pdepth = float(self.app.defaults["geometry_z_pdepth"])
|
||||
job_obj.feedrate_probe = float(self.app.defaults["geometry_feedrate_probe"])
|
||||
job_obj.z_pdepth = float(self.app.defaults["tools_mill_z_pdepth"])
|
||||
job_obj.feedrate_probe = float(self.app.defaults["tools_mill_feedrate_probe"])
|
||||
|
||||
total_gcode = ''
|
||||
for tooluid_key in list(tools_dict.keys()):
|
||||
@@ -2338,27 +2322,27 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
'offset_value': tool_offset
|
||||
})
|
||||
|
||||
z_cut = tools_dict[tooluid_key]['data']["cutz"]
|
||||
z_move = tools_dict[tooluid_key]['data']["travelz"]
|
||||
feedrate = tools_dict[tooluid_key]['data']["feedrate"]
|
||||
feedrate_z = tools_dict[tooluid_key]['data']["feedrate_z"]
|
||||
feedrate_rapid = tools_dict[tooluid_key]['data']["feedrate_rapid"]
|
||||
multidepth = tools_dict[tooluid_key]['data']["multidepth"]
|
||||
extracut = tools_dict[tooluid_key]['data']["extracut"]
|
||||
extracut_length = tools_dict[tooluid_key]['data']["extracut_length"]
|
||||
depthpercut = tools_dict[tooluid_key]['data']["depthperpass"]
|
||||
toolchange = tools_dict[tooluid_key]['data']["toolchange"]
|
||||
toolchangez = tools_dict[tooluid_key]['data']["toolchangez"]
|
||||
toolchangexy = tools_dict[tooluid_key]['data']["toolchangexy"]
|
||||
startz = tools_dict[tooluid_key]['data']["startz"]
|
||||
endz = tools_dict[tooluid_key]['data']["endz"]
|
||||
endxy = self.options["endxy"]
|
||||
spindlespeed = tools_dict[tooluid_key]['data']["spindlespeed"]
|
||||
dwell = tools_dict[tooluid_key]['data']["dwell"]
|
||||
dwelltime = tools_dict[tooluid_key]['data']["dwelltime"]
|
||||
pp_geometry_name = tools_dict[tooluid_key]['data']["ppname_g"]
|
||||
z_cut = tools_dict[tooluid_key]['data']["tools_mill_cutz"]
|
||||
z_move = tools_dict[tooluid_key]['data']["tools_mill_travelz"]
|
||||
feedrate = tools_dict[tooluid_key]['data']["tools_mill_feedrate"]
|
||||
feedrate_z = tools_dict[tooluid_key]['data']["tools_mill_feedrate_z"]
|
||||
feedrate_rapid = tools_dict[tooluid_key]['data']["tools_mill_feedrate_rapid"]
|
||||
multidepth = tools_dict[tooluid_key]['data']["tools_mill_multidepth"]
|
||||
extracut = tools_dict[tooluid_key]['data']["tools_mill_extracut"]
|
||||
extracut_length = tools_dict[tooluid_key]['data']["tools_mill_extracut_length"]
|
||||
depthpercut = tools_dict[tooluid_key]['data']["tools_mill_depthperpass"]
|
||||
toolchange = tools_dict[tooluid_key]['data']["tools_mill_toolchange"]
|
||||
toolchangez = tools_dict[tooluid_key]['data']["tools_mill_toolchangez"]
|
||||
toolchangexy = tools_dict[tooluid_key]['data']["tools_mill_toolchangexy"]
|
||||
startz = tools_dict[tooluid_key]['data']["tools_mill_startz"]
|
||||
endz = tools_dict[tooluid_key]['data']["tools_mill_endz"]
|
||||
endxy = self.options["tools_mill_endxy"]
|
||||
spindlespeed = tools_dict[tooluid_key]['data']["tools_mill_spindlespeed"]
|
||||
dwell = tools_dict[tooluid_key]['data']["tools_mill_dwell"]
|
||||
dwelltime = tools_dict[tooluid_key]['data']["tools_mill_dwelltime"]
|
||||
pp_geometry_name = tools_dict[tooluid_key]['data']["tools_mill_ppname_g"]
|
||||
|
||||
spindledir = self.app.defaults['geometry_spindledir']
|
||||
spindledir = self.app.defaults['tools_mill_spindledir']
|
||||
tool_solid_geometry = self.solid_geometry
|
||||
|
||||
job_obj.coords_decimals = self.app.defaults["cncjob_coords_decimals"]
|
||||
@@ -2445,8 +2429,8 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
job_obj.segx = segx if segx else float(self.app.defaults["geometry_segx"])
|
||||
job_obj.segy = segy if segy else float(self.app.defaults["geometry_segy"])
|
||||
|
||||
job_obj.z_pdepth = float(self.app.defaults["geometry_z_pdepth"])
|
||||
job_obj.feedrate_probe = float(self.app.defaults["geometry_feedrate_probe"])
|
||||
job_obj.z_pdepth = float(self.app.defaults["tools_mill_z_pdepth"])
|
||||
job_obj.feedrate_probe = float(self.app.defaults["tools_mill_feedrate_probe"])
|
||||
|
||||
# make sure that trying to make a CNCJob from an empty file is not creating an app crash
|
||||
if not self.solid_geometry:
|
||||
@@ -2467,8 +2451,8 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
'tooldia': tooldia_val
|
||||
})
|
||||
if "optimization_type" not in tools_dict[tooluid_key]['data']:
|
||||
tools_dict[tooluid_key]['data']["optimization_type"] = \
|
||||
self.app.defaults["geometry_optimization_type"]
|
||||
tools_dict[tooluid_key]['data']["tools_mill_optimization_type"] = \
|
||||
self.app.defaults["tools_mill_optimization_type"]
|
||||
|
||||
# find the tool_dia associated with the tooluid_key
|
||||
# search in the self.tools for the sel_tool_dia and when found see what tooluid has
|
||||
@@ -3029,10 +3013,10 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
|
||||
self.options["toolchangez"] = float(self.options["toolchangez"]) * factor
|
||||
|
||||
if self.app.defaults["geometry_toolchangexy"] == '':
|
||||
if self.app.defaults["tools_mill_toolchangexy"] == '':
|
||||
self.options['toolchangexy'] = "0.0, 0.0"
|
||||
else:
|
||||
coords_xy = [float(eval(coord)) for coord in self.app.defaults["geometry_toolchangexy"].split(",")]
|
||||
coords_xy = [float(eval(coord)) for coord in self.app.defaults["tools_mill_toolchangexy"].split(",")]
|
||||
if len(coords_xy) < 2:
|
||||
self.app.inform.emit('[ERROR] %s' %
|
||||
_("The Toolchange X,Y field in Edit -> Preferences "
|
||||
|
||||
Reference in New Issue
Block a user