- fixed the Tcl Command AlignDrill

- fixed the Tcl Command AlignDrillGrid
- fixed the Tcl COmmand Panelize, Excellon panelization section
- Fixed an issue in Tool Calibration export_excellon method call
- PEP8 corrections all over the app
This commit is contained in:
Marius Stanciu
2020-11-02 03:32:00 +02:00
committed by Marius
parent fac4caf961
commit 374c29b4b0
63 changed files with 492 additions and 537 deletions

View File

@@ -2265,7 +2265,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
processed_body_gcode += gline + '\n'
gcode = processed_body_gcode
g = self.gc_header + '\n' + self.gc_start + '\n' + preamble + '\n' + \
g = self.gc_header + '\n' + self.gc_start + '\n' + preamble + '\n' + \
gcode + '\n' + postamble + end_gcode
else:
# try:
@@ -2286,6 +2286,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
# _("G-code does not have a G94 code.\n"
# "Append Code snippet will not be used.."))
# g = self.gc_header + '\n' + gcode + postamble + end_gcode
g = ''
if preamble != '' and postamble != '':
g = self.gc_header + self.gc_start + '\n' + preamble + '\n' + gcode + '\n' + \
postamble + '\n' + end_gcode

View File

@@ -11,16 +11,13 @@
# ##########################################################
from shapely.geometry import Point, LineString
from copy import deepcopy
from shapely.geometry import LineString
from appParsers.ParseExcellon import Excellon
from appObjects.FlatCAMObj import *
import itertools
import numpy as np
from collections import defaultdict
import gettext
import appTranslation as fcTranslate
@@ -1016,10 +1013,10 @@ class ExcellonObject(FlatCAMObj, Excellon):
# in case that the tool used has the same diameter with the hole, and since the maximum resolution
# for FlatCAM is 6 decimals,
# we add a tenth of the minimum value, meaning 0.0000001, which from our point of view is "almost zero"
for tool in tools:
for slot in self.tools[tool]['slots']:
for m_tool in tools:
for slot in self.tools[m_tool]['slots']:
toolstable_tool = float('%.*f' % (self.decimals, float(tooldia)))
file_tool = float('%.*f' % (self.decimals, float(self.tools[tool]["tooldia"])))
file_tool = float('%.*f' % (self.decimals, float(self.tools[m_tool]["tooldia"])))
# I add the 0.0001 value to account for the rounding error in converting from IN to MM and reverse
# for the file_tool (tooldia actually)
@@ -1164,8 +1161,8 @@ class ExcellonObject(FlatCAMObj, Excellon):
r_color[3] = 1
new_color = '#'
for idx in range(len(r_color)):
new_color += '%x' % int(r_color[idx] * 255)
for idx_c in range(len(r_color)):
new_color += '%x' % int(r_color[idx_c] * 255)
# do it until a valid color is generated
# a valid color has the # symbol, another 6 chars for the color and the last 2 chars for alpha
# for a total of 9 chars

View File

@@ -10,7 +10,7 @@
# File modified by: Marius Stanciu #
# ##########################################################
from shapely.geometry import Polygon, MultiPolygon, MultiLineString, LineString, LinearRing, box
from shapely.geometry import MultiLineString, LineString, LinearRing, box
import shapely.affinity as affinity
from camlib import Geometry, grace
@@ -2606,7 +2606,7 @@ class GeometryObject(FlatCAMObj, Geometry):
# Type(cpoly) == FlatCAMRTreeStorage | None
cpoly = None
if paint_method == 0: # Standard
if paint_method == 0: # Standard
cpoly = self.clear_polygon(bbox,
tooldia=tooldia,
steps_per_circle=obj.circle_steps,
@@ -2614,7 +2614,7 @@ class GeometryObject(FlatCAMObj, Geometry):
contour=True,
connect=True,
prog_plot=False)
elif paint_method == 1: # Seed
elif paint_method == 1: # Seed
cpoly = self.clear_polygon2(bbox,
tooldia=tooldia,
steps_per_circle=obj.circle_steps,
@@ -2622,7 +2622,7 @@ class GeometryObject(FlatCAMObj, Geometry):
contour=True,
connect=True,
prog_plot=False)
elif paint_method == 2: # Lines
elif paint_method == 2: # Lines
cpoly = self.clear_polygon3(bbox,
tooldia=tooldia,
steps_per_circle=obj.circle_steps,

View File

@@ -11,13 +11,11 @@
# ##########################################################
from shapely.geometry import Point, Polygon, MultiPolygon, MultiLineString, LineString, LinearRing
from shapely.ops import unary_union
from shapely.geometry import Point, MultiLineString, LineString, LinearRing
from appParsers.ParseGerber import Gerber
from appObjects.FlatCAMObj import *
import math
import numpy as np
from copy import deepcopy
@@ -210,7 +208,7 @@ class GerberObject(FlatCAMObj, Gerber):
pass
self.apertures_row = 0
aper_no = self.apertures_row + 1
sort = []
for k in list(self.apertures.keys()):
sort.append(int(k))
@@ -397,7 +395,7 @@ class GerberObject(FlatCAMObj, Gerber):
non_copper = bounding_box.difference(self.solid_geometry)
if non_copper is None or non_copper.is_empty:
self.app.inform.emit("[ERROR_NOTCL] %s" % _("Operation could not be done."))
app_obj.inform.emit("[ERROR_NOTCL] %s" % _("Operation could not be done."))
return "fail"
geo_obj.solid_geometry = non_copper
@@ -423,7 +421,7 @@ class GerberObject(FlatCAMObj, Gerber):
bounding_box = bounding_box.envelope
if bounding_box is None or bounding_box.is_empty:
self.app.inform.emit("[ERROR_NOTCL] %s" % _("Operation could not be done."))
app_obj.inform.emit("[ERROR_NOTCL] %s" % _("Operation could not be done."))
return "fail"
geo_obj.solid_geometry = bounding_box
@@ -532,17 +530,16 @@ class GerberObject(FlatCAMObj, Gerber):
"startz": self.app.defaults['geometry_startz']
})
geo_obj.tools = {}
geo_obj.tools['1'] = {}
geo_obj.tools = {'1': {}}
geo_obj.tools.update({
'1': {
'tooldia': dia,
'offset': 'Path',
'offset_value': 0.0,
'type': _('Rough'),
'tool_type': tool_type,
'data': default_data,
'solid_geometry': geo_obj.solid_geometry
'tooldia': dia,
'offset': 'Path',
'offset_value': 0.0,
'type': _('Rough'),
'tool_type': tool_type,
'data': default_data,
'solid_geometry': geo_obj.solid_geometry
}
})
@@ -679,17 +676,16 @@ class GerberObject(FlatCAMObj, Gerber):
"startz": self.app.defaults['geometry_startz']
})
geo_obj.tools = {}
geo_obj.tools['1'] = {}
geo_obj.tools = {'1': {}}
geo_obj.tools.update({
'1': {
'tooldia': dia,
'offset': 'Path',
'offset_value': 0.0,
'type': _('Rough'),
'tool_type': tool_type,
'data': default_data,
'solid_geometry': geo_obj.solid_geometry
'tooldia': dia,
'offset': 'Path',
'offset_value': 0.0,
'type': _('Rough'),
'tool_type': tool_type,
'data': default_data,
'solid_geometry': geo_obj.solid_geometry
}
})
@@ -776,7 +772,7 @@ class GerberObject(FlatCAMObj, Gerber):
else:
follow_name = outname
def follow_init(follow_obj, app):
def follow_init(follow_obj, app_obj):
# Propagate options
follow_obj.options["cnctooldia"] = str(self.app.defaults["tools_iso_tooldia"])
follow_obj.solid_geometry = self.follow_geometry
@@ -854,7 +850,7 @@ class GerberObject(FlatCAMObj, Gerber):
log.debug("FlatCAMObj.GerberObject.convert_units()")
factor = Gerber.convert_units(self, units)
Gerber.convert_units(self, units)
# self.options['isotooldia'] = float(self.options['isotooldia']) * factor
# self.options['bboxmargin'] = float(self.options['bboxmargin']) * factor

View File

@@ -16,7 +16,6 @@ from appGUI.ObjectUI import *
import tkinter as tk
import sys
from copy import deepcopy
import gettext
import appTranslation as fcTranslate
@@ -219,7 +218,7 @@ class ScriptObject(FlatCAMObj):
# it means that the script finished with an error
result = self.app.shell.tcl.eval("set errorInfo")
log.error("Exec command Exception: %s\n" % result)
self.app.shell.append_error('ERROR: %s\n '% result)
self.app.shell.append_error('ERROR: %s\n' % result)
self.app.ui.fcinfo.lock_pmaps = False
self.app.shell.close_processing()

View File

@@ -1090,14 +1090,14 @@ class ObjectCollection(QtCore.QAbstractItemModel):
def add_act(o_name):
obj_for_icon = self.get_by_name(o_name)
add_action = QtWidgets.QAction(parent=self.app.ui.menuobjects)
add_action.setCheckable(True)
add_action.setText(o_name)
add_action.setIcon(QtGui.QIcon(icon_files[obj_for_icon.kind]))
add_action.triggered.connect(
lambda: self.set_active(o_name) if add_action.isChecked() is True else
menu_action = QtWidgets.QAction(parent=self.app.ui.menuobjects)
menu_action.setCheckable(True)
menu_action.setText(o_name)
menu_action.setIcon(QtGui.QIcon(icon_files[obj_for_icon.kind]))
menu_action.triggered.connect(
lambda: self.set_active(o_name) if menu_action.isChecked() is True else
self.set_inactive(o_name))
self.app.ui.menuobjects.addAction(add_action)
self.app.ui.menuobjects.addAction(menu_action)
for name in gerber_list:
add_act(name)