- working on the Follow Tool and Milling Tool

This commit is contained in:
Marius Stanciu
2021-01-13 03:27:04 +02:00
committed by Marius
parent 5277905d73
commit 0386dbf258
4 changed files with 22 additions and 23 deletions

View File

@@ -316,7 +316,8 @@ class ToolFollow(AppTool, Gerber):
'solid_geometry': new_obj.solid_geometry
}
}
for d in new_data:
print(d, new_data[d])
ret = self.app.app_obj.new_object("geometry", outname, follow_init)
if ret == 'fail':
self.app.inform.emit("[ERROR_NOTCL] %s" % _("Failed to create Follow Geometry."))
@@ -356,12 +357,12 @@ class ToolFollow(AppTool, Gerber):
if opt_key.find('geometry' + "_") == 0:
oname = opt_key[len('geometry') + 1:]
new_data[oname] = app_obj.options[opt_key]
if opt_key.find('tools_mill' + "_") == 0:
oname = opt_key[len('tools_mill') + 1:]
new_data[oname] = app_obj.options[opt_key]
if opt_key.find('tools_') == 0:
new_data[opt_key] = app_obj.options[opt_key]
# Propagate options
new_obj.options["tools_mill_tooldia"] = app_obj.defaults["tools_mill_tooldia"]
new_data["tools_mill_tooldia"] = app_obj.defaults["tools_mill_tooldia"]
target_geo = unary_union(followed_obj.follow_geometry)
area_follow = target_geo.intersection(deepcopy(unary_union(self.sel_rect)))

View File

@@ -2766,10 +2766,9 @@ class ToolMilling(AppTool, Excellon):
tool_cnt += 1
dia_cnc_dict = deepcopy(tools_dict[tooluid_key])
tooldia_val = app_obj.dec_format(float(tools_dict[tooluid_key]['tools_mill_tooldia']), self.decimals)
dia_cnc_dict.update({
'tools_mill_tooldia': tooldia_val
})
tooldia_val = app_obj.dec_format(
float(tools_dict[tooluid_key]['data']['tools_mill_tooldia']), self.decimals)
dia_cnc_dict['data']['tools_mill_tooldia'] = tooldia_val
if "optimization_type" not in tools_dict[tooluid_key]['data']:
def_optimization_type = self.app.defaults["tools_mill_optimization_type"]
@@ -2800,9 +2799,7 @@ class ToolMilling(AppTool, Excellon):
else:
tool_offset = 0.0
dia_cnc_dict.update({
'tools_mill_offset_value': tool_offset
})
dia_cnc_dict['data']['tools_mill_offset_value'] = tool_offset
z_cut = tools_dict[tooluid_key]['data']["tools_mill_cutz"]
z_move = tools_dict[tooluid_key]['data']["tools_mill_travelz"]
@@ -2932,10 +2929,9 @@ class ToolMilling(AppTool, Excellon):
dia_cnc_dict = deepcopy(tools_dict[tooluid_key])
# Tooldia update
tooldia_val = app_obj.dec_format(float(tools_dict[tooluid_key]['tooldia']), self.decimals)
dia_cnc_dict.update({
'tooldia': tooldia_val
})
tooldia_val = app_obj.dec_format(
float(tools_dict[tooluid_key]['data']['tools_mill_tooldia']), self.decimals)
dia_cnc_dict['data']['tools_mill_tooldia'] = tooldia_val
if "optimization_type" not in tools_dict[tooluid_key]['data']:
def_optimization_type = self.app.defaults["tools_mill_optimization_type"]
@@ -2969,12 +2965,12 @@ class ToolMilling(AppTool, Excellon):
tools_dict[tooluid_key]['data']['ppname_g'] = self.ui.pp_geo_name_cb.get_value()
# Offset calculation
offset_type = dia_cnc_dict['tools_mill_offset_type'].lower()
if offset_type == 'in':
offset_type = dia_cnc_dict['tools_mill_offset_type']
if offset_type == 1: # 'in'
tool_offset = -tooldia_val / 2
elif offset_type == 'out':
elif offset_type == 2: # 'out'
tool_offset = tooldia_val / 2
elif offset_type == 'custom':
elif offset_type == 3: # 'custom'
offset_value = self.ui.offset_entry.get_value()
if offset_value:
tool_offset = float(offset_value)
@@ -2987,9 +2983,7 @@ class ToolMilling(AppTool, Excellon):
else:
tool_offset = 0.0
dia_cnc_dict.update({
'offset_value': tool_offset
})
dia_cnc_dict['data']['tools_mill_offset_value'] = tool_offset
# Solid Geometry
tool_solid_geometry = self.target_obj.tools[tooluid_key]['solid_geometry']