- updated Tcl commands to make use of either 0 or False for False value or 1 or True for True in case of a parameter with type Bool
This commit is contained in:
@@ -16,6 +16,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
- fixed an small issue in Object UI
|
- fixed an small issue in Object UI
|
||||||
- small fixes: selected object in Project used to ask twice for UI build; if scale factor in Object UI is 1 do nothing as there is no point in scaling with a factor of 1
|
- small fixes: selected object in Project used to ask twice for UI build; if scale factor in Object UI is 1 do nothing as there is no point in scaling with a factor of 1
|
||||||
- in Geometry UI added a button that allow updating all the tools in the Tool Table with the current values in the UI form
|
- in Geometry UI added a button that allow updating all the tools in the Tool Table with the current values in the UI form
|
||||||
|
- updated Tcl commands to make use of either 0 or False for False value or 1 or True for True in case of a parameter with type Bool
|
||||||
|
|
||||||
7.12.2019
|
7.12.2019
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class TclCommandBbox(TclCommand):
|
|||||||
|
|
||||||
if 'rounded' not in args:
|
if 'rounded' not in args:
|
||||||
args['rounded'] = self.app.defaults["gerber_bboxrounded"]
|
args['rounded'] = self.app.defaults["gerber_bboxrounded"]
|
||||||
rounded = args['rounded']
|
rounded = bool(args['rounded'])
|
||||||
|
|
||||||
del args['name']
|
del args['name']
|
||||||
|
|
||||||
|
|||||||
@@ -126,18 +126,18 @@ class TclCommandCopperClear(TclCommand):
|
|||||||
method = str(self.app.defaults["tools_nccmethod"])
|
method = str(self.app.defaults["tools_nccmethod"])
|
||||||
|
|
||||||
if 'connect' in args:
|
if 'connect' in args:
|
||||||
connect = eval(str(args['connect']).capitalize())
|
connect = bool(args['connect'])
|
||||||
else:
|
else:
|
||||||
connect = eval(str(self.app.defaults["tools_nccconnect"]))
|
connect = eval(str(self.app.defaults["tools_nccconnect"]))
|
||||||
|
|
||||||
if 'contour' in args:
|
if 'contour' in args:
|
||||||
contour = eval(str(args['contour']).capitalize())
|
contour = bool(args['contour'])
|
||||||
else:
|
else:
|
||||||
contour = eval(str(self.app.defaults["tools_ncccontour"]))
|
contour = eval(str(self.app.defaults["tools_ncccontour"]))
|
||||||
|
|
||||||
offset = 0.0
|
offset = 0.0
|
||||||
if 'has_offset' in args:
|
if 'has_offset' in args:
|
||||||
has_offset = args['has_offset']
|
has_offset = bool(args['has_offset'])
|
||||||
if args['has_offset'] is True:
|
if args['has_offset'] is True:
|
||||||
if 'offset' in args:
|
if 'offset' in args:
|
||||||
offset = float(args['margin'])
|
offset = float(args['margin'])
|
||||||
@@ -203,7 +203,7 @@ class TclCommandCopperClear(TclCommand):
|
|||||||
})
|
})
|
||||||
|
|
||||||
if 'rest' in args:
|
if 'rest' in args:
|
||||||
rest = eval(str(args['rest']).capitalize())
|
rest = bool(args['rest'])
|
||||||
else:
|
else:
|
||||||
rest = eval(str(self.app.defaults["tools_nccrest"]))
|
rest = eval(str(self.app.defaults["tools_nccrest"]))
|
||||||
|
|
||||||
|
|||||||
@@ -67,12 +67,12 @@ class TclCommandCutout(TclCommand):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if 'margin' in args:
|
if 'margin' in args:
|
||||||
margin_par = args['margin']
|
margin_par = float(args['margin'])
|
||||||
else:
|
else:
|
||||||
margin_par = 0.001
|
margin_par = 0.001
|
||||||
|
|
||||||
if 'dia' in args:
|
if 'dia' in args:
|
||||||
dia_par = args['dia']
|
dia_par = float(args['dia'])
|
||||||
else:
|
else:
|
||||||
dia_par = 0.1
|
dia_par = 0.1
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ class TclCommandCutout(TclCommand):
|
|||||||
gaps_par = "4"
|
gaps_par = "4"
|
||||||
|
|
||||||
if 'gapsize' in args:
|
if 'gapsize' in args:
|
||||||
gapsize_par = args['gapsize']
|
gapsize_par = float(args['gapsize'])
|
||||||
else:
|
else:
|
||||||
gapsize_par = 0.1
|
gapsize_par = 0.1
|
||||||
|
|
||||||
|
|||||||
@@ -137,12 +137,12 @@ class TclCommandGeoCutout(TclCommandSignaled):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if 'margin' in args:
|
if 'margin' in args:
|
||||||
margin = args['margin']
|
margin = float(args['margin'])
|
||||||
else:
|
else:
|
||||||
margin = 0.001
|
margin = 0.001
|
||||||
|
|
||||||
if 'dia' in args:
|
if 'dia' in args:
|
||||||
dia = args['dia']
|
dia = float(args['dia'])
|
||||||
else:
|
else:
|
||||||
dia = 0.1
|
dia = 0.1
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ class TclCommandGeoCutout(TclCommandSignaled):
|
|||||||
gaps = 4
|
gaps = 4
|
||||||
|
|
||||||
if 'gapsize' in args:
|
if 'gapsize' in args:
|
||||||
gapsize = args['gapsize']
|
gapsize = float(args['gapsize'])
|
||||||
else:
|
else:
|
||||||
gapsize = 0.1
|
gapsize = 0.1
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ class TclCommandMillDrills(TclCommandSignaled):
|
|||||||
if 'outname' not in args:
|
if 'outname' not in args:
|
||||||
args['outname'] = name + "_mill_drills"
|
args['outname'] = name + "_mill_drills"
|
||||||
|
|
||||||
|
if 'use_thread' in args:
|
||||||
|
args['use_thread'] = bool(args['use_thread'])
|
||||||
|
|
||||||
if not obj.drills:
|
if not obj.drills:
|
||||||
self.raise_tcl_error("The Excellon object has no drills: %s" % name)
|
self.raise_tcl_error("The Excellon object has no drills: %s" % name)
|
||||||
|
|
||||||
@@ -96,7 +99,7 @@ class TclCommandMillDrills(TclCommandSignaled):
|
|||||||
req_dia_form = float('%.*f' % (obj.decimals, float(req_dia)))
|
req_dia_form = float('%.*f' % (obj.decimals, float(req_dia)))
|
||||||
|
|
||||||
if 'diatol' in args:
|
if 'diatol' in args:
|
||||||
tolerance = args['diatol'] / 100
|
tolerance = float(args['diatol']) / 100
|
||||||
|
|
||||||
tolerance = 0.0 if tolerance < 0.0 else tolerance
|
tolerance = 0.0 if tolerance < 0.0 else tolerance
|
||||||
tolerance = 1.0 if tolerance > 1.0 else tolerance
|
tolerance = 1.0 if tolerance > 1.0 else tolerance
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ class TclCommandMillSlots(TclCommandSignaled):
|
|||||||
if 'outname' not in args:
|
if 'outname' not in args:
|
||||||
args['outname'] = name + "_mill_slots"
|
args['outname'] = name + "_mill_slots"
|
||||||
|
|
||||||
|
if 'use_thread' in args:
|
||||||
|
args['use_thread'] = bool(args['use_thread'])
|
||||||
|
|
||||||
if not obj.slots:
|
if not obj.slots:
|
||||||
self.raise_tcl_error("The Excellon object has no slots: %s" % name)
|
self.raise_tcl_error("The Excellon object has no slots: %s" % name)
|
||||||
|
|
||||||
|
|||||||
@@ -74,11 +74,11 @@ class TclCommandNregions(TclCommand):
|
|||||||
|
|
||||||
if 'margin' not in args:
|
if 'margin' not in args:
|
||||||
args['margin'] = float(self.app.defaults["gerber_noncoppermargin"])
|
args['margin'] = float(self.app.defaults["gerber_noncoppermargin"])
|
||||||
margin = args['margin']
|
margin = float(args['margin'])
|
||||||
|
|
||||||
if 'rounded' not in args:
|
if 'rounded' not in args:
|
||||||
args['rounded'] = self.app.defaults["gerber_noncopperrounded"]
|
args['rounded'] = self.app.defaults["gerber_noncopperrounded"]
|
||||||
rounded = args['rounded']
|
rounded = bool(args['rounded'])
|
||||||
|
|
||||||
del args['name']
|
del args['name']
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,6 @@ class TclCommandOffset(TclCommand):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
name = args['name']
|
name = args['name']
|
||||||
x, y = args['x'], args['y']
|
x, y = float(args['x']), float(args['y'])
|
||||||
|
|
||||||
self.app.collection.get_by_name(name).offset((x, y))
|
self.app.collection.get_by_name(name).offset((x, y))
|
||||||
|
|||||||
@@ -123,12 +123,12 @@ class TclCommandPaint(TclCommand):
|
|||||||
method = str(self.app.defaults["tools_paintmethod"])
|
method = str(self.app.defaults["tools_paintmethod"])
|
||||||
|
|
||||||
if 'connect' in args:
|
if 'connect' in args:
|
||||||
connect = eval(str(args['connect']).capitalize())
|
connect = bool(args['connect'])
|
||||||
else:
|
else:
|
||||||
connect = eval(str(self.app.defaults["tools_pathconnect"]))
|
connect = eval(str(self.app.defaults["tools_pathconnect"]))
|
||||||
|
|
||||||
if 'contour' in args:
|
if 'contour' in args:
|
||||||
contour = eval(str(args['contour']).capitalize())
|
contour = bool(args['contour'])
|
||||||
else:
|
else:
|
||||||
contour = eval(str(self.app.defaults["tools_paintcontour"]))
|
contour = eval(str(self.app.defaults["tools_paintcontour"]))
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ class TclCommandPaint(TclCommand):
|
|||||||
return "Object not found: %s" % name
|
return "Object not found: %s" % name
|
||||||
|
|
||||||
# Paint all polygons in the painted object
|
# Paint all polygons in the painted object
|
||||||
if 'all' in args and args['all'] is True:
|
if 'all' in args and bool(args['all']) is True:
|
||||||
self.app.paint_tool.paint_poly_all(obj=obj,
|
self.app.paint_tool.paint_poly_all(obj=obj,
|
||||||
tooldia=tooldia,
|
tooldia=tooldia,
|
||||||
overlap=overlap,
|
overlap=overlap,
|
||||||
@@ -211,7 +211,7 @@ class TclCommandPaint(TclCommand):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Paint single polygon in the painted object
|
# Paint single polygon in the painted object
|
||||||
elif 'single' in args and args['single'] is True:
|
elif 'single' in args and bool(args['single']) is True:
|
||||||
if 'x' not in args or 'y' not in args:
|
if 'x' not in args or 'y' not in args:
|
||||||
self.raise_tcl_error('%s' % _("Expected -x <value> and -y <value>."))
|
self.raise_tcl_error('%s' % _("Expected -x <value> and -y <value>."))
|
||||||
else:
|
else:
|
||||||
@@ -234,7 +234,7 @@ class TclCommandPaint(TclCommand):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Paint all polygons found within the box object from the the painted object
|
# Paint all polygons found within the box object from the the painted object
|
||||||
elif 'ref' in args and args['ref'] is True:
|
elif 'ref' in args and bool(args['ref']) is True:
|
||||||
if 'box' not in args:
|
if 'box' not in args:
|
||||||
self.raise_tcl_error('%s' % _("Expected -box <value>."))
|
self.raise_tcl_error('%s' % _("Expected -box <value>."))
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class TclCommandPanelize(TclCommand):
|
|||||||
('spacing_rows', float),
|
('spacing_rows', float),
|
||||||
('box', str),
|
('box', str),
|
||||||
('outname', str),
|
('outname', str),
|
||||||
('threaded', int)
|
('run_threaded', bool)
|
||||||
])
|
])
|
||||||
|
|
||||||
# array of mandatory options for current Tcl command: required = {'name','outname'}
|
# array of mandatory options for current Tcl command: required = {'name','outname'}
|
||||||
@@ -52,7 +52,7 @@ class TclCommandPanelize(TclCommand):
|
|||||||
('columns', 'Number of columns.'),
|
('columns', 'Number of columns.'),
|
||||||
('rows', 'Number of rows;'),
|
('rows', 'Number of rows;'),
|
||||||
('outname', 'Name of the new geometry object.'),
|
('outname', 'Name of the new geometry object.'),
|
||||||
('threaded', '0 = non-threaded || 1 = threaded')
|
('run_threaded', 'False = non-threaded || True = threaded')
|
||||||
]),
|
]),
|
||||||
'examples': []
|
'examples': []
|
||||||
}
|
}
|
||||||
@@ -93,23 +93,23 @@ class TclCommandPanelize(TclCommand):
|
|||||||
else:
|
else:
|
||||||
outname = name + '_panelized'
|
outname = name + '_panelized'
|
||||||
|
|
||||||
if 'threaded' in args:
|
if 'run_threaded' in args:
|
||||||
threaded = args['threaded']
|
threaded = bool(args['run_threaded'])
|
||||||
else:
|
else:
|
||||||
threaded = 0
|
threaded = False
|
||||||
|
|
||||||
if 'spacing_columns' in args:
|
if 'spacing_columns' in args:
|
||||||
spacing_columns = args['spacing_columns']
|
spacing_columns = int(args['spacing_columns'])
|
||||||
else:
|
else:
|
||||||
spacing_columns = 5
|
spacing_columns = 5
|
||||||
|
|
||||||
if 'spacing_rows' in args:
|
if 'spacing_rows' in args:
|
||||||
spacing_rows = args['spacing_rows']
|
spacing_rows = int(args['spacing_rows'])
|
||||||
else:
|
else:
|
||||||
spacing_rows = 5
|
spacing_rows = 5
|
||||||
|
|
||||||
rows = args['rows']
|
rows = int(args['rows'])
|
||||||
columns = args['columns']
|
columns = int(args['columns'])
|
||||||
|
|
||||||
xmin, ymin, xmax, ymax = box.bounds()
|
xmin, ymin, xmax, ymax = box.bounds()
|
||||||
lenghtx = xmax - xmin + spacing_columns
|
lenghtx = xmax - xmin + spacing_columns
|
||||||
@@ -277,7 +277,7 @@ class TclCommandPanelize(TclCommand):
|
|||||||
self.app.progress.emit(50)
|
self.app.progress.emit(50)
|
||||||
self.app.new_object("geometry", outname, job_init_geometry, plot=False, autoselected=True)
|
self.app.new_object("geometry", outname, job_init_geometry, plot=False, autoselected=True)
|
||||||
|
|
||||||
if threaded == 1:
|
if threaded is True:
|
||||||
proc = self.app.proc_container.new("Generating panel ... Please wait.")
|
proc = self.app.proc_container.new("Generating panel ... Please wait.")
|
||||||
|
|
||||||
def job_thread(app_obj):
|
def job_thread(app_obj):
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ class TclCommandSetOrigin(TclCommand):
|
|||||||
'main': "Will set the origin at the specified x,y location.",
|
'main': "Will set the origin at the specified x,y location.",
|
||||||
'args': collections.OrderedDict([
|
'args': collections.OrderedDict([
|
||||||
('loc', 'Location to offset all the selected objects. No spaces between x and y pair. Use like this: 2,3'),
|
('loc', 'Location to offset all the selected objects. No spaces between x and y pair. Use like this: 2,3'),
|
||||||
('auto', 'If set to 1 it will set the origin to the minimum x, y of the object selection bounding box.'
|
('auto', 'If set to True it will set the origin to the minimum x, y of the object selection bounding box.'
|
||||||
'-auto=1 is not correct but -auto 1 or -auto True is correct.')
|
'-auto=True is not correct but -auto 1 or -auto True is correct.')
|
||||||
]),
|
]),
|
||||||
'examples': ['set_origin 3,2', 'set_origin -auto 1']
|
'examples': ['set_origin 3,2', 'set_origin -auto 1']
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ class TclCommandSetOrigin(TclCommand):
|
|||||||
|
|
||||||
loc = list()
|
loc = list()
|
||||||
if 'auto' in args:
|
if 'auto' in args:
|
||||||
if args['auto'] == 1:
|
if bool(args['auto']) is True:
|
||||||
objs = self.app.collection.get_list()
|
objs = self.app.collection.get_list()
|
||||||
minx, miny, __, ___ = get_bounds(objs)
|
minx, miny, __, ___ = get_bounds(objs)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user