- fixed bug in Panelization Tool for which in case of Excellon objects, the panel kept a reference to the source object which created issues when moving or disabling/enabling the plots
- cleaned up the module imports throughout the app (the TclCommands are not yet verified)
This commit is contained in:
@@ -5,8 +5,9 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from PyQt5 import QtWidgets
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from FlatCAMObj import *
|
||||
from flatcamGUI.GUIElements import FCSpinner, FCDoubleSpinner, FCEntry
|
||||
import math
|
||||
|
||||
import gettext
|
||||
@@ -321,11 +322,11 @@ class ToolCalculator(FlatCAMTool):
|
||||
|
||||
def on_calculate_inch_units(self):
|
||||
mm_val = float(self.mm_entry.get_value())
|
||||
self.inch_entry.set_value('%.*f' % (self.decimals,(mm_val / 25.4)))
|
||||
self.inch_entry.set_value('%.*f' % (self.decimals, (mm_val / 25.4)))
|
||||
|
||||
def on_calculate_mm_units(self):
|
||||
inch_val = float(self.inch_entry.get_value())
|
||||
self.mm_entry.set_value('%.*f' % (self.decimals,(inch_val * 25.4)))
|
||||
self.mm_entry.set_value('%.*f' % (self.decimals, (inch_val * 25.4)))
|
||||
|
||||
def on_calculate_eplate(self):
|
||||
length = float(self.pcblength_entry.get_value())
|
||||
|
||||
@@ -5,12 +5,21 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from PyQt5 import QtWidgets, QtGui, QtCore
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from ObjectCollection import *
|
||||
from FlatCAMApp import *
|
||||
from shapely.geometry import box
|
||||
from shapely.ops import cascaded_union, unary_union
|
||||
from flatcamGUI.GUIElements import FCDoubleSpinner, FCCheckBox, RadioSet, FCComboBox
|
||||
from FlatCAMObj import FlatCAMGerber
|
||||
|
||||
from shapely.geometry import box, MultiPolygon, Polygon, LineString, LinearRing
|
||||
from shapely.ops import cascaded_union, unary_union
|
||||
import shapely.affinity as affinity
|
||||
|
||||
from matplotlib.backend_bases import KeyEvent as mpl_key_event
|
||||
|
||||
from numpy import Inf
|
||||
from copy import deepcopy
|
||||
import math
|
||||
import logging
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
import builtins
|
||||
@@ -19,6 +28,8 @@ fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class CutOut(FlatCAMTool):
|
||||
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
|
||||
from PyQt5 import QtWidgets, QtCore
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from FlatCAMObj import *
|
||||
from flatcamGUI.GUIElements import RadioSet, FCDoubleSpinner, EvalEntry
|
||||
from FlatCAMObj import FlatCAMGerber, FlatCAMExcellon, FlatCAMGeometry
|
||||
|
||||
from shapely.geometry import Point
|
||||
from shapely import affinity
|
||||
from PyQt5 import QtCore
|
||||
|
||||
import logging
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
import builtins
|
||||
@@ -12,6 +17,8 @@ fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class DblSidedTool(FlatCAMTool):
|
||||
|
||||
|
||||
@@ -5,12 +5,15 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from PyQt5 import QtWidgets, QtCore
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from FlatCAMObj import *
|
||||
from flatcamGUI.VisPyVisuals import *
|
||||
from flatcamGUI.GUIElements import FCEntry
|
||||
|
||||
from math import sqrt
|
||||
|
||||
import copy
|
||||
import math
|
||||
import logging
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
import builtins
|
||||
@@ -19,6 +22,8 @@ fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class Distance(FlatCAMTool):
|
||||
|
||||
@@ -335,7 +340,7 @@ class Distance(FlatCAMTool):
|
||||
elif len(self.points) == 2:
|
||||
dx = self.points[1][0] - self.points[0][0]
|
||||
dy = self.points[1][1] - self.points[0][1]
|
||||
d = sqrt(dx ** 2 + dy ** 2)
|
||||
d = math.sqrt(dx ** 2 + dy ** 2)
|
||||
self.stop_entry.set_value("(%.*f, %.*f)" % (self.decimals, pos[0], self.decimals, pos[1]))
|
||||
|
||||
self.app.inform.emit(_("MEASURING: Result D(x) = {d_x} | D(y) = {d_y} | Distance = {d_z}").format(
|
||||
|
||||
@@ -5,14 +5,16 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from PyQt5 import QtWidgets, QtCore
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from FlatCAMObj import *
|
||||
from flatcamGUI.VisPyVisuals import *
|
||||
from flatcamGUI.GUIElements import FCEntry
|
||||
|
||||
from shapely.ops import nearest_points
|
||||
from shapely.geometry import Point
|
||||
|
||||
from math import sqrt
|
||||
|
||||
import math
|
||||
import logging
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
import builtins
|
||||
@@ -21,6 +23,8 @@ fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class DistanceMin(FlatCAMTool):
|
||||
|
||||
@@ -260,7 +264,7 @@ class DistanceMin(FlatCAMTool):
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
d = sqrt(dx ** 2 + dy ** 2)
|
||||
d = math.sqrt(dx ** 2 + dy ** 2)
|
||||
self.total_distance_entry.set_value('%.*f' % (self.decimals, abs(d)))
|
||||
|
||||
self.h_point = (min(first_pos.x, last_pos.x) + (abs(dx) / 2), min(first_pos.y, last_pos.y) + (abs(dy) / 2))
|
||||
|
||||
@@ -5,14 +5,15 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from FlatCAMObj import *
|
||||
|
||||
from flatcamGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, \
|
||||
OptionalHideInputSection, OptionalInputSection
|
||||
from PyQt5 import QtGui, QtCore, QtWidgets
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from flatcamGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, \
|
||||
OptionalHideInputSection, OptionalInputSection
|
||||
|
||||
from copy import deepcopy
|
||||
import logging
|
||||
from shapely.geometry import Polygon, MultiPolygon, Point
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
@@ -22,6 +23,8 @@ fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class Film(FlatCAMTool):
|
||||
|
||||
@@ -166,7 +169,7 @@ class Film(FlatCAMTool):
|
||||
self.ois_scale = OptionalInputSection(self.film_scale_cb, [self.film_scalex_label, self.film_scalex_entry,
|
||||
self.film_scaley_label, self.film_scaley_entry])
|
||||
# Skew Geometry
|
||||
self.film_skew_cb =FCCheckBox('%s' % _("Skew Film geometry"))
|
||||
self.film_skew_cb = FCCheckBox('%s' % _("Skew Film geometry"))
|
||||
self.film_skew_cb.setToolTip(
|
||||
_("Positive values will skew to the right\n"
|
||||
"while negative values will skew to the left.")
|
||||
@@ -202,9 +205,9 @@ class Film(FlatCAMTool):
|
||||
"It can be one of the four points of the geometry bounding box.")
|
||||
)
|
||||
self.film_skew_reference = RadioSet([{'label': _('Bottom Left'), 'value': 'bottomleft'},
|
||||
{'label': _('Top Left'), 'value': 'topleft'},
|
||||
{'label': _('Bottom Right'), 'value': 'bottomright'},
|
||||
{'label': _('Top right'), 'value': 'topright'}],
|
||||
{'label': _('Top Left'), 'value': 'topleft'},
|
||||
{'label': _('Bottom Right'), 'value': 'bottomright'},
|
||||
{'label': _('Top right'), 'value': 'topright'}],
|
||||
orientation='vertical',
|
||||
stretch=False)
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
|
||||
from flatcamGUI.GUIElements import RadioSet, FCComboBox, FCSpinner
|
||||
from PyQt5 import QtGui, QtWidgets
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from flatcamGUI.GUIElements import RadioSet, FCComboBox, FCSpinner
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
import builtins
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from PyQt5 import QtWidgets, QtCore
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from FlatCAMObj import *
|
||||
from flatcamGUI.VisPyVisuals import *
|
||||
from FlatCAMObj import FlatCAMGerber
|
||||
|
||||
from copy import copy
|
||||
|
||||
import logging
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
import builtins
|
||||
@@ -19,11 +20,13 @@ fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class ToolMove(FlatCAMTool):
|
||||
|
||||
toolName = _("Move")
|
||||
replot_signal = pyqtSignal(list)
|
||||
replot_signal = QtCore.pyqtSignal(list)
|
||||
|
||||
def __init__(self, app):
|
||||
FlatCAMTool.__init__(self, app)
|
||||
|
||||
@@ -5,12 +5,23 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from PyQt5 import QtWidgets, QtCore, QtGui
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from copy import copy, deepcopy
|
||||
from ObjectCollection import *
|
||||
import time
|
||||
from shapely.geometry import base
|
||||
from flatcamGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCInputDialog
|
||||
from flatcamParsers.ParseGerber import Gerber
|
||||
from FlatCAMObj import FlatCAMGeometry, FlatCAMGerber
|
||||
import FlatCAMApp
|
||||
|
||||
from copy import deepcopy
|
||||
|
||||
import numpy as np
|
||||
import math
|
||||
from shapely.geometry import base
|
||||
from shapely.ops import cascaded_union
|
||||
from shapely.geometry import MultiPolygon, Polygon, MultiLineString, LineString, LinearRing
|
||||
|
||||
import logging
|
||||
import traceback
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
import builtins
|
||||
@@ -19,6 +30,8 @@ fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class NonCopperClear(FlatCAMTool, Gerber):
|
||||
|
||||
@@ -473,7 +486,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
"Add", self.on_add_tool_by_key, icon=QtGui.QIcon("share/plus16.png"))
|
||||
self.tools_table.addContextMenu(
|
||||
"Delete", lambda:
|
||||
self.on_tool_delete(rows_to_delete=None, all=None), icon=QtGui.QIcon("share/delete32.png"))
|
||||
self.on_tool_delete(rows_to_delete=None, all_tools=None), icon=QtGui.QIcon("share/delete32.png"))
|
||||
|
||||
# #############################################################################
|
||||
# ########################## VARIABLES ########################################
|
||||
@@ -1040,12 +1053,19 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
"New diameter value is already in the Tool Table."))
|
||||
self.build_ui()
|
||||
|
||||
def on_tool_delete(self, rows_to_delete=None, all=None):
|
||||
def on_tool_delete(self, rows_to_delete=None, all_tools=None):
|
||||
"""
|
||||
Will delete a tool in the tool table
|
||||
|
||||
:param rows_to_delete: which rows to delete; can be a list
|
||||
:param all_tools: delete all tools in the tool table
|
||||
:return:
|
||||
"""
|
||||
self.ui_disconnect()
|
||||
|
||||
deleted_tools_list = []
|
||||
|
||||
if all:
|
||||
if all_tools:
|
||||
self.paint_tools.clear()
|
||||
self.build_ui()
|
||||
return
|
||||
|
||||
@@ -5,13 +5,19 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from FlatCAMObj import *
|
||||
from shapely.geometry import Point
|
||||
from shapely import affinity
|
||||
from shapely.ops import nearest_points
|
||||
from PyQt5 import QtCore
|
||||
from PyQt5 import QtWidgets, QtCore, QtGui
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from flatcamGUI.GUIElements import OptionalHideInputSection, FCTextArea, FCEntry, FCSpinner, FCCheckBox
|
||||
from FlatCAMObj import FlatCAMGerber
|
||||
import FlatCAMApp
|
||||
|
||||
from shapely.geometry import MultiPolygon
|
||||
from shapely.ops import nearest_points
|
||||
|
||||
import numpy as np
|
||||
|
||||
import logging
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
import builtins
|
||||
@@ -20,13 +26,15 @@ fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class ToolOptimal(FlatCAMTool):
|
||||
|
||||
toolName = _("Optimal Tool")
|
||||
|
||||
update_text = pyqtSignal(list)
|
||||
update_sec_distances = pyqtSignal(dict)
|
||||
update_text = QtCore.pyqtSignal(list)
|
||||
update_sec_distances = QtCore.pyqtSignal(dict)
|
||||
|
||||
def __init__(self, app):
|
||||
FlatCAMTool.__init__(self, app)
|
||||
|
||||
@@ -5,19 +5,22 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from PyQt5 import QtWidgets, QtCore
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from shapely.geometry import Point, Polygon, LineString
|
||||
from shapely.ops import cascaded_union, unary_union
|
||||
import FlatCAMApp
|
||||
|
||||
from FlatCAMObj import *
|
||||
from shapely.geometry import Point, Polygon, LineString, MultiPolygon
|
||||
from shapely.ops import unary_union
|
||||
|
||||
import math
|
||||
from copy import copy, deepcopy
|
||||
import numpy as np
|
||||
|
||||
import zlib
|
||||
import re
|
||||
import time
|
||||
import logging
|
||||
import traceback
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
@@ -27,6 +30,8 @@ fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class ToolPDF(FlatCAMTool):
|
||||
"""
|
||||
|
||||
@@ -5,10 +5,25 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from PyQt5 import QtWidgets, QtGui, QtCore
|
||||
from PyQt5.QtCore import Qt
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from copy import copy, deepcopy
|
||||
from ObjectCollection import *
|
||||
from shapely.geometry import base
|
||||
from copy import deepcopy
|
||||
# from ObjectCollection import *
|
||||
from flatcamParsers.ParseGerber import Gerber
|
||||
from FlatCAMObj import FlatCAMGerber, FlatCAMGeometry
|
||||
from camlib import Geometry
|
||||
from flatcamGUI.GUIElements import FCTable, FCDoubleSpinner, FCCheckBox, FCInputDialog, RadioSet
|
||||
import FlatCAMApp
|
||||
|
||||
from shapely.geometry import base, Polygon, MultiPolygon, LinearRing
|
||||
from shapely.ops import cascaded_union
|
||||
|
||||
import numpy as np
|
||||
from numpy import Inf
|
||||
import traceback
|
||||
import logging
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
@@ -18,6 +33,8 @@ fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class ToolPaint(FlatCAMTool, Gerber):
|
||||
|
||||
@@ -374,6 +391,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
||||
|
||||
self.mm = None
|
||||
self.mp = None
|
||||
self.mr = None
|
||||
|
||||
self.sel_rect = []
|
||||
|
||||
@@ -641,10 +659,10 @@ class ToolPaint(FlatCAMTool, Gerber):
|
||||
for tooluid_key, tooluid_value in self.paint_tools.items():
|
||||
if float('%.*f' % (self.decimals, tooluid_value['tooldia'])) == tool_sorted:
|
||||
tool_id += 1
|
||||
id = QtWidgets.QTableWidgetItem('%d' % int(tool_id))
|
||||
id.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||
id_item = QtWidgets.QTableWidgetItem('%d' % int(tool_id))
|
||||
id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||
row_no = tool_id - 1
|
||||
self.tools_table.setItem(row_no, 0, id) # Tool name/id
|
||||
self.tools_table.setItem(row_no, 0, id_item) # Tool name/id
|
||||
|
||||
# Make sure that the drill diameter when in MM is with no more than 2 decimals
|
||||
# There are no drill bits in MM with more than 2 decimals diameter
|
||||
@@ -2213,7 +2231,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
||||
log.debug("Could not Paint the polygons. %s" % str(e))
|
||||
self.app.inform.emit('[ERROR] %s\n%s' %
|
||||
(_("Could not do Paint All. Try a different combination of parameters. "
|
||||
"Or a different Method of paint"), str(e)))
|
||||
"Or a different Method of paint"), str(e)))
|
||||
return
|
||||
|
||||
pol_nr += 1
|
||||
@@ -2373,7 +2391,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
||||
log.debug("Could not Paint the polygons. %s" % str(e))
|
||||
self.app.inform.emit('[ERROR] %s\n%s' %
|
||||
(_("Could not do Paint All. Try a different combination of parameters. "
|
||||
"Or a different Method of paint"), str(e)))
|
||||
"Or a different Method of paint"), str(e)))
|
||||
return
|
||||
|
||||
pol_nr += 1
|
||||
|
||||
@@ -5,19 +5,29 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from PyQt5 import QtWidgets, QtGui, QtCore
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from copy import copy, deepcopy
|
||||
from ObjectCollection import *
|
||||
import time
|
||||
|
||||
from flatcamGUI.GUIElements import FCSpinner, FCDoubleSpinner, RadioSet, FCCheckBox, OptionalInputSection
|
||||
from FlatCAMObj import FlatCAMGeometry, FlatCAMGerber, FlatCAMExcellon
|
||||
import FlatCAMApp
|
||||
from copy import deepcopy
|
||||
# from ObjectCollection import *
|
||||
import numpy as np
|
||||
|
||||
import shapely.affinity as affinity
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
import builtins
|
||||
import logging
|
||||
|
||||
fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class Panelize(FlatCAMTool):
|
||||
|
||||
@@ -367,15 +377,13 @@ class Panelize(FlatCAMTool):
|
||||
|
||||
# Get source object.
|
||||
try:
|
||||
obj = self.app.collection.get_by_name(str(name))
|
||||
panel_obj = self.app.collection.get_by_name(str(name))
|
||||
except Exception as e:
|
||||
log.debug("Panelize.on_panelize() --> %s" % str(e))
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
|
||||
(_("Could not retrieve object"), name))
|
||||
return "Could not retrieve object: %s" % name
|
||||
|
||||
panel_obj = obj
|
||||
|
||||
if panel_obj is None:
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
|
||||
(_("Object not found"), panel_obj))
|
||||
@@ -443,6 +451,18 @@ class Panelize(FlatCAMTool):
|
||||
rows -= 1
|
||||
panel_lengthy = ((ymax - ymin) * rows) + (spacing_rows * (rows - 1))
|
||||
|
||||
if isinstance(panel_obj, FlatCAMExcellon) or isinstance(panel_obj, FlatCAMGeometry):
|
||||
# make a copy of the panelized Excellon or Geometry tools
|
||||
copied_tools = dict()
|
||||
for tt, tt_val in list(panel_obj.tools.items()):
|
||||
copied_tools[tt] = deepcopy(tt_val)
|
||||
|
||||
if isinstance(panel_obj, FlatCAMGerber):
|
||||
# make a copy of the panelized Gerber apertures
|
||||
copied_apertures = dict()
|
||||
for tt, tt_val in list(panel_obj.apertures.items()):
|
||||
copied_apertures[tt] = deepcopy(tt_val)
|
||||
|
||||
def panelize_2():
|
||||
if panel_obj is not None:
|
||||
self.app.inform.emit(_("Generating panel ... "))
|
||||
@@ -452,7 +472,7 @@ class Panelize(FlatCAMTool):
|
||||
def job_init_excellon(obj_fin, app_obj):
|
||||
currenty = 0.0
|
||||
self.app.progress.emit(10)
|
||||
obj_fin.tools = panel_obj.tools.copy()
|
||||
obj_fin.tools = copied_tools
|
||||
obj_fin.drills = []
|
||||
obj_fin.slots = []
|
||||
obj_fin.solid_geometry = []
|
||||
@@ -472,7 +492,6 @@ class Panelize(FlatCAMTool):
|
||||
currentx = 0.0
|
||||
for col in range(columns):
|
||||
element += 1
|
||||
disp_number = 0
|
||||
old_disp_number = 0
|
||||
|
||||
if panel_obj.drills:
|
||||
@@ -493,7 +512,7 @@ class Panelize(FlatCAMTool):
|
||||
drill_nr += 1
|
||||
disp_number = int(np.interp(drill_nr, [0, geo_len_drills], [0, 100]))
|
||||
|
||||
if disp_number > old_disp_number and disp_number <= 100:
|
||||
if old_disp_number < disp_number <= 100:
|
||||
self.app.proc_container.update_view_text(' %s: %d D:%d%%' %
|
||||
(_("Copy"),
|
||||
int(element),
|
||||
@@ -520,7 +539,7 @@ class Panelize(FlatCAMTool):
|
||||
slot_nr += 1
|
||||
disp_number = int(np.interp(slot_nr, [0, geo_len_slots], [0, 100]))
|
||||
|
||||
if disp_number > old_disp_number and disp_number <= 100:
|
||||
if old_disp_number < disp_number <= 100:
|
||||
self.app.proc_container.update_view_text(' %s: %d S:%d%%' %
|
||||
(_("Copy"),
|
||||
int(element),
|
||||
@@ -557,12 +576,12 @@ class Panelize(FlatCAMTool):
|
||||
# create the initial structure on which to create the panel
|
||||
if isinstance(panel_obj, FlatCAMGeometry):
|
||||
obj_fin.multigeo = panel_obj.multigeo
|
||||
obj_fin.tools = deepcopy(panel_obj.tools)
|
||||
obj_fin.tools = copied_tools
|
||||
if panel_obj.multigeo is True:
|
||||
for tool in panel_obj.tools:
|
||||
obj_fin.tools[tool]['solid_geometry'][:] = []
|
||||
elif isinstance(panel_obj, FlatCAMGerber):
|
||||
obj_fin.apertures = deepcopy(panel_obj.apertures)
|
||||
obj_fin.apertures = copied_apertures
|
||||
for ap in obj_fin.apertures:
|
||||
obj_fin.apertures[ap]['geometry'] = list()
|
||||
|
||||
@@ -594,7 +613,6 @@ class Panelize(FlatCAMTool):
|
||||
|
||||
for col in range(columns):
|
||||
element += 1
|
||||
disp_number = 0
|
||||
old_disp_number = 0
|
||||
|
||||
if isinstance(panel_obj, FlatCAMGeometry):
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from PyQt5 import QtWidgets, QtCore
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from flatcamGUI.GUIElements import RadioSet, FCSpinner, FCButton, FCTable
|
||||
|
||||
from flatcamGUI.GUIElements import RadioSet, FCComboBox, FCSpinner, FCButton, FCTable
|
||||
from PyQt5 import QtGui, QtWidgets, QtCore
|
||||
from PyQt5.QtCore import pyqtSignal
|
||||
import re
|
||||
import os
|
||||
from datetime import datetime
|
||||
@@ -26,7 +26,7 @@ if '_' not in builtins.__dict__:
|
||||
|
||||
class PcbWizard(FlatCAMTool):
|
||||
|
||||
file_loaded = pyqtSignal(str, str)
|
||||
file_loaded = QtCore.pyqtSignal(str, str)
|
||||
|
||||
toolName = _("PcbWizard Import Tool")
|
||||
|
||||
|
||||
@@ -6,10 +6,14 @@
|
||||
# ##########################################################
|
||||
|
||||
from PyQt5 import QtGui, QtCore, QtWidgets
|
||||
from PyQt5.QtCore import Qt
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from FlatCAMObj import *
|
||||
from FlatCAMObj import FlatCAMCNCjob
|
||||
|
||||
from shapely.geometry import MultiPolygon, Polygon
|
||||
from shapely.ops import cascaded_union
|
||||
|
||||
from copy import deepcopy
|
||||
import logging
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
import builtins
|
||||
@@ -18,11 +22,13 @@ fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class Properties(FlatCAMTool):
|
||||
toolName = _("Properties")
|
||||
|
||||
calculations_finished = pyqtSignal(float, float, float, float, object)
|
||||
calculations_finished = QtCore.pyqtSignal(float, float, float, float, object)
|
||||
|
||||
def __init__(self, app):
|
||||
FlatCAMTool.__init__(self, app)
|
||||
@@ -150,18 +156,18 @@ class Properties(FlatCAMTool):
|
||||
|
||||
self.addChild(obj_name, [obj.options['name']])
|
||||
|
||||
def job_thread(obj):
|
||||
def job_thread(obj_prop):
|
||||
proc = self.app.proc_container.new(_("Calculating dimensions ... Please wait."))
|
||||
|
||||
length = 0.0
|
||||
width = 0.0
|
||||
area = 0.0
|
||||
|
||||
geo = obj.solid_geometry
|
||||
geo = obj_prop.solid_geometry
|
||||
if geo:
|
||||
# calculate physical dimensions
|
||||
try:
|
||||
xmin, ymin, xmax, ymax = obj.bounds()
|
||||
xmin, ymin, xmax, ymax = obj_prop.bounds()
|
||||
|
||||
length = abs(xmax - xmin)
|
||||
width = abs(ymax - ymin)
|
||||
@@ -179,9 +185,9 @@ class Properties(FlatCAMTool):
|
||||
xmax = []
|
||||
ymax = []
|
||||
|
||||
for tool in obj.tools:
|
||||
for tool_k in obj_prop.tools:
|
||||
try:
|
||||
x0, y0, x1, y1 = cascaded_union(obj.tools[tool]['solid_geometry']).bounds
|
||||
x0, y0, x1, y1 = cascaded_union(obj_prop.tools[tool_k]['solid_geometry']).bounds
|
||||
xmin.append(x0)
|
||||
ymin.append(y0)
|
||||
xmax.append(x1)
|
||||
@@ -207,25 +213,25 @@ class Properties(FlatCAMTool):
|
||||
log.debug("Properties.addItems() --> %s" % str(e))
|
||||
|
||||
area_chull = 0.0
|
||||
if not isinstance(obj, FlatCAMCNCjob):
|
||||
if not isinstance(obj_prop, FlatCAMCNCjob):
|
||||
# calculate and add convex hull area
|
||||
if geo:
|
||||
if isinstance(geo, MultiPolygon):
|
||||
env_obj = geo.convex_hull
|
||||
elif (isinstance(geo, MultiPolygon) and len(geo) == 1) or \
|
||||
(isinstance(geo, list) and len(geo) == 1) and isinstance(geo[0], Polygon):
|
||||
env_obj = cascaded_union(obj.solid_geometry)
|
||||
env_obj = cascaded_union(obj_prop.solid_geometry)
|
||||
env_obj = env_obj.convex_hull
|
||||
else:
|
||||
env_obj = cascaded_union(obj.solid_geometry)
|
||||
env_obj = cascaded_union(obj_prop.solid_geometry)
|
||||
env_obj = env_obj.convex_hull
|
||||
|
||||
area_chull = env_obj.area
|
||||
else:
|
||||
try:
|
||||
area_chull = []
|
||||
for tool in obj.tools:
|
||||
area_el = cascaded_union(obj.tools[tool]['solid_geometry']).convex_hull
|
||||
for tool_k in obj_prop.tools:
|
||||
area_el = cascaded_union(obj_prop.tools[tool_k]['solid_geometry']).convex_hull
|
||||
area_chull.append(area_el.area)
|
||||
area_chull = max(area_chull)
|
||||
except Exception as e:
|
||||
|
||||
@@ -5,15 +5,18 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from copy import copy, deepcopy
|
||||
from ObjectCollection import *
|
||||
import time
|
||||
from FlatCAMPool import *
|
||||
from os import getpid
|
||||
from shapely.ops import nearest_points
|
||||
from shapely.geometry.base import BaseGeometry
|
||||
from PyQt5 import QtWidgets
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from flatcamGUI.GUIElements import FCDoubleSpinner, FCCheckBox, OptionalInputSection
|
||||
from copy import deepcopy
|
||||
|
||||
from FlatCAMPool import *
|
||||
# from os import getpid
|
||||
from shapely.ops import nearest_points
|
||||
from shapely.geometry import MultiPolygon, Polygon
|
||||
|
||||
import logging
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
import builtins
|
||||
@@ -22,12 +25,14 @@ fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class RulesCheck(FlatCAMTool):
|
||||
|
||||
toolName = _("Check Rules")
|
||||
|
||||
tool_finished = pyqtSignal(list)
|
||||
tool_finished = QtCore.pyqtSignal(list)
|
||||
|
||||
def __init__(self, app):
|
||||
super(RulesCheck, self).__init__(self)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
# from PyQt5.QtCore import pyqtSignal
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QTextCursor
|
||||
from PyQt5.QtWidgets import QVBoxLayout, QWidget
|
||||
|
||||
@@ -5,12 +5,18 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from PyQt5 import QtWidgets, QtCore
|
||||
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
# from copy import copy, deepcopy
|
||||
from ObjectCollection import *
|
||||
import time
|
||||
from flatcamGUI.GUIElements import FCCheckBox, FCButton
|
||||
|
||||
from shapely.geometry import Polygon, MultiPolygon, MultiLineString, LineString
|
||||
from shapely.ops import cascaded_union
|
||||
|
||||
import traceback
|
||||
from copy import deepcopy
|
||||
import time
|
||||
import logging
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
import builtins
|
||||
@@ -19,6 +25,8 @@ fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
log = logging.getLogger('base')
|
||||
|
||||
|
||||
class ToolSub(FlatCAMTool):
|
||||
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from PyQt5 import QtWidgets
|
||||
from FlatCAMTool import FlatCAMTool
|
||||
from FlatCAMObj import *
|
||||
from flatcamGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCButton, OptionalInputSection, EvalEntry2
|
||||
from FlatCAMObj import FlatCAMCNCjob
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
@@ -271,7 +273,7 @@ class ToolTransform(FlatCAMTool):
|
||||
_("Flip the selected object(s) over the X axis.")
|
||||
)
|
||||
|
||||
hlay0= QtWidgets.QHBoxLayout()
|
||||
hlay0 = QtWidgets.QHBoxLayout()
|
||||
self.transform_lay.addLayout(hlay0)
|
||||
|
||||
hlay0.addWidget(self.flipx_button)
|
||||
@@ -312,7 +314,7 @@ class ToolTransform(FlatCAMTool):
|
||||
|
||||
self.ois_flip = OptionalInputSection(self.flip_ref_cb, [self.flip_ref_entry, self.flip_ref_button], logic=True)
|
||||
|
||||
hlay1= QtWidgets.QHBoxLayout()
|
||||
hlay1 = QtWidgets.QHBoxLayout()
|
||||
self.transform_lay.addLayout(hlay1)
|
||||
|
||||
hlay1.addWidget(self.flip_ref_label)
|
||||
|
||||
Reference in New Issue
Block a user