From 0d09f10a88693b7624bd511d337b7b4ada4fd08f Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Fri, 6 Dec 2019 21:39:06 +0200 Subject: [PATCH] - in Properties Tool added new information's for the tools in the CNCjob objects --- README.md | 1 + flatcamParsers/ParseExcellon.py | 49 ++++++++------------------------- flatcamTools/ToolProperties.py | 38 +++++++++++++++++-------- 3 files changed, 39 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index d4fa69d1..e6998a8b 100644 --- a/README.md +++ b/README.md @@ -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 - 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 Properties Tool added new information's for the tools in the CNCjob objects 5.12.2019 diff --git a/flatcamParsers/ParseExcellon.py b/flatcamParsers/ParseExcellon.py index e93ae9bc..54b60b85 100644 --- a/flatcamParsers/ParseExcellon.py +++ b/flatcamParsers/ParseExcellon.py @@ -777,7 +777,7 @@ class Excellon(Geometry): name = str(int(match.group(1))) spec = {"C": float(match.group(2)), 'solid_geometry': []} self.tools[name] = spec - log.debug(" Tool definition: %s %s" % (name, spec)) + log.debug("Tool definition: %s %s" % (name, spec)) continue # ## Units and number format # ## @@ -965,7 +965,7 @@ class Excellon(Geometry): _("Excellon.create_geometry() -> a drill location was skipped " "due of not having a tool associated.\n" "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") continue tooldia = self.tools[drill['tool']]['C'] @@ -984,37 +984,10 @@ class Excellon(Geometry): self.tools[slot['tool']]['solid_geometry'].append(poly) 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" - # 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): """ Returns coordinates of rectangular bounds @@ -1023,9 +996,9 @@ class Excellon(Geometry): # fixed issue of getting bounds only for one level 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: - log.debug("solid_geometry is None") + log.debug("flatcamParsers.ParseExcellon.Excellon -> solid_geometry is None") return 0, 0, 0, 0 def bounds_rec(obj): @@ -1120,7 +1093,7 @@ class Excellon(Geometry): :return: None :rtype: NOne """ - log.debug("flatcamParsers.ParseExcellon.Excellon..scale()") + log.debug("flatcamParsers.ParseExcellon.Excellon.scale()") if yfactor is None: yfactor = xfactor @@ -1183,7 +1156,7 @@ class Excellon(Geometry): :type vect: tuple :return: None """ - log.debug("camlib.Excellon.offset()") + log.debug("flatcamParsers.ParseExcellon.Excellon.offset()") dx, dy = vect @@ -1241,7 +1214,7 @@ class Excellon(Geometry): :type point: list :return: None """ - log.debug("camlib.Excellon.mirror()") + log.debug("flatcamParsers.ParseExcellon.Excellon.mirror()") px, py = point 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: http://toblerity.org/shapely/manual.html#affine-transformations """ - log.debug("camlib.Excellon.skew()") + log.debug("flatcamParsers.ParseExcellon.Excellon.skew()") if angle_x is None: angle_x = 0.0 @@ -1392,7 +1365,7 @@ class Excellon(Geometry): :param point: tuple of coordinates (x, y) :return: """ - log.debug("camlib.Excellon.rotate()") + log.debug("flatcamParsers.ParseExcellon.Excellon.rotate()") def rotate_geom(obj, origin=None): if type(obj) is list: diff --git a/flatcamTools/ToolProperties.py b/flatcamTools/ToolProperties.py index 1772d485..56177c2d 100644 --- a/flatcamTools/ToolProperties.py +++ b/flatcamTools/ToolProperties.py @@ -414,31 +414,30 @@ class Properties(FlatCAMTool): for k, v in value.items(): if k == 'solid_geometry': 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': 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': 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': - tool_data = self.addParent(geo_tool, str(k).capitalize(), - color=QtGui.QColor("#000000"), font=font) + tool_data = self.addParent(geo_tool, _("Data"), color=QtGui.QColor("#000000"), font=font) 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: self.addChild(geo_tool, [str(k), str(v)], True) # 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( 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(): if k == 'solid_geometry': 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': self.addChild(exc_tool, [_("Drills number"), str(v)], True) elif k == 'nr_slots': @@ -446,6 +445,10 @@ class Properties(FlatCAMTool): else: 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 if r_time > 1: units_lbl = 'min' @@ -453,8 +456,21 @@ class Properties(FlatCAMTool): r_time *= 60 units_lbl = 'sec' r_time = math.ceil(float(r_time)) - self.addChild(others, ['%s (%s):' % (_('Routing time'), units_lbl), str(r_time)], True) - self.addChild(others, ['%s (%s):' % (_('Travelled distance'), f_unit), str(obj.travel_distance)], True) + self.addChild( + 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, [''])