- changed the name of TclCommand MillHoles to MillDrills and added a new TclCommand named MillSlots
This commit is contained in:
parent
4440298327
commit
1ef9e95143
|
@ -1844,7 +1844,8 @@ class App(QtCore.QObject):
|
|||
'delete', 'drillcncjob', 'export_gcode', 'export_svg', 'ext', 'exteriors', 'follow',
|
||||
'geo_union', 'geocutout', 'get_names', 'get_sys', 'getsys', 'help', 'import_svg',
|
||||
'interiors', 'isolate', 'join_excellon', 'join_excellons', 'join_geometries',
|
||||
'join_geometry', 'list_sys', 'listsys', 'mill', 'millholes', 'mirror', 'ncc',
|
||||
'join_geometry', 'list_sys', 'listsys', 'milld', 'mills', 'milldrills', 'millslots',
|
||||
'mirror', 'ncc',
|
||||
'ncc_clear', 'ncr', 'new', 'new_geometry', 'non_copper_regions', 'offset',
|
||||
'open_excellon', 'open_gcode', 'open_gerber', 'open_project', 'options', 'paint',
|
||||
'pan', 'panel', 'panelize', 'plot', 'save', 'save_project', 'save_sys', 'scale',
|
||||
|
|
|
@ -16,6 +16,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||
- made faster the Gerber parser for the case of having a not valid geometry when loading a Gerber file without buffering
|
||||
- updated code in self.on_view_source() to make it more responsive
|
||||
- fixed the TclCommand MillHoles
|
||||
- changed the name of TclCommand MillHoles to MillDrills and added a new TclCommand named MillSlots
|
||||
|
||||
10.09.2019
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ from ObjectCollection import *
|
|||
from tclCommands.TclCommand import TclCommandSignaled
|
||||
|
||||
|
||||
class TclCommandMillHoles(TclCommandSignaled):
|
||||
class TclCommandMillDrills(TclCommandSignaled):
|
||||
"""
|
||||
Tcl shell command to Create Geometry Object for milling holes from Excellon.
|
||||
|
||||
|
@ -11,7 +11,7 @@ class TclCommandMillHoles(TclCommandSignaled):
|
|||
"""
|
||||
|
||||
# List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
|
||||
aliases = ['millholes', 'mill']
|
||||
aliases = ['milldrills', 'milld']
|
||||
|
||||
# Dictionary of types from Tcl command, needs to be ordered
|
||||
arg_names = collections.OrderedDict([
|
||||
|
@ -32,7 +32,7 @@ class TclCommandMillHoles(TclCommandSignaled):
|
|||
|
||||
# structured help for current command, args needs to be ordered
|
||||
help = {
|
||||
'main': "Create Geometry Object for milling holes from Excellon.",
|
||||
'main': "Create Geometry Object for milling drill holes from Excellon.",
|
||||
'args': collections.OrderedDict([
|
||||
('name', 'Name of the Excellon Object.'),
|
||||
('tools', 'Comma separated indexes of tools (example: 1,3 or 2).'),
|
|
@ -0,0 +1,91 @@
|
|||
from ObjectCollection import *
|
||||
from tclCommands.TclCommand import TclCommandSignaled
|
||||
|
||||
|
||||
class TclCommandMillSlots(TclCommandSignaled):
|
||||
"""
|
||||
Tcl shell command to Create Geometry Object for milling holes from Excellon.
|
||||
|
||||
example:
|
||||
millholes my_drill -tools 1,2,3 -tooldia 0.1 -outname mill_holes_geo
|
||||
"""
|
||||
|
||||
# List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
|
||||
aliases = ['millslots', 'mills']
|
||||
|
||||
# Dictionary of types from Tcl command, needs to be ordered
|
||||
arg_names = collections.OrderedDict([
|
||||
('name', str)
|
||||
])
|
||||
|
||||
# Dictionary of types from Tcl command, needs to be ordered.
|
||||
# This is for options like -optionname value
|
||||
option_types = collections.OrderedDict([
|
||||
('tools', str),
|
||||
('outname', str),
|
||||
('tooldia', float),
|
||||
('use_threads', bool)
|
||||
])
|
||||
|
||||
# array of mandatory options for current Tcl command: required = {'name','outname'}
|
||||
required = ['name']
|
||||
|
||||
# structured help for current command, args needs to be ordered
|
||||
help = {
|
||||
'main': "Create Geometry Object for milling slot holes from Excellon.",
|
||||
'args': collections.OrderedDict([
|
||||
('name', 'Name of the Excellon Object.'),
|
||||
('tools', 'Comma separated indexes of tools (example: 1,3 or 2).'),
|
||||
('tooldia', 'Diameter of the milling tool (example: 0.1).'),
|
||||
('outname', 'Name of object to create.'),
|
||||
('use_thread', 'If to use multithreading: True or False.')
|
||||
]),
|
||||
'examples': ['millholes mydrills']
|
||||
}
|
||||
|
||||
def execute(self, args, unnamed_args):
|
||||
"""
|
||||
|
||||
:param args: array of known named arguments and options
|
||||
:param unnamed_args: array of other values which were passed into command
|
||||
without -somename and we do not have them in known arg_names
|
||||
:return: None or exception
|
||||
"""
|
||||
|
||||
name = args['name']
|
||||
|
||||
if 'outname' not in args:
|
||||
args['outname'] = name + "_mill"
|
||||
|
||||
try:
|
||||
if 'tools' in args and args['tools'] != 'all':
|
||||
# Split and put back. We are passing the whole dictionary later.
|
||||
args['tools'] = [x.strip() for x in args['tools'].split(",")]
|
||||
else:
|
||||
args['tools'] = 'all'
|
||||
except Exception as e:
|
||||
self.raise_tcl_error("Bad tools: %s" % str(e))
|
||||
|
||||
try:
|
||||
obj = self.app.collection.get_by_name(str(name))
|
||||
except:
|
||||
self.raise_tcl_error("Could not retrieve object: %s" % name)
|
||||
|
||||
if not isinstance(obj, FlatCAMExcellon):
|
||||
self.raise_tcl_error('Only Excellon objects can be mill-drilled, got %s %s.' % (name, type(obj)))
|
||||
|
||||
if self.app.collection.has_promises():
|
||||
self.raise_tcl_error('!!!Promises exists, but should not here!!!')
|
||||
|
||||
try:
|
||||
# 'name' is not an argument of obj.generate_milling()
|
||||
del args['name']
|
||||
|
||||
# This runs in the background... Is blocking handled?
|
||||
success, msg = obj.generate_milling_slots(**args)
|
||||
|
||||
except Exception as e:
|
||||
self.raise_tcl_error("Operation failed: %s" % str(e))
|
||||
|
||||
if not success:
|
||||
self.raise_tcl_error(msg)
|
|
@ -30,7 +30,8 @@ import tclCommands.TclCommandFollow
|
|||
import tclCommands.TclCommandJoinExcellon
|
||||
import tclCommands.TclCommandJoinGeometry
|
||||
import tclCommands.TclCommandListSys
|
||||
import tclCommands.TclCommandMillHoles
|
||||
import tclCommands.TclCommandMillDrills
|
||||
import tclCommands.TclCommandMillSlots
|
||||
import tclCommands.TclCommandMirror
|
||||
import tclCommands.TclCommandNew
|
||||
import tclCommands.TclCommandNregions
|
||||
|
|
Loading…
Reference in New Issue