- fixed bugs in Geometry Editor

- added protection's against the 'bowtie' geometries for Subtract Tool in Geometry Editor
- added all the tool from Geometry Editor to the the contextual menu
- fixed bug in Add Text Tool in Geometry Editor that gave error when clicking to place text without having text in the box
This commit is contained in:
Marius Stanciu 2019-08-13 13:59:23 +03:00 committed by Marius
parent eb4f504911
commit 3e339630e6
3 changed files with 82 additions and 13 deletions

View File

@ -17,6 +17,10 @@ CAD program, and create G-Code for Isolation routing.
- updated translations
- fixed a bug in FCDoubleSpinner GUI element
- added a new parameter in NCC tool named offset. If the offset is used then the copper clearing will finish to a set distance of the copper features
- fixed bugs in Geometry Editor
- added protection's against the 'bowtie' geometries for Subtract Tool in Geometry Editor
- added all the tool from Geometry Editor to the the contextual menu
- fixed bug in Add Text Tool in Geometry Editor that gave error when clicking to place text without having text in the box
12.08.2019

View File

@ -2633,15 +2633,20 @@ class FCText(FCShapeTool):
# Create new geometry
dx = point[0]
dy = point[1]
try:
self.geometry = DrawToolShape(affinity.translate(self.text_gui.text_path, xoff=dx, yoff=dy))
except Exception as e:
log.debug("Font geometry is empty or incorrect: %s" % str(e))
self.draw_app.app.inform.emit(_("[ERROR]Font not supported. Only Regular, Bold, Italic and BoldItalic are "
"supported. Error: %s") % str(e))
self.text_gui.text_path = []
self.text_gui.hide_tool()
self.draw_app.select_tool('select')
if self.text_gui.text_path:
try:
self.geometry = DrawToolShape(affinity.translate(self.text_gui.text_path, xoff=dx, yoff=dy))
except Exception as e:
log.debug("Font geometry is empty or incorrect: %s" % str(e))
self.draw_app.app.inform.emit(_("[ERROR]Font not supported. Only Regular, Bold, Italic and BoldItalic are "
"supported. Error: %s") % str(e))
self.text_gui.text_path = []
self.text_gui.hide_tool()
self.draw_app.select_tool('select')
return
else:
self.draw_app.app.inform.emit(_("[WARNING_NOTCL] No text to add."))
return
self.text_gui.text_path = []
@ -2912,7 +2917,7 @@ class FCTransform(FCShapeTool):
self.draw_app = draw_app
self.app = draw_app.app
self.draw_app.app.infrom.emit(_("Shape transformations ..."))
self.draw_app.app.inform.emit(_("Shape transformations ..."))
self.origin = (0, 0)
self.draw_app.transform_tool.run()
@ -3277,7 +3282,22 @@ class FlatCAMGeoEditor(QtCore.QObject):
# Geometry Editor
self.app.ui.draw_line.triggered.connect(self.draw_tool_path)
self.app.ui.draw_rect.triggered.connect(self.draw_tool_rectangle)
self.app.ui.draw_circle.triggered.connect(lambda: self.select_tool('circle'))
self.app.ui.draw_poly.triggered.connect(lambda: self.select_tool('polygon'))
self.app.ui.draw_arc.triggered.connect(lambda: self.select_tool('arc'))
self.app.ui.draw_text.triggered.connect(lambda: self.select_tool('text'))
self.app.ui.draw_buffer.triggered.connect(lambda: self.select_tool('buffer'))
self.app.ui.draw_paint.triggered.connect(lambda: self.select_tool('paint'))
self.app.ui.draw_eraser.triggered.connect(lambda: self.select_tool('eraser'))
self.app.ui.draw_union.triggered.connect(self.union)
self.app.ui.draw_intersect.triggered.connect(self.intersection)
self.app.ui.draw_substract.triggered.connect(self.subtract)
self.app.ui.draw_cut.triggered.connect(self.cutpath)
self.app.ui.draw_transform.triggered.connect(lambda: self.select_tool('transform'))
self.app.ui.draw_move.triggered.connect(self.on_move)
def disconnect_canvas_event_handlers(self):
@ -3332,6 +3352,32 @@ class FlatCAMGeoEditor(QtCore.QObject):
except (TypeError, AttributeError):
pass
self.app.ui.draw_circle.triggered.disconnect()
self.app.ui.draw_poly.triggered.disconnect()
self.app.ui.draw_arc.triggered.disconnect()
self.app.ui.draw_text.triggered.disconnect()
self.app.ui.draw_buffer.triggered.disconnect()
self.app.ui.draw_paint.triggered.disconnect()
self.app.ui.draw_eraser.triggered.disconnect()
try:
self.app.ui.draw_union.triggered.disconnect(self.union)
except (TypeError, AttributeError):
pass
try:
self.app.ui.draw_intersect.triggered.disconnect(self.intersection)
except (TypeError, AttributeError):
pass
try:
self.app.ui.draw_substract.triggered.disconnect(self.subtract)
except (TypeError, AttributeError):
pass
self.app.ui.draw_transform.triggered.disconnect()
def add_shape(self, shape):
"""
Adds a shape to the shape storage.
@ -4087,8 +4133,10 @@ class FlatCAMGeoEditor(QtCore.QObject):
selected = self.get_selected()
try:
tools = selected[1:]
toolgeo = unary_union([shp.geo for shp in tools])
result = selected[0].geo.difference(toolgeo)
toolgeo = unary_union([shp.geo for shp in tools]).buffer(0.0000001)
target = selected[0].geo
target = target.buffer(0.0000001)
result = target.difference(toolgeo)
for_deletion = [s for s in self.get_selected()]
for shape in for_deletion:

View File

@ -1609,9 +1609,26 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.popMenu.addSeparator()
self.g_editor_cmenu = self.popMenu.addMenu(QtGui.QIcon('share/draw32.png'), _("Geo Editor"))
self.draw_line = self.g_editor_cmenu.addAction(QtGui.QIcon('share/path32.png'), _("Line"))
self.draw_line = self.g_editor_cmenu.addAction(QtGui.QIcon('share/path32.png'), _("Path"))
self.draw_rect = self.g_editor_cmenu.addAction(QtGui.QIcon('share/rectangle32.png'), _("Rectangle"))
self.g_editor_cmenu.addSeparator()
self.draw_circle = self.g_editor_cmenu.addAction(QtGui.QIcon('share/circle32.png'), _("Circle"))
self.draw_poly = self.g_editor_cmenu.addAction(QtGui.QIcon('share/polygon32.png'), _("Polygon"))
self.draw_arc = self.g_editor_cmenu.addAction(QtGui.QIcon('share/arc32.png'), _("Arc"))
self.g_editor_cmenu.addSeparator()
self.draw_text = self.g_editor_cmenu.addAction(QtGui.QIcon('share/text32.png'), _("Text"))
self.draw_buffer = self.g_editor_cmenu.addAction(QtGui.QIcon('share/buffer16-2.png'), _("Buffer"))
self.draw_paint = self.g_editor_cmenu.addAction(QtGui.QIcon('share/paint20_1.png'), _("Paint"))
self.draw_eraser = self.g_editor_cmenu.addAction(QtGui.QIcon('share/eraser26.png'), _("Eraser"))
self.g_editor_cmenu.addSeparator()
self.draw_union = self.g_editor_cmenu.addAction(QtGui.QIcon('share/union32.png'), _("Union"))
self.draw_intersect = self.g_editor_cmenu.addAction(QtGui.QIcon('share/intersection32.png'), _("Intersection"))
self.draw_substract = self.g_editor_cmenu.addAction(QtGui.QIcon('share/subtract32.png'), _("Substraction"))
self.draw_cut = self.g_editor_cmenu.addAction(QtGui.QIcon('share/cutpath32.png'), _("Cut"))
self.draw_transform = self.g_editor_cmenu.addAction(QtGui.QIcon('share/transform.png'), _("Transformations"))
self.g_editor_cmenu.addSeparator()
self.draw_move = self.g_editor_cmenu.addAction(QtGui.QIcon('share/move32.png'), _("Move"))