- started to work on support for G91 in Gcode (relative coordinates)

This commit is contained in:
Marius Stanciu 2019-09-04 09:38:29 +03:00 committed by Marius
parent d909b98130
commit 28e31eb312
2 changed files with 24 additions and 27 deletions

View File

@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
================================================= =================================================
4.09.2019
- started to work on support for G91 in Gcode (relative coordinates)
3.09.2019 3.09.2019
- in NCC tool there is now a depth of cut parameter named 'Cut Z' which will dictate how deep the tool will enter into the PCB material - in NCC tool there is now a depth of cut parameter named 'Cut Z' which will dictate how deep the tool will enter into the PCB material

View File

@ -4054,12 +4054,9 @@ class Excellon(Geometry):
else: else:
diam = (self.toolless_diam + (int(current_tool) - 1) / 100) / 25.4 diam = (self.toolless_diam + (int(current_tool) - 1) / 100) / 25.4
spec = { spec = {"C": diam, 'solid_geometry': []}
"C": diam,
}
spec['solid_geometry'] = []
self.tools[name] = spec self.tools[name] = spec
log.debug(" Tool definition out of header: %s %s" % (name, spec)) log.debug("Tool definition out of header: %s %s" % (name, spec))
continue continue
@ -4070,7 +4067,7 @@ class Excellon(Geometry):
if match or match1: if match or match1:
name_tool += 1 name_tool += 1
current_tool = str(name_tool) current_tool = str(name_tool)
log.debug(" Tool change for Allegro type of Excellon: %s" % current_tool) log.debug("Tool change for Allegro type of Excellon: %s" % current_tool)
continue continue
# ## Slots parsing for drilled slots (contain G85) # ## Slots parsing for drilled slots (contain G85)
@ -4394,15 +4391,7 @@ class Excellon(Geometry):
if match: if match:
name = str(int(match.group(1))) name = str(int(match.group(1)))
spec = { spec = {"C": float(match.group(2)), 'solid_geometry': []}
"C": float(match.group(2)),
# "F": float(match.group(3)),
# "S": float(match.group(4)),
# "B": float(match.group(5)),
# "H": float(match.group(6)),
# "Z": float(match.group(7))
}
spec['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
@ -4505,7 +4494,8 @@ class Excellon(Geometry):
except Exception as e: except Exception as e:
log.error("Excellon PARSING FAILED. Line %d: %s" % (line_num, eline)) log.error("Excellon PARSING FAILED. Line %d: %s" % (line_num, eline))
msg = _("[ERROR_NOTCL] An internal error has ocurred. See shell.\n") msg = _("[ERROR_NOTCL] An internal error has ocurred. See shell.\n")
msg += _('[ERROR] Excellon Parser error.\nParsing Failed. Line {l_nr}: {line}\n').format(l_nr=line_num, line=eline) msg += _('[ERROR] Excellon Parser error.\nParsing Failed. Line {l_nr}: {line}\n').format(l_nr=line_num,
line=eline)
msg += traceback.format_exc() msg += traceback.format_exc()
self.app.inform.emit(msg) self.app.inform.emit(msg)
@ -5050,6 +5040,7 @@ class CNCjob(Geometry):
self.feedminutecode = "G94" self.feedminutecode = "G94"
self.absolutecode = "G90" self.absolutecode = "G90"
self.relativecode = "G91"
self.gcode = "" self.gcode = ""
self.gcode_parsed = None self.gcode_parsed = None
@ -5227,14 +5218,14 @@ class CNCjob(Geometry):
if drillz > 0: if drillz > 0:
self.app.inform.emit(_("[WARNING] The Cut Z parameter has positive value. " self.app.inform.emit(_("[WARNING] The Cut Z parameter has positive value. "
"It is the depth value to drill into material.\n" "It is the depth value to drill into material.\n"
"The Cut Z parameter needs to have a negative value, assuming it is a typo " "The Cut Z parameter needs to have a negative value, assuming it is a typo "
"therefore the app will convert the value to negative. " "therefore the app will convert the value to negative. "
"Check the resulting CNC code (Gcode etc).")) "Check the resulting CNC code (Gcode etc)."))
self.z_cut = -drillz self.z_cut = -drillz
elif drillz == 0: elif drillz == 0:
self.app.inform.emit(_("[WARNING] The Cut Z parameter is zero. " self.app.inform.emit(_("[WARNING] The Cut Z parameter is zero. "
"There will be no cut, skipping %s file") % exobj.options['name']) "There will be no cut, skipping %s file") % exobj.options['name'])
return 'fail' return 'fail'
else: else:
self.z_cut = drillz self.z_cut = drillz
@ -5248,7 +5239,7 @@ class CNCjob(Geometry):
self.xy_toolchange = [float(eval(a)) for a in toolchangexy.split(",")] self.xy_toolchange = [float(eval(a)) for a in toolchangexy.split(",")]
if len(self.xy_toolchange) < 2: if len(self.xy_toolchange) < 2:
self.app.inform.emit(_("[ERROR]The Toolchange X,Y field in Edit -> Preferences has to be " self.app.inform.emit(_("[ERROR]The Toolchange X,Y field in Edit -> Preferences has to be "
"in the format (x, y) \nbut now there is only one value, not two. ")) "in the format (x, y) \nbut now there is only one value, not two. "))
return 'fail' return 'fail'
except Exception as e: except Exception as e:
log.debug("camlib.CNCJob.generate_from_excellon_by_tool() --> %s" % str(e)) log.debug("camlib.CNCJob.generate_from_excellon_by_tool() --> %s" % str(e))
@ -5371,8 +5362,10 @@ class CNCjob(Geometry):
self.postdata['toolC'] = exobj.tools[tool]["C"] self.postdata['toolC'] = exobj.tools[tool]["C"]
self.tooldia = exobj.tools[tool]["C"] self.tooldia = exobj.tools[tool]["C"]
############################################## ## # ###############################################
# Create the data. # ############ Create the data. #################
# ###############################################
node_list = [] node_list = []
locations = create_data_array() locations = create_data_array()
tsp_size = len(locations) tsp_size = len(locations)
@ -5421,7 +5414,7 @@ class CNCjob(Geometry):
log.warning('No solution found.') log.warning('No solution found.')
else: else:
log.warning('Specify an instance greater than 0.') log.warning('Specify an instance greater than 0.')
############################################## ## # ############################################# ##
# Only if tool has points. # Only if tool has points.
if tool in points: if tool in points:
@ -5485,7 +5478,7 @@ class CNCjob(Geometry):
self.postdata['toolC']=exobj.tools[tool]["C"] self.postdata['toolC']=exobj.tools[tool]["C"]
self.tooldia = exobj.tools[tool]["C"] self.tooldia = exobj.tools[tool]["C"]
############################################## ## # ############################################# ##
node_list = [] node_list = []
locations = create_data_array() locations = create_data_array()
tsp_size = len(locations) tsp_size = len(locations)
@ -5527,7 +5520,7 @@ class CNCjob(Geometry):
log.warning('No solution found.') log.warning('No solution found.')
else: else:
log.warning('Specify an instance greater than 0.') log.warning('Specify an instance greater than 0.')
############################################## ## # ############################################# ##
# Only if tool has points. # Only if tool has points.
if tool in points: if tool in points: