- the Follow Geometry outputted by the Follow Tools is now of type multigeo which means that it can be fused with other multigeo object without much pain

This commit is contained in:
Marius Stanciu
2020-11-17 02:00:25 +02:00
committed by Marius
parent b7bf284e61
commit 1332050a6a
4 changed files with 49 additions and 4 deletions

View File

@@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta
=================================================
17.11.2020
- the Follow Geometry outputted by the Follow Tools is now of type multigeo which means that it can be fused with other multigeo object without much pain
16.11.2020
- modified the behavior of the Tool Tab in the Notebook widget. Now the app start with the Tool Tab off. If an App Tool is launched then the Tool Tab is added and populated. If the same App Tool is launched again and the focus is in its Tool Tab then the Tool Tab is removed but if the focus is elsewhere then the focus is set again on the Tool Tab.

View File

@@ -773,10 +773,49 @@ class GerberObject(FlatCAMObj, Gerber):
else:
follow_name = outname
def follow_init(follow_obj, app_obj):
def follow_init(new_obj, app_obj):
if type(app_obj.defaults["geometry_cnctooldia"]) == float:
tools_list = [app_obj.defaults["geometry_cnctooldia"]]
else:
try:
temp_tools = app_obj.defaults["geometry_cnctooldia"].split(",")
tools_list = [
float(eval(dia)) for dia in temp_tools if dia != ''
]
except Exception as e:
log.error("GerberObject.follow_geo -> At least one tool diameter needed. -> %s" % str(e))
return 'fail'
# Propagate options
follow_obj.options["cnctooldia"] = str(self.app.defaults["tools_iso_tooldia"])
follow_obj.solid_geometry = self.follow_geometry
new_obj.multigeo = True
# new_obj.options["cnctooldia"] = str(self.app.defaults["tools_iso_tooldia"])
new_obj.solid_geometry = deepcopy(self.follow_geometry)
new_obj.options["cnctooldia"] = app_obj.defaults["geometry_cnctooldia"]
# store here the default data for Geometry Data
default_data = {}
for opt_key, opt_val in app_obj.options.items():
if opt_key.find('geometry' + "_") == 0:
oname = opt_key[len('geometry') + 1:]
default_data[oname] = self.app.options[opt_key]
if opt_key.find('tools_mill' + "_") == 0:
oname = opt_key[len('tools_mill') + 1:]
default_data[oname] = self.app.options[opt_key]
new_obj.tools = {
1: {
'tooldia': app_obj.dec_format(float(tools_list[0]), self.decimals),
'offset': 'Path',
'offset_value': 0.0,
'type': 'Rough',
'tool_type': 'C1',
'data': deepcopy(default_data),
'solid_geometry': new_obj.solid_geometry
}
}
new_obj.tools[1]['data']['name'] = follow_name
try:
self.app.app_obj.new_object("geometry", follow_name, follow_init)

View File

@@ -271,6 +271,8 @@ class ToolFollow(AppTool, Gerber):
"""
def follow_init(new_obj, app_obj):
new_obj.multigeo = True
if type(app_obj.defaults["geometry_cnctooldia"]) == float:
tools_list = [app_obj.defaults["geometry_cnctooldia"]]
else:

View File

@@ -2586,7 +2586,7 @@ class App(QtCore.QObject):
edited_obj.options['ymin'] = ymin
edited_obj.options['xmax'] = xmax
edited_obj.options['ymax'] = ymax
except AttributeError as e:
except (AttributeError, ValueError) as e:
self.inform.emit('[WARNING] %s' % _("Object empty after edit."))
self.log.debug("App.editor2object() --> Geometry --> %s" % str(e))