- added a new parameter in the TclCommands: DrillCNCJob, MillDrills, MillSlots named tol (from tolerance). If the diameters of the milled (drilled) dias are within the tolerance specified of the diameters in the Excellon object than those diameters will be processed. This is to help account for rounding errors when having units conversion

This commit is contained in:
Marius Stanciu 2019-09-12 02:07:32 +03:00 committed by Marius
parent 579cf9f620
commit 8e2cca827a
4 changed files with 63 additions and 20 deletions

View File

@ -21,6 +21,7 @@ CAD program, and create G-Code for Isolation routing.
- fixed issue #302 where a copied object lost all the tools
- modified the TclCommand DrillCncJob to have as parameter a list of tool diameters to be drilled instead of tool indexes
- updated the Spanish translation (Google-translation)
- added a new parameter in the TclCommands: DrillCNCJob, MillDrills, MillSlots named tol (from tolerance). If the diameters of the milled (drilled) dias are within the tolerance specified of the diameters in the Excellon object than those diameters will be processed. This is to help account for rounding errors when having units conversion
10.09.2019

View File

@ -1,7 +1,6 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
class TclCommandDrillcncjob(TclCommandSignaled):
"""
Tcl shell command to Generates a Drill CNC Job from a Excellon Object.
@ -30,7 +29,8 @@ class TclCommandDrillcncjob(TclCommandSignaled):
('endz', float),
('ppname_e', str),
('outname', str),
('opt_type', str)
('opt_type', str),
('tol', float)
])
# array of mandatory options for current Tcl command: required = {'name','outname'}
@ -54,8 +54,13 @@ class TclCommandDrillcncjob(TclCommandSignaled):
('endz', 'Z distance at job end (example: 30.0).'),
('ppname_e', 'This is the Excellon postprocessor name: case_sensitive, no_quotes'),
('outname', 'Name of the resulting Geometry object.'),
('opt_type', 'Name of move optimization type. R by default from Rtree or '
'T from Travelling Salesman Algorithm')
('opt_type', 'Name of move optimization type. B by default for Basic OR-Tools, M for Metaheuristic OR-Tools'
'T from Travelling Salesman Algorithm. B and M works only for 64bit version of FlatCAM and '
'T works only for 32bit version of FlatCAM'),
('tol', 'Tolerance. Percentange (0.0 ... 100.0) within which dias in drilled_dias will be judged to be the'
'same as the ones in the tools from the Excellon object. E.g: if in drill_dias we have a diameter'
'with value 1.0, in the Excellon we have a tool with dia = 1.05 and we set a tolerance tol = 5.0'
'then the drills with the dia 1.05 in Excellon will be processed. Float number.')
]),
'examples': ['drillcncjob test.TXT -drillz -1.5 -travelz 14 -feedrate 222 -feedrate_rapid 456 -spindlespeed 777'
' -toolchange True -toolchangez 33 -endz 22 -ppname_e default\n'
@ -98,7 +103,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
diameters = [x.strip() for x in args['drilled_dias'].split(",") if x!= '']
nr_diameters = len(diameters)
req_tools = []
req_tools = set()
for tool in obj.tools:
for req_dia in diameters:
obj_dia_form = float('%.2f' % float(obj.tools[tool]["C"])) if units == 'MM' else \
@ -106,9 +111,18 @@ class TclCommandDrillcncjob(TclCommandSignaled):
req_dia_form = float('%.2f' % float(req_dia)) if units == 'MM' else \
float('%.4f' % float(req_dia))
if obj_dia_form == req_dia_form:
req_tools.append(tool)
nr_diameters -= 1
if 'tol' in args:
tolerance = args['tol'] / 100
tolerance = 0.0 if tolerance < 0.0 else tolerance
tolerance = 1.0 if tolerance > 1.0 else tolerance
if math.isclose(obj_dia_form, req_dia_form, rel_tol=tolerance):
req_tools.add(tool)
nr_diameters -= 1
else:
if obj_dia_form == req_dia_form:
req_tools.add(tool)
nr_diameters -= 1
if nr_diameters > 0:
self.raise_tcl_error("One or more tool diameters of the drills to be drilled passed to the "

View File

@ -24,7 +24,8 @@ class TclCommandMillDrills(TclCommandSignaled):
('milled_dias', str),
('outname', str),
('tooldia', float),
('use_threads', bool)
('use_threads', bool),
('tol', float)
])
# array of mandatory options for current Tcl command: required = {'name','outname'}
@ -38,7 +39,11 @@ class TclCommandMillDrills(TclCommandSignaled):
('milled_dias', 'Comma separated tool diameters of the drills to be milled (example: 0.6, 1.0 or 3.125).'),
('tooldia', 'Diameter of the milling tool (example: 0.1).'),
('outname', 'Name of object to create.'),
('use_thread', 'If to use multithreading: True or False.')
('use_thread', 'If to use multithreading: True or False.'),
('tol', 'Tolerance. Percentange (0.0 ... 100.0) within which dias in milled_dias will be judged to be the'
'same as the ones in the tools from the Excellon object. E.g: if in milled_dias we have a diameter'
'with value 1.0, in the Excellon we have a tool with dia = 1.05 and we set a tolerance tol = 5.0'
'then the drills with the dia 1.05 in Excellon will be processed. Float number.')
]),
'examples': ['milldrills mydrills']
}
@ -73,7 +78,7 @@ class TclCommandMillDrills(TclCommandSignaled):
diameters = [x.strip() for x in args['milled_dias'].split(",") if x != '']
nr_diameters = len(diameters)
req_tools = []
req_tools = set()
for tool in obj.tools:
for req_dia in diameters:
obj_dia_form = float('%.2f' % float(obj.tools[tool]["C"])) if units == 'MM' else \
@ -81,9 +86,18 @@ class TclCommandMillDrills(TclCommandSignaled):
req_dia_form = float('%.2f' % float(req_dia)) if units == 'MM' else \
float('%.4f' % float(req_dia))
if obj_dia_form == req_dia_form:
req_tools.append(tool)
nr_diameters -= 1
if 'tol' in args:
tolerance = args['tol'] / 100
tolerance = 0.0 if tolerance < 0.0 else tolerance
tolerance = 1.0 if tolerance > 1.0 else tolerance
if math.isclose(obj_dia_form, req_dia_form, rel_tol=tolerance):
req_tools.add(tool)
nr_diameters -= 1
else:
if obj_dia_form == req_dia_form:
req_tools.add(tool)
nr_diameters -= 1
if nr_diameters > 0:
self.raise_tcl_error("One or more tool diameters of the drills to be milled passed to the "

View File

@ -24,7 +24,8 @@ class TclCommandMillSlots(TclCommandSignaled):
('milled_dias', str),
('outname', str),
('tooldia', float),
('use_threads', bool)
('use_threads', bool),
('tol', float)
])
# array of mandatory options for current Tcl command: required = {'name','outname'}
@ -38,7 +39,11 @@ class TclCommandMillSlots(TclCommandSignaled):
('milled_dias', 'Comma separated tool diameters of the slots to be milled (example: 0.6, 1.0 or 3.125).'),
('tooldia', 'Diameter of the milling tool (example: 0.1).'),
('outname', 'Name of object to create.'),
('use_thread', 'If to use multithreading: True or False.')
('use_thread', 'If to use multithreading: True or False.'),
('tol', 'Tolerance. Percentange (0.0 ... 100.0) within which dias in milled_dias will be judged to be the'
'same as the ones in the tools from the Excellon object. E.g: if in milled_dias we have a diameter'
'with value 1.0, in the Excellon we have a tool with dia = 1.05 and we set a tolerance tol = 5.0'
'then the slots with the dia 1.05 in Excellon will be processed. Float number.')
]),
'examples': ['millholes mydrills']
}
@ -72,7 +77,7 @@ class TclCommandMillSlots(TclCommandSignaled):
diameters = [x.strip() for x in args['milled_dias'].split(",")]
nr_diameters = len(diameters)
req_tools = []
req_tools = set()
for tool in obj.tools:
for req_dia in diameters:
obj_dia_form = float('%.2f' % float(obj.tools[tool]["C"])) if units == 'MM' else \
@ -80,9 +85,18 @@ class TclCommandMillSlots(TclCommandSignaled):
req_dia_form = float('%.2f' % float(req_dia)) if units == 'MM' else \
float('%.4f' % float(req_dia))
if obj_dia_form == req_dia_form:
req_tools.append(tool)
nr_diameters -= 1
if 'tol' in args:
tolerance = args['tol'] / 100
tolerance = 0.0 if tolerance < 0.0 else tolerance
tolerance = 1.0 if tolerance > 1.0 else tolerance
if math.isclose(obj_dia_form, req_dia_form, rel_tol=tolerance):
req_tools.add(tool)
nr_diameters -= 1
else:
if obj_dia_form == req_dia_form:
req_tools.add(tool)
nr_diameters -= 1
if nr_diameters > 0:
self.raise_tcl_error("One or more tool diameters of the slots to be milled passed to the "