- in Properties Tool added new information's for the tools in the CNCjob objects
This commit is contained in:
@@ -14,6 +14,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
- fixed the toggle_units() method so now the grid values are accurate to the decimal
|
- fixed the toggle_units() method so now the grid values are accurate to the decimal
|
||||||
- cleaned up the Excellon parser and fixed some bugs (old and new); Excellon parser has it's own convert_units() method no longer inheriting from Geometry
|
- cleaned up the Excellon parser and fixed some bugs (old and new); Excellon parser has it's own convert_units() method no longer inheriting from Geometry
|
||||||
- in Excellon UI fixed bug that did not allow editing of the Offset Z parameter from the Tool table
|
- in Excellon UI fixed bug that did not allow editing of the Offset Z parameter from the Tool table
|
||||||
|
- in Properties Tool added new information's for the tools in the CNCjob objects
|
||||||
|
|
||||||
5.12.2019
|
5.12.2019
|
||||||
|
|
||||||
|
|||||||
@@ -777,7 +777,7 @@ class Excellon(Geometry):
|
|||||||
name = str(int(match.group(1)))
|
name = str(int(match.group(1)))
|
||||||
spec = {"C": float(match.group(2)), 'solid_geometry': []}
|
spec = {"C": float(match.group(2)), 'solid_geometry': []}
|
||||||
self.tools[name] = spec
|
self.tools[name] = spec
|
||||||
log.debug(" Tool definition: %s %s" % (name, spec))
|
log.debug("Tool definition: %s %s" % (name, spec))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# ## Units and number format # ##
|
# ## Units and number format # ##
|
||||||
@@ -965,7 +965,7 @@ class Excellon(Geometry):
|
|||||||
_("Excellon.create_geometry() -> a drill location was skipped "
|
_("Excellon.create_geometry() -> a drill location was skipped "
|
||||||
"due of not having a tool associated.\n"
|
"due of not having a tool associated.\n"
|
||||||
"Check the resulting GCode."))
|
"Check the resulting GCode."))
|
||||||
log.debug("Excellon.create_geometry() -> a drill location was skipped "
|
log.debug("flatcamParsers.ParseExcellon.Excellon.create_geometry() -> a drill location was skipped "
|
||||||
"due of not having a tool associated")
|
"due of not having a tool associated")
|
||||||
continue
|
continue
|
||||||
tooldia = self.tools[drill['tool']]['C']
|
tooldia = self.tools[drill['tool']]['C']
|
||||||
@@ -984,37 +984,10 @@ class Excellon(Geometry):
|
|||||||
self.tools[slot['tool']]['solid_geometry'].append(poly)
|
self.tools[slot['tool']]['solid_geometry'].append(poly)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("Excellon geometry creation failed due of ERROR: %s" % str(e))
|
log.debug("flatcamParsers.ParseExcellon.Excellon.create_geometry() -> "
|
||||||
|
"Excellon geometry creation failed due of ERROR: %s" % str(e))
|
||||||
return "fail"
|
return "fail"
|
||||||
|
|
||||||
# drill_geometry = {}
|
|
||||||
# slot_geometry = {}
|
|
||||||
#
|
|
||||||
# def insertIntoDataStruct(dia, drill_geo, aDict):
|
|
||||||
# if not dia in aDict:
|
|
||||||
# aDict[dia] = [drill_geo]
|
|
||||||
# else:
|
|
||||||
# aDict[dia].append(drill_geo)
|
|
||||||
#
|
|
||||||
# for tool in self.tools:
|
|
||||||
# tooldia = self.tools[tool]['C']
|
|
||||||
# for drill in self.drills:
|
|
||||||
# if drill['tool'] == tool:
|
|
||||||
# poly = drill['point'].buffer(tooldia / 2.0)
|
|
||||||
# insertIntoDataStruct(tooldia, poly, drill_geometry)
|
|
||||||
#
|
|
||||||
# for tool in self.tools:
|
|
||||||
# slot_tooldia = self.tools[tool]['C']
|
|
||||||
# for slot in self.slots:
|
|
||||||
# if slot['tool'] == tool:
|
|
||||||
# start = slot['start']
|
|
||||||
# stop = slot['stop']
|
|
||||||
# lines_string = LineString([start, stop])
|
|
||||||
# poly = lines_string.buffer(slot_tooldia/2.0, self.geo_steps_per_circle)
|
|
||||||
# insertIntoDataStruct(slot_tooldia, poly, drill_geometry)
|
|
||||||
#
|
|
||||||
# self.solid_geometry = [drill_geometry, slot_geometry]
|
|
||||||
|
|
||||||
def bounds(self):
|
def bounds(self):
|
||||||
"""
|
"""
|
||||||
Returns coordinates of rectangular bounds
|
Returns coordinates of rectangular bounds
|
||||||
@@ -1023,9 +996,9 @@ class Excellon(Geometry):
|
|||||||
# fixed issue of getting bounds only for one level lists of objects
|
# fixed issue of getting bounds only for one level lists of objects
|
||||||
# now it can get bounds for nested lists of objects
|
# now it can get bounds for nested lists of objects
|
||||||
|
|
||||||
log.debug("camlib.Excellon.bounds()")
|
log.debug("flatcamParsers.ParseExcellon.Excellon.bounds()")
|
||||||
if self.solid_geometry is None:
|
if self.solid_geometry is None:
|
||||||
log.debug("solid_geometry is None")
|
log.debug("flatcamParsers.ParseExcellon.Excellon -> solid_geometry is None")
|
||||||
return 0, 0, 0, 0
|
return 0, 0, 0, 0
|
||||||
|
|
||||||
def bounds_rec(obj):
|
def bounds_rec(obj):
|
||||||
@@ -1120,7 +1093,7 @@ class Excellon(Geometry):
|
|||||||
:return: None
|
:return: None
|
||||||
:rtype: NOne
|
:rtype: NOne
|
||||||
"""
|
"""
|
||||||
log.debug("flatcamParsers.ParseExcellon.Excellon..scale()")
|
log.debug("flatcamParsers.ParseExcellon.Excellon.scale()")
|
||||||
|
|
||||||
if yfactor is None:
|
if yfactor is None:
|
||||||
yfactor = xfactor
|
yfactor = xfactor
|
||||||
@@ -1183,7 +1156,7 @@ class Excellon(Geometry):
|
|||||||
:type vect: tuple
|
:type vect: tuple
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
log.debug("camlib.Excellon.offset()")
|
log.debug("flatcamParsers.ParseExcellon.Excellon.offset()")
|
||||||
|
|
||||||
dx, dy = vect
|
dx, dy = vect
|
||||||
|
|
||||||
@@ -1241,7 +1214,7 @@ class Excellon(Geometry):
|
|||||||
:type point: list
|
:type point: list
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
log.debug("camlib.Excellon.mirror()")
|
log.debug("flatcamParsers.ParseExcellon.Excellon.mirror()")
|
||||||
|
|
||||||
px, py = point
|
px, py = point
|
||||||
xscale, yscale = {"X": (1.0, -1.0), "Y": (-1.0, 1.0)}[axis]
|
xscale, yscale = {"X": (1.0, -1.0), "Y": (-1.0, 1.0)}[axis]
|
||||||
@@ -1308,7 +1281,7 @@ class Excellon(Geometry):
|
|||||||
See shapely manual for more information:
|
See shapely manual for more information:
|
||||||
http://toblerity.org/shapely/manual.html#affine-transformations
|
http://toblerity.org/shapely/manual.html#affine-transformations
|
||||||
"""
|
"""
|
||||||
log.debug("camlib.Excellon.skew()")
|
log.debug("flatcamParsers.ParseExcellon.Excellon.skew()")
|
||||||
|
|
||||||
if angle_x is None:
|
if angle_x is None:
|
||||||
angle_x = 0.0
|
angle_x = 0.0
|
||||||
@@ -1392,7 +1365,7 @@ class Excellon(Geometry):
|
|||||||
:param point: tuple of coordinates (x, y)
|
:param point: tuple of coordinates (x, y)
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
log.debug("camlib.Excellon.rotate()")
|
log.debug("flatcamParsers.ParseExcellon.Excellon.rotate()")
|
||||||
|
|
||||||
def rotate_geom(obj, origin=None):
|
def rotate_geom(obj, origin=None):
|
||||||
if type(obj) is list:
|
if type(obj) is list:
|
||||||
|
|||||||
@@ -414,31 +414,30 @@ class Properties(FlatCAMTool):
|
|||||||
for k, v in value.items():
|
for k, v in value.items():
|
||||||
if k == 'solid_geometry':
|
if k == 'solid_geometry':
|
||||||
printed_value = _('Present') if v else _('None')
|
printed_value = _('Present') if v else _('None')
|
||||||
self.addChild(geo_tool, [str(k), printed_value], True)
|
self.addChild(geo_tool, [_("Solid Geometry"), printed_value], True)
|
||||||
elif k == 'gcode':
|
elif k == 'gcode':
|
||||||
printed_value = _('Present') if v != '' else _('None')
|
printed_value = _('Present') if v != '' else _('None')
|
||||||
self.addChild(geo_tool, [str(k), printed_value], True)
|
self.addChild(geo_tool, [_("GCode Text"), printed_value], True)
|
||||||
elif k == 'gcode_parsed':
|
elif k == 'gcode_parsed':
|
||||||
printed_value = _('Present') if v else _('None')
|
printed_value = _('Present') if v else _('None')
|
||||||
self.addChild(geo_tool, [str(k), printed_value], True)
|
self.addChild(geo_tool, [_("GCode Geometry"), printed_value], True)
|
||||||
elif k == 'data':
|
elif k == 'data':
|
||||||
tool_data = self.addParent(geo_tool, str(k).capitalize(),
|
tool_data = self.addParent(geo_tool, _("Data"), color=QtGui.QColor("#000000"), font=font)
|
||||||
color=QtGui.QColor("#000000"), font=font)
|
|
||||||
for data_k, data_v in v.items():
|
for data_k, data_v in v.items():
|
||||||
self.addChild(tool_data, [str(data_k), str(data_v)], True)
|
self.addChild(tool_data, [str(data_k).capitalize(), str(data_v)], True)
|
||||||
else:
|
else:
|
||||||
self.addChild(geo_tool, [str(k), str(v)], True)
|
self.addChild(geo_tool, [str(k), str(v)], True)
|
||||||
|
|
||||||
# for cncjob objects made from excellon
|
# for cncjob objects made from excellon
|
||||||
for tool, value in obj.exc_cnc_tools.items():
|
for tool_dia, value in obj.exc_cnc_tools.items():
|
||||||
exc_tool = self.addParent(
|
exc_tool = self.addParent(
|
||||||
tools, str(value['tool']), expanded=False, color=QtGui.QColor("#000000"), font=font
|
tools, str(value['tool']), expanded=False, color=QtGui.QColor("#000000"), font=font
|
||||||
)
|
)
|
||||||
self.addChild(exc_tool, [_('Diameter'), str(tool)], True)
|
self.addChild(exc_tool, [_('Diameter'), str(tool_dia)], True)
|
||||||
for k, v in value.items():
|
for k, v in value.items():
|
||||||
if k == 'solid_geometry':
|
if k == 'solid_geometry':
|
||||||
printed_value = _('Present') if v else _('None')
|
printed_value = _('Present') if v else _('None')
|
||||||
self.addChild(exc_tool, [str(k), printed_value], True)
|
self.addChild(exc_tool, [_("Solid Geometry"), printed_value], True)
|
||||||
elif k == 'nr_drills':
|
elif k == 'nr_drills':
|
||||||
self.addChild(exc_tool, [_("Drills number"), str(v)], True)
|
self.addChild(exc_tool, [_("Drills number"), str(v)], True)
|
||||||
elif k == 'nr_slots':
|
elif k == 'nr_slots':
|
||||||
@@ -446,6 +445,10 @@ class Properties(FlatCAMTool):
|
|||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
self.addChild(exc_tool, [_("Depth of Cut"), str(obj.z_cut - obj.tool_offset[tool_dia])], True)
|
||||||
|
self.addChild(exc_tool, [_("Clearance Height"), str(obj.z_move)], True)
|
||||||
|
self.addChild(exc_tool, [_("Feedrate"), str(obj.feedrate)], True)
|
||||||
|
|
||||||
r_time = obj.routing_time
|
r_time = obj.routing_time
|
||||||
if r_time > 1:
|
if r_time > 1:
|
||||||
units_lbl = 'min'
|
units_lbl = 'min'
|
||||||
@@ -453,8 +456,21 @@ class Properties(FlatCAMTool):
|
|||||||
r_time *= 60
|
r_time *= 60
|
||||||
units_lbl = 'sec'
|
units_lbl = 'sec'
|
||||||
r_time = math.ceil(float(r_time))
|
r_time = math.ceil(float(r_time))
|
||||||
self.addChild(others, ['%s (%s):' % (_('Routing time'), units_lbl), str(r_time)], True)
|
self.addChild(
|
||||||
self.addChild(others, ['%s (%s):' % (_('Travelled distance'), f_unit), str(obj.travel_distance)], True)
|
others,
|
||||||
|
[
|
||||||
|
'%s (%s):' % (_('Routing time'), units_lbl),
|
||||||
|
'%.*f' % (self.decimals, r_time)],
|
||||||
|
True
|
||||||
|
)
|
||||||
|
self.addChild(
|
||||||
|
others,
|
||||||
|
[
|
||||||
|
'%s (%s):' % (_('Travelled distance'), f_unit),
|
||||||
|
'%.*f' % (self.decimals, obj.travel_distance)
|
||||||
|
],
|
||||||
|
True
|
||||||
|
)
|
||||||
|
|
||||||
self.addChild(separator, [''])
|
self.addChild(separator, [''])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user