Commit 6b485381 authored by sumpfralle's avatar sumpfralle

reordered tabs of GTK interface

tool id written by the gcode exporter is configurable (not used for now)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@172 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 801a9cfc
...@@ -5,13 +5,13 @@ from gcode import gcode ...@@ -5,13 +5,13 @@ from gcode import gcode
class SimpleGCodeExporter: class SimpleGCodeExporter:
def __init__(self, filename, unit, startx, starty, startz, feedrate, speed, safety_height=None): def __init__(self, filename, unit, startx, starty, startz, feedrate, speed, safety_height=None, tool_id=1):
self.file = file(filename,"w") self.file = file(filename,"w")
if unit == "mm": if unit == "mm":
self.file.write("G21\n") self.file.write("G21\n")
else: else:
self.file.write("G20\n") self.file.write("G20\n")
self.gcode = gcode(startx, starty, startz, safetyheight=safety_height) self.gcode = gcode(startx, starty, startz, safetyheight=safety_height, tool_id=tool_id)
gc = self.gcode gc = self.gcode
self.file.write(gc.begin() + "\n") self.file.write(gc.begin() + "\n")
self.file.write("F" + str(feedrate) + "\n") self.file.write("F" + str(feedrate) + "\n")
......
...@@ -16,10 +16,11 @@ class gcode: ...@@ -16,10 +16,11 @@ class gcode:
lastx = lasty = lastz = lasta = lastgcode = None lastx = lasty = lastz = lasta = lastgcode = None
lastfeed = None lastfeed = None
def __init__(self, startx, starty, startz, homeheight=1.5, safetyheight=None): def __init__(self, startx, starty, startz, homeheight=1.5, safetyheight=None, tool_id=1):
self.startx = startx self.startx = startx
self.starty = starty self.starty = starty
self.startz = startz self.startz = startz
self.tool_id = tool_id
if safetyheight is None: if safetyheight is None:
safetyheight = max(max(startz, homeheight), 0.04) safetyheight = max(max(startz, homeheight), 0.04)
self.homeheight = max(startz, homeheight) self.homeheight = max(startz, homeheight)
...@@ -28,7 +29,7 @@ class gcode: ...@@ -28,7 +29,7 @@ class gcode:
def begin(self): def begin(self):
return "G40 G49 G54 G80 G90\n" + \ return "G40 G49 G54 G80 G90\n" + \
"G04 P3 T1 M6\n" + \ "G04 P3 T%d M6\n" % self.tool_id + \
"G00 X%.4f Y%.4f Z%.4f\n" % (self.startx, self.starty, self.startz) "G00 X%.4f Y%.4f Z%.4f\n" % (self.startx, self.starty, self.startz)
def end(self): def end(self):
......
...@@ -520,6 +520,8 @@ class ProjectGui: ...@@ -520,6 +520,8 @@ class ProjectGui:
self.gui.get_object("MaxStepDownControl").set_sensitive(self.settings.get("path_generator") == "PushCutter") self.gui.get_object("MaxStepDownControl").set_sensitive(self.settings.get("path_generator") == "PushCutter")
# "material allowance" requires ODE support # "material allowance" requires ODE support
self.gui.get_object("MaterialAllowanceControl").set_sensitive(self.settings.get("enable_ode")) self.gui.get_object("MaterialAllowanceControl").set_sensitive(self.settings.get("enable_ode"))
# toolpath table
self.toolpath_table = self.gui.get_object("ToolPathTable")
@gui_activity_guard @gui_activity_guard
def toggle_3d_view(self, widget=None, value=None): def toggle_3d_view(self, widget=None, value=None):
...@@ -734,6 +736,14 @@ class ProjectGui: ...@@ -734,6 +736,14 @@ class ProjectGui:
if section in config_list: if section in config_list:
self.processing_config_selection.set_active(config_list.index(section)) self.processing_config_selection.set_active(config_list.index(section))
def update_toolpath_table(self):
toolpath_tab = self.gui.get_object("ToolPathTab")
if self.toolpath is None:
toolpath_tab.hide()
else:
toolpath_tab.show()
#print dir(self.toolpath_table)
@gui_activity_guard @gui_activity_guard
def save_processing_settings_file(self, widget=None, section=None): def save_processing_settings_file(self, widget=None, section=None):
no_dialog = False no_dialog = False
...@@ -877,6 +887,7 @@ class ProjectGui: ...@@ -877,6 +887,7 @@ class ProjectGui:
elif direction == "xy": elif direction == "xy":
self.toolpath = self.pathgenerator.GenerateToolPath(minx, maxx, miny, maxy, minz, maxz, dy, dy, dz, draw_callback) self.toolpath = self.pathgenerator.GenerateToolPath(minx, maxx, miny, maxy, minz, maxz, dy, dy, dz, draw_callback)
print "Time elapsed: %f" % (time.time() - start_time) print "Time elapsed: %f" % (time.time() - start_time)
self.update_toolpath_table()
self.update_view() self.update_view()
# for compatibility with old pycam GUI (see pycam.py) # for compatibility with old pycam GUI (see pycam.py)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment