- 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 "
"is not possible.\n"
"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:
self.geo_editor.edit_fcgeometry(edited_object)

View File

@@ -818,7 +818,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
def follow_init(follow_obj, app):
# 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
# TODO: Do something if this is None. Offer changing name?
@@ -840,7 +840,6 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
:return: None
"""
if dia is None:
dia = float(self.options["isotooldia"])
if passes is None:
@@ -901,7 +900,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
# TODO: This is ugly. Create way to pass data into init function.
def iso_init(geo_obj, app_obj):
# Propagate options
geo_obj.options["cnctooldia"] = float(self.options["isotooldia"])
geo_obj.options["cnctooldia"] = str(self.options["isotooldia"])
geo_obj.solid_geometry = []
for i in range(passes):
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.
def iso_init(geo_obj, app_obj):
# 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 == 'cl':
@@ -2958,15 +2957,15 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
})
if "cnctooldia" not in self.options:
# self.options["cnctooldia"] = self.app.defaults["geometry_cnctooldia"]
try:
self.options["cnctooldia"] = [
float(eval(dia)) for dia in str(self.app.defaults["geometry_cnctooldia"]).split(",")
]
except Exception as e:
log.error("At least one tool diameter needed. Verify in Edit -> Preferences -> Geometry General -> "
"Tool dia. %s" % str(e))
return
self.options["cnctooldia"] = self.app.defaults["geometry_cnctooldia"]
# try:
# self.options["cnctooldia"] = [
# float(eval(dia)) for dia in str(self.app.defaults["geometry_cnctooldia"]).split(",")
# ]
# except Exception as e:
# log.error("At least one tool diameter needed. Verify in Edit -> Preferences -> Geometry General -> "
# "Tool dia. %s" % str(e))
# return
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
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:
log.debug("Tool missing. Add a tool in Geo Tool Table. %s" % str(e))
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
# also modify the Cut Z form entry to reflect the calculated Cut Z from values got from V-Shape Fields
try:
tool_type_txt = self.ui.geo_tools_table.cellWidget(current_row, 4).currentText()
self.ui_update_v_shape(tool_type_txt=tool_type_txt)
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)
else:
return
except Exception as e:
log.debug("Tool missing. Add a tool in Geo Tool Table. %s" % str(e))
return
@@ -4166,7 +4173,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.ui.cncfeedrate_rapid_entry.hide()
def on_generatecnc_button_click(self, *args):
log.debug("Generating CNCJob from Geometry ...")
self.app.report_usage("geometry_on_generatecnc_button")
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
- fixed recently introduced bug in milling drills/slots functions
- 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

View File

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

View File

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

View File

@@ -920,7 +920,7 @@ class ToolPaint(FlatCAMTool, Gerber):
log.debug("Could not Paint the polygons. %s" % str(e))
self.app.inform.emit(
_("[ERROR] Could not do Paint. Try a different combination of parameters. "
"Or a different strategy of paint\n%s") % str(e))
"Or a different strategy of paint\n%s") % str(e))
return
if cp is not None:
@@ -930,7 +930,7 @@ class ToolPaint(FlatCAMTool, Gerber):
else:
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
geo_obj.multigeo = False
geo_obj.multitool = True
@@ -1043,7 +1043,11 @@ class ToolPaint(FlatCAMTool, Gerber):
# ## Not iterable, do the actual indexing and add.
except TypeError:
self.flat_geometry.append(geometry)
if isinstance(geometry, LinearRing):
g = Polygon(geometry)
self.flat_geometry.append(g)
else:
self.flat_geometry.append(geometry)
return self.flat_geometry
@@ -1127,7 +1131,7 @@ class ToolPaint(FlatCAMTool, Gerber):
self.paint_tools[current_uid]['data']['name'] = name
total_geometry[:] = []
geo_obj.options["cnctooldia"] = tool_dia
geo_obj.options["cnctooldia"] = str(tool_dia)
# this turn on the FlatCAMCNCJob plot for multiple tools
geo_obj.multigeo = True
geo_obj.multitool = True
@@ -1141,8 +1145,8 @@ class ToolPaint(FlatCAMTool, Gerber):
has_solid_geo += 1
if has_solid_geo == 0:
self.app.inform.emit(_("[ERROR] There is no Painting Geometry in the file.\n"
"Usually it means that the tool diameter is too big for the painted geometry.\n"
"Change the painting parameters and try again."))
"Usually it means that the tool diameter is too big for the painted geometry.\n"
"Change the painting parameters and try again."))
return
# Experimental...
@@ -1222,7 +1226,7 @@ class ToolPaint(FlatCAMTool, Gerber):
self.paint_tools[current_uid]['data']['name'] = name
cleared_geo[:] = []
geo_obj.options["cnctooldia"] = tool_dia
geo_obj.options["cnctooldia"] = str(tool_dia)
# this turn on the FlatCAMCNCJob plot for multiple tools
geo_obj.multigeo = True
geo_obj.multitool = True