- commented the camlib.alpha_shape() as it is not needed but require a huge package (scipy)
This commit is contained in:
@@ -2143,8 +2143,9 @@ class App(QtCore.QObject):
|
|||||||
# set call source to the Editor we go into
|
# set call source to the Editor we go into
|
||||||
self.call_source = 'grb_editor'
|
self.call_source = 'grb_editor'
|
||||||
|
|
||||||
# make sure that we can't select another object while in Editor Mode:
|
# # make sure that we can't select another object while in Editor Mode:
|
||||||
self.collection.view.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
|
# self.collection.view.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
|
||||||
|
self.ui.project_frame.setDisabled(True)
|
||||||
|
|
||||||
# delete any selection shape that might be active as they are not relevant in Editor
|
# delete any selection shape that might be active as they are not relevant in Editor
|
||||||
self.delete_selection_shape()
|
self.delete_selection_shape()
|
||||||
@@ -2273,7 +2274,8 @@ class App(QtCore.QObject):
|
|||||||
self.ui.plot_tab_area.protectTab(0)
|
self.ui.plot_tab_area.protectTab(0)
|
||||||
|
|
||||||
# make sure that we reenable the selection on Project Tab after returning from Editor Mode:
|
# make sure that we reenable the selection on Project Tab after returning from Editor Mode:
|
||||||
self.collection.view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
# self.collection.view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||||
|
self.ui.project_frame.setDisabled(False)
|
||||||
|
|
||||||
def get_last_folder(self):
|
def get_last_folder(self):
|
||||||
return self.defaults["global_last_folder"]
|
return self.defaults["global_last_folder"]
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
|
|
||||||
26.04.2019
|
26.04.2019
|
||||||
|
|
||||||
- small changes in GUI
|
- small changes in GUI; optimized contextual menu display
|
||||||
|
- made sure that the Project Tab is disabled while one of the Editors is active and it is restored after returning to app
|
||||||
|
|
||||||
25.04.2019
|
25.04.2019
|
||||||
|
|
||||||
|
|||||||
@@ -753,12 +753,27 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
|||||||
################
|
################
|
||||||
|
|
||||||
### Project ###
|
### Project ###
|
||||||
|
# self.project_tab = QtWidgets.QWidget()
|
||||||
|
# self.project_tab.setObjectName("project_tab")
|
||||||
|
# # project_tab.setMinimumWidth(250) # Hack
|
||||||
|
# self.project_tab_layout = QtWidgets.QVBoxLayout(self.project_tab)
|
||||||
|
# self.project_tab_layout.setContentsMargins(2, 2, 2, 2)
|
||||||
|
# self.notebook.addTab(self.project_tab,_( "Project"))
|
||||||
|
|
||||||
self.project_tab = QtWidgets.QWidget()
|
self.project_tab = QtWidgets.QWidget()
|
||||||
self.project_tab.setObjectName("project_tab")
|
self.project_tab.setObjectName("project_tab")
|
||||||
# project_tab.setMinimumWidth(250) # Hack
|
|
||||||
self.project_tab_layout = QtWidgets.QVBoxLayout(self.project_tab)
|
self.project_frame_lay = QtWidgets.QVBoxLayout(self.project_tab)
|
||||||
|
self.project_frame_lay.setContentsMargins(0, 0, 0, 0)
|
||||||
|
|
||||||
|
self.project_frame = QtWidgets.QFrame()
|
||||||
|
self.project_frame.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.project_frame_lay.addWidget(self.project_frame)
|
||||||
|
|
||||||
|
self.project_tab_layout = QtWidgets.QVBoxLayout(self.project_frame)
|
||||||
self.project_tab_layout.setContentsMargins(2, 2, 2, 2)
|
self.project_tab_layout.setContentsMargins(2, 2, 2, 2)
|
||||||
self.notebook.addTab(self.project_tab,_( "Project"))
|
self.notebook.addTab(self.project_tab, _("Project"))
|
||||||
|
self.project_frame.setDisabled(False)
|
||||||
|
|
||||||
### Selected ###
|
### Selected ###
|
||||||
self.selected_tab = QtWidgets.QWidget()
|
self.selected_tab = QtWidgets.QWidget()
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import math
|
|||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
import FlatCAMTranslation as fcTranslate
|
import FlatCAMTranslation as fcTranslate
|
||||||
|
import builtins
|
||||||
|
|
||||||
fcTranslate.apply_language('strings')
|
fcTranslate.apply_language('strings')
|
||||||
import builtins
|
|
||||||
if '_' not in builtins.__dict__:
|
if '_' not in builtins.__dict__:
|
||||||
_ = gettext.gettext
|
_ = gettext.gettext
|
||||||
|
|
||||||
|
|||||||
@@ -108,6 +108,11 @@ class ToolSilk(FlatCAMTool):
|
|||||||
# object to hold a flattened geometry
|
# object to hold a flattened geometry
|
||||||
self.flat_geometry = []
|
self.flat_geometry = []
|
||||||
|
|
||||||
|
self.sm_obj = None
|
||||||
|
self.sm_obj_name = None
|
||||||
|
self.silk_obj = None
|
||||||
|
self.silk_obj_name = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.intersect_btn.clicked.disconnect(self.on_intersection_click)
|
self.intersect_btn.clicked.disconnect(self.on_intersection_click)
|
||||||
except:
|
except:
|
||||||
@@ -194,7 +199,6 @@ class ToolSilk(FlatCAMTool):
|
|||||||
|
|
||||||
new_geo = self.subtract_polygon(geo_silk, solder_poly)
|
new_geo = self.subtract_polygon(geo_silk, solder_poly)
|
||||||
if not new_geo.is_empty:
|
if not new_geo.is_empty:
|
||||||
print(new_geo.wkt)
|
|
||||||
# if the resulting geometry is not empty add it to the new_apertures solid_geometry
|
# if the resulting geometry is not empty add it to the new_apertures solid_geometry
|
||||||
try:
|
try:
|
||||||
for g in new_geo:
|
for g in new_geo:
|
||||||
@@ -204,40 +208,37 @@ class ToolSilk(FlatCAMTool):
|
|||||||
# else:
|
# else:
|
||||||
# new_solid_geometry.append(geo_silk)
|
# new_solid_geometry.append(geo_silk)
|
||||||
if new_solid_geometry:
|
if new_solid_geometry:
|
||||||
try:
|
|
||||||
while not self.new_apertures[apid]['solid_geometry']:
|
|
||||||
self.new_apertures[apid]['solid_geometry'] = new_solid_geometry
|
|
||||||
time.sleep(0.5)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
while True:
|
while True:
|
||||||
# removal from list is done in a multithreaded way therefore not always the removal can be done
|
if self.new_apertures[apid]['solid_geometry']:
|
||||||
# so we keep trying until it's done
|
|
||||||
if apid in self.promises:
|
|
||||||
self.promises.remove(apid)
|
|
||||||
else:
|
|
||||||
break
|
break
|
||||||
|
self.new_apertures[apid]['solid_geometry'] = new_solid_geometry
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
except:
|
|
||||||
log.debug("Promise fulfilled: %s" % str(apid))
|
while True:
|
||||||
pass
|
# removal from list is done in a multithreaded way therefore not always the removal can be done
|
||||||
|
# so we keep trying until it's done
|
||||||
|
if apid not in self.promises:
|
||||||
|
break
|
||||||
|
self.promises.remove(apid)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
log.debug("Promise fulfilled: %s" % str(apid))
|
||||||
|
|
||||||
def subtract_polygon(self, geometry, polygon):
|
def subtract_polygon(self, geometry, polygon):
|
||||||
"""
|
"""
|
||||||
Subtract polygon from the given object. This only operates on the paths in the original geometry, i.e. it converts polygons into paths.
|
Subtract polygon from the given object. This only operates on the paths in the original geometry, i.e.
|
||||||
|
it converts polygons into paths.
|
||||||
|
|
||||||
:param points: The vertices of the polygon.
|
:param geometry: The geometry from which to substract.
|
||||||
|
:param polygon: The substractor geometry
|
||||||
:return: none
|
:return: none
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# pathonly should be always True, otherwise polygons are not subtracted
|
# pathonly should be always True, otherwise polygons are not subtracted
|
||||||
flat_geometry = self.flatten(geometry=geometry, pathonly=True)
|
flat_geometry = self.flatten(geometry=geometry, pathonly=True)
|
||||||
log.debug("%d paths" % len(flat_geometry))
|
|
||||||
|
|
||||||
toolgeo=cascaded_union(polygon)
|
toolgeo = cascaded_union(polygon)
|
||||||
diffs=[]
|
diffs = []
|
||||||
for target in flat_geometry:
|
for target in flat_geometry:
|
||||||
if type(target) == LineString or type(target) == LinearRing:
|
if type(target) == LineString or type(target) == LinearRing:
|
||||||
diffs.append(target.difference(toolgeo))
|
diffs.append(target.difference(toolgeo))
|
||||||
@@ -265,7 +266,7 @@ class ToolSilk(FlatCAMTool):
|
|||||||
if reset:
|
if reset:
|
||||||
self.flat_geometry = []
|
self.flat_geometry = []
|
||||||
|
|
||||||
## If iterable, expand recursively.
|
# If iterable, expand recursively.
|
||||||
try:
|
try:
|
||||||
for geo in geometry:
|
for geo in geometry:
|
||||||
if geo is not None:
|
if geo is not None:
|
||||||
@@ -273,7 +274,7 @@ class ToolSilk(FlatCAMTool):
|
|||||||
reset=False,
|
reset=False,
|
||||||
pathonly=pathonly)
|
pathonly=pathonly)
|
||||||
|
|
||||||
## Not iterable, do the actual indexing and add.
|
# Not iterable, do the actual indexing and add.
|
||||||
except TypeError:
|
except TypeError:
|
||||||
if pathonly and type(geometry) == Polygon:
|
if pathonly and type(geometry) == Polygon:
|
||||||
self.flat_geometry.append(geometry.exterior)
|
self.flat_geometry.append(geometry.exterior)
|
||||||
@@ -283,6 +284,7 @@ class ToolSilk(FlatCAMTool):
|
|||||||
else:
|
else:
|
||||||
self.flat_geometry.append(geometry)
|
self.flat_geometry.append(geometry)
|
||||||
|
|
||||||
|
log.debug("%d paths" % len(self.flat_geometry))
|
||||||
return self.flat_geometry
|
return self.flat_geometry
|
||||||
|
|
||||||
def periodic_check(self, check_period, reset=False):
|
def periodic_check(self, check_period, reset=False):
|
||||||
@@ -290,6 +292,7 @@ class ToolSilk(FlatCAMTool):
|
|||||||
This function starts an QTimer and it will periodically check if intersections are done
|
This function starts an QTimer and it will periodically check if intersections are done
|
||||||
|
|
||||||
:param check_period: time at which to check periodically
|
:param check_period: time at which to check periodically
|
||||||
|
:param reset: will reset the timer
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -368,5 +371,3 @@ class ToolSilk(FlatCAMTool):
|
|||||||
def reset_fields(self):
|
def reset_fields(self):
|
||||||
self.silk_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
self.silk_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
||||||
self.sm_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
self.sm_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user