- refactored the imports in the Plugins, moved almost all imports in the AppTool file

- fixed a number of issues, mostly leftovers from moving the UI of a Plugin in its own class
- fixed some bugs in the Punch Gerber plugin
- fixed some bugs where the 'pool' parameter was not passed when creating shapes collections (in 3D graphic mode); I wonder how it worked until now
- added a new feature in the Isolation Plugin: now for all the isolation Geometry objects this plugin can do a supplementary simplification of the geometry using the tolerance parameter defined in the General Parameters. This should lead to a reduced number of tool lifts when doing corners
This commit is contained in:
Marius Stanciu
2022-03-31 19:28:19 +03:00
committed by Marius Stanciu
parent e1824a09f7
commit ada48269a9
43 changed files with 378 additions and 797 deletions

View File

@@ -5,25 +5,9 @@
# MIT Licence #
# ##########################################################
from PyQt6 import QtWidgets, QtGui, QtCore
from appTool import AppTool
from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, RadioSet, FCCheckBox, OptionalInputSection, FCComboBox, \
FCButton, FCLabel, VerticalScrollArea, FCGridLayout, FCFrame
from appTool import *
from camlib import grace
from copy import deepcopy
import numpy as np
import shapely.affinity as affinity
from shapely.ops import unary_union, linemerge, snap
from shapely.geometry import LineString, MultiLineString, Polygon, MultiPolygon
import gettext
import appTranslation as fcTranslate
import builtins
import logging
fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
@@ -328,18 +312,18 @@ class Panelize(AppTool):
boxname = self.ui.box_combo.currentText()
try:
box = self.app.collection.get_by_name(boxname)
box_obj = self.app.collection.get_by_name(boxname)
except Exception as e:
self.app.log.error("Panelize.on_panelize() --> %s" % str(e))
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve object"), boxname))
return
if box is None:
if box_obj is None:
self.app.inform.emit('[WARNING_NOTCL] %s: %s' % (_("No object Box. Using instead"), panel_source_obj))
self.ui.reference_radio.set_value('bbox')
if self.ui.reference_radio.get_value() == 'bbox':
box = panel_source_obj
box_obj = panel_source_obj
self.outname = name + '_panelized'
@@ -365,7 +349,7 @@ class Panelize(AppTool):
_("Columns or Rows are zero value. Change them to a positive integer."))
return
xmin, ymin, xmax, ymax = box.bounds()
xmin, ymin, xmax, ymax = box_obj.bounds()
lenghtx = xmax - xmin + spacing_columns
lenghty = ymax - ymin + spacing_rows
@@ -450,7 +434,7 @@ class Panelize(AppTool):
raise grace
# offset / panelization
point_offseted = affinity.translate(drill, currentx, currenty)
point_offseted = translate(drill, currentx, currenty)
obj_fin.tools[tool]['drills'].append(point_offseted)
# update progress
@@ -474,8 +458,8 @@ class Panelize(AppTool):
raise grace
# offset / panelization
start_offseted = affinity.translate(slot[0], currentx, currenty)
stop_offseted = affinity.translate(slot[1], currentx, currenty)
start_offseted = translate(slot[0], currentx, currenty)
stop_offseted = translate(slot[1], currentx, currenty)
offseted_slot = (
start_offseted,
stop_offseted
@@ -522,7 +506,7 @@ class Panelize(AppTool):
geoms.append(res_geo)
return geoms
else:
return affinity.translate(geom, xoff=currentx, yoff=currenty)
return translate(geom, xoff=currentx, yoff=currenty)
new_obj.solid_geometry = []
@@ -836,7 +820,7 @@ class Panelize(AppTool):
geoms.append(res_geo)
return geoms
else:
return affinity.translate(geom, xoff=currentx, yoff=currenty)
return translate(geom, xoff=currentx, yoff=currenty)
new_obj.solid_geometry = []