- fixed bug in Gerber isolation (Geometry expects now a value in string format and not float)

- fixed bug in Paint tool: now it is possible to paint geometry generated by External Isolation (or Internal isolation)
- fixed bug in editing a multigeo Geometry object if previously a tool was deleted
This commit is contained in:
Marius Stanciu
2019-06-22 20:17:45 +03:00
parent 90f491491d
commit 21a15e73bd
6 changed files with 53 additions and 28 deletions

View File

@@ -2244,7 +2244,18 @@ class App(QtCore.QObject):
self.inform.emit(_("[WARNING_NOTCL] Simultanoeus editing of tools geometry in a MultiGeo Geometry " self.inform.emit(_("[WARNING_NOTCL] Simultanoeus editing of tools geometry in a MultiGeo Geometry "
"is not possible.\n" "is not possible.\n"
"Edit only one geometry at a time.")) "Edit only one geometry at a time."))
self.geo_editor.edit_fcgeometry(edited_object, multigeo_tool=edited_tools[0])
# determine the tool dia of the selected tool
selected_tooldia = float(edited_object.ui.geo_tools_table.item((edited_tools[0] - 1), 1).text())
# now find the key in the edited_object.tools that has this tooldia
multi_tool = 1
for tool in edited_object.tools:
if edited_object.tools[tool]['tooldia'] == selected_tooldia:
multi_tool = tool
break
self.geo_editor.edit_fcgeometry(edited_object, multigeo_tool=multi_tool)
else: else:
self.geo_editor.edit_fcgeometry(edited_object) self.geo_editor.edit_fcgeometry(edited_object)

View File

@@ -818,7 +818,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
def follow_init(follow_obj, app): def follow_init(follow_obj, app):
# Propagate options # Propagate options
follow_obj.options["cnctooldia"] = float(self.options["isotooldia"]) follow_obj.options["cnctooldia"] = str(self.options["isotooldia"])
follow_obj.solid_geometry = self.follow_geometry follow_obj.solid_geometry = self.follow_geometry
# TODO: Do something if this is None. Offer changing name? # TODO: Do something if this is None. Offer changing name?
@@ -840,7 +840,6 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
:return: None :return: None
""" """
if dia is None: if dia is None:
dia = float(self.options["isotooldia"]) dia = float(self.options["isotooldia"])
if passes is None: if passes is None:
@@ -901,7 +900,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
# TODO: This is ugly. Create way to pass data into init function. # TODO: This is ugly. Create way to pass data into init function.
def iso_init(geo_obj, app_obj): def iso_init(geo_obj, app_obj):
# Propagate options # Propagate options
geo_obj.options["cnctooldia"] = float(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 = (((2 * i + 1) / 2.0) * dia) - (i * overlap * dia)
@@ -958,7 +957,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
# TODO: This is ugly. Create way to pass data into init function. # TODO: This is ugly. Create way to pass data into init function.
def iso_init(geo_obj, app_obj): def iso_init(geo_obj, app_obj):
# Propagate options # Propagate options
geo_obj.options["cnctooldia"] = float(self.options["isotooldia"]) geo_obj.options["cnctooldia"] = str(self.options["isotooldia"])
# 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':
@@ -2958,15 +2957,15 @@ 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(",")
] # ]
except Exception as e: # except Exception as e:
log.error("At least one tool diameter needed. Verify in Edit -> Preferences -> Geometry General -> " # log.error("At least one tool diameter needed. Verify in Edit -> Preferences -> Geometry General -> "
"Tool dia. %s" % str(e)) # "Tool dia. %s" % str(e))
return # return
self.options["startz"] = self.app.defaults["geometry_startz"] self.options["startz"] = self.app.defaults["geometry_startz"]
@@ -3801,7 +3800,11 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
# populate the form with the data from the tool associated with the row parameter # populate the form with the data from the tool associated with the row parameter
try: try:
tooluid = int(self.ui.geo_tools_table.item(current_row, 5).text()) item = self.ui.geo_tools_table.item(current_row, 5)
if item is not None:
tooluid = int(item.text())
else:
return
except Exception as e: except Exception as e:
log.debug("Tool missing. Add a tool in Geo Tool Table. %s" % str(e)) log.debug("Tool missing. Add a tool in Geo Tool Table. %s" % str(e))
return return
@@ -3809,8 +3812,12 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
# update the form with the V-Shape fields if V-Shape selected in the geo_tool_table # update the form with the V-Shape fields if V-Shape selected in the geo_tool_table
# also modify the Cut Z form entry to reflect the calculated Cut Z from values got from V-Shape Fields # also modify the Cut Z form entry to reflect the calculated Cut Z from values got from V-Shape Fields
try: try:
tool_type_txt = self.ui.geo_tools_table.cellWidget(current_row, 4).currentText() item = self.ui.geo_tools_table.cellWidget(current_row, 4)
if item is not None:
tool_type_txt = item.currentText()
self.ui_update_v_shape(tool_type_txt=tool_type_txt) self.ui_update_v_shape(tool_type_txt=tool_type_txt)
else:
return
except Exception as e: except Exception as e:
log.debug("Tool missing. Add a tool in Geo Tool Table. %s" % str(e)) log.debug("Tool missing. Add a tool in Geo Tool Table. %s" % str(e))
return return
@@ -4166,7 +4173,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.ui.cncfeedrate_rapid_entry.hide() self.ui.cncfeedrate_rapid_entry.hide()
def on_generatecnc_button_click(self, *args): def on_generatecnc_button_click(self, *args):
log.debug("Generating CNCJob from Geometry ...")
self.app.report_usage("geometry_on_generatecnc_button") self.app.report_usage("geometry_on_generatecnc_button")
self.read_form() self.read_form()

View File

@@ -22,6 +22,9 @@ CAD program, and create G-Code for Isolation routing.
- updated the Russian translation from 51% complete to 69% complete using the Yandex translation engine - updated the Russian translation from 51% complete to 69% complete using the Yandex translation engine
- fixed recently introduced bug in milling drills/slots functions - fixed recently introduced bug in milling drills/slots functions
- moved Substract Tool from Menu -> Edit -> Conversions to Menu -> Tool - moved Substract Tool from Menu -> Edit -> Conversions to Menu -> Tool
- fixed bug in Gerber isolation (Geometry expects now a value in string format and not float)
- fixed bug in Paint tool: now it is possible to paint geometry generated by External Isolation (or Internal isolation)
- fixed bug in editing a multigeo Geometry object if previously a tool was deleted
20.06.2019 20.06.2019

View File

@@ -4002,7 +4002,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
def update_options(self, obj): def update_options(self, obj):
if self.paint_tooldia: if self.paint_tooldia:
obj.options['cnctooldia'] = self.paint_tooldia obj.options['cnctooldia'] = deepcopy(str(self.paint_tooldia))
self.paint_tooldia = None self.paint_tooldia = None
return True return True
else: else:

View File

@@ -787,7 +787,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
else: else:
log.debug("There are no geometries in the cleared polygon.") log.debug("There are no geometries in the cleared polygon.")
geo_obj.options["cnctooldia"] = tool geo_obj.options["cnctooldia"] = str(tool)
geo_obj.multigeo = True geo_obj.multigeo = True
def job_thread(app_obj): def job_thread(app_obj):
@@ -929,7 +929,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
log.debug("There are no geometries in the cleared polygon.") log.debug("There are no geometries in the cleared polygon.")
geo_obj.multigeo = True geo_obj.multigeo = True
geo_obj.options["cnctooldia"] = tool geo_obj.options["cnctooldia"] = str(tool)
# check to see if geo_obj.tools is empty # check to see if geo_obj.tools is empty
# it will be updated only if there is a solid_geometry for tools # it will be updated only if there is a solid_geometry for tools

View File

@@ -930,7 +930,7 @@ class ToolPaint(FlatCAMTool, Gerber):
else: else:
geo_obj.solid_geometry = list(cp.get_objects()) geo_obj.solid_geometry = list(cp.get_objects())
geo_obj.options["cnctooldia"] = tooldia geo_obj.options["cnctooldia"] = str(tooldia)
# this turn on the FlatCAMCNCJob plot for multiple tools # this turn on the FlatCAMCNCJob plot for multiple tools
geo_obj.multigeo = False geo_obj.multigeo = False
geo_obj.multitool = True geo_obj.multitool = True
@@ -1043,6 +1043,10 @@ class ToolPaint(FlatCAMTool, Gerber):
# ## Not iterable, do the actual indexing and add. # ## Not iterable, do the actual indexing and add.
except TypeError: except TypeError:
if isinstance(geometry, LinearRing):
g = Polygon(geometry)
self.flat_geometry.append(g)
else:
self.flat_geometry.append(geometry) self.flat_geometry.append(geometry)
return self.flat_geometry return self.flat_geometry
@@ -1127,7 +1131,7 @@ class ToolPaint(FlatCAMTool, Gerber):
self.paint_tools[current_uid]['data']['name'] = name self.paint_tools[current_uid]['data']['name'] = name
total_geometry[:] = [] total_geometry[:] = []
geo_obj.options["cnctooldia"] = tool_dia geo_obj.options["cnctooldia"] = str(tool_dia)
# this turn on the FlatCAMCNCJob plot for multiple tools # this turn on the FlatCAMCNCJob plot for multiple tools
geo_obj.multigeo = True geo_obj.multigeo = True
geo_obj.multitool = True geo_obj.multitool = True
@@ -1222,7 +1226,7 @@ class ToolPaint(FlatCAMTool, Gerber):
self.paint_tools[current_uid]['data']['name'] = name self.paint_tools[current_uid]['data']['name'] = name
cleared_geo[:] = [] cleared_geo[:] = []
geo_obj.options["cnctooldia"] = tool_dia geo_obj.options["cnctooldia"] = str(tool_dia)
# this turn on the FlatCAMCNCJob plot for multiple tools # this turn on the FlatCAMCNCJob plot for multiple tools
geo_obj.multigeo = True geo_obj.multigeo = True
geo_obj.multitool = True geo_obj.multitool = True