Hole milling is functional. Solves issue #74.
This commit is contained in:
@@ -84,9 +84,11 @@ class App(QtCore.QObject):
|
|||||||
App.log.debug("Win32!")
|
App.log.debug("Win32!")
|
||||||
self.data_path = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, None, 0) + \
|
self.data_path = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, None, 0) + \
|
||||||
'/FlatCAM'
|
'/FlatCAM'
|
||||||
|
self.os = 'windows'
|
||||||
else: # Linux/Unix/MacOS
|
else: # Linux/Unix/MacOS
|
||||||
self.data_path = os.path.expanduser('~') + \
|
self.data_path = os.path.expanduser('~') + \
|
||||||
'/.FlatCAM'
|
'/.FlatCAM'
|
||||||
|
self.os = 'unix'
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
### Setup folders and files ###
|
### Setup folders and files ###
|
||||||
|
|||||||
@@ -635,13 +635,19 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
|||||||
self.app.report_usage("excellon_on_create_milling_button")
|
self.app.report_usage("excellon_on_create_milling_button")
|
||||||
self.read_form()
|
self.read_form()
|
||||||
|
|
||||||
# Get the tools from the list
|
# Get the tools from the list. These are keys
|
||||||
|
# to self.tools
|
||||||
tools = self.get_selected_tools_list()
|
tools = self.get_selected_tools_list()
|
||||||
|
|
||||||
if len(tools) == 0:
|
if len(tools) == 0:
|
||||||
self.app.inform.emit("Please select one or more tools from the list and try again.")
|
self.app.inform.emit("Please select one or more tools from the list and try again.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
for tool in tools:
|
||||||
|
if self.tools[tool]["C"] < self.options["tooldia"]:
|
||||||
|
self.app.inform.emit("[warning] Milling tool is larger than hole size. Cancelled.")
|
||||||
|
return
|
||||||
|
|
||||||
geo_name = self.options["name"] + "_mill"
|
geo_name = self.options["name"] + "_mill"
|
||||||
|
|
||||||
def geo_init(geo_obj, app_obj):
|
def geo_init(geo_obj, app_obj):
|
||||||
@@ -653,7 +659,8 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
|||||||
for hole in self.drills:
|
for hole in self.drills:
|
||||||
if hole['tool'] in tools:
|
if hole['tool'] in tools:
|
||||||
geo_obj.solid_geometry.append(
|
geo_obj.solid_geometry.append(
|
||||||
Point(hole['point']).buffer(self.tools[hole['tool']]["C"]/2 - self.options["tooldia"]/2).exterior
|
Point(hole['point']).buffer(self.tools[hole['tool']]["C"] / 2 -
|
||||||
|
self.options["tooldia"] / 2).exterior
|
||||||
)
|
)
|
||||||
|
|
||||||
def geo_thread(app_obj):
|
def geo_thread(app_obj):
|
||||||
@@ -1121,7 +1128,9 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
try:
|
try:
|
||||||
for sub_el in element:
|
for sub_el in element:
|
||||||
self.plot_element(sub_el)
|
self.plot_element(sub_el)
|
||||||
except TypeError:
|
|
||||||
|
except TypeError: # Element is not iterable...
|
||||||
|
|
||||||
if type(element) == Polygon:
|
if type(element) == Polygon:
|
||||||
x, y = element.exterior.coords.xy
|
x, y = element.exterior.coords.xy
|
||||||
self.axes.plot(x, y, 'r-')
|
self.axes.plot(x, y, 'r-')
|
||||||
@@ -1135,7 +1144,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
self.axes.plot(x, y, 'r-')
|
self.axes.plot(x, y, 'r-')
|
||||||
return
|
return
|
||||||
|
|
||||||
FlatCAMApp.App.log.warning("Did not plot:", str(type(element)))
|
FlatCAMApp.App.log.warning("Did not plot:" + str(type(element)))
|
||||||
|
|
||||||
def plot(self):
|
def plot(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
11
camlib.py
11
camlib.py
@@ -191,6 +191,15 @@ class Geometry(object):
|
|||||||
"""
|
"""
|
||||||
return self.solid_geometry.buffer(offset)
|
return self.solid_geometry.buffer(offset)
|
||||||
|
|
||||||
|
def is_empty(self):
|
||||||
|
if self.solid_geometry is None:
|
||||||
|
return True
|
||||||
|
|
||||||
|
if type(self.solid_geometry) is list and len(self.solid_geometry) == 0:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def size(self):
|
def size(self):
|
||||||
"""
|
"""
|
||||||
Returns (width, height) of rectangular
|
Returns (width, height) of rectangular
|
||||||
@@ -200,7 +209,7 @@ class Geometry(object):
|
|||||||
log.warning("Solid_geometry not computed yet.")
|
log.warning("Solid_geometry not computed yet.")
|
||||||
return 0
|
return 0
|
||||||
bounds = self.bounds()
|
bounds = self.bounds()
|
||||||
return bounds[2]-bounds[0], bounds[3]-bounds[1]
|
return bounds[2] - bounds[0], bounds[3] - bounds[1]
|
||||||
|
|
||||||
def get_empty_area(self, boundary=None):
|
def get_empty_area(self, boundary=None):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user