Commit ba3b1155 authored by sumpfralle's avatar sumpfralle

added an optional pause (M0) before and after touch off operations (useful for...

added an optional pause (M0) before and after touch off operations (useful for manually controlled spindles)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1005 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent e6fc5e80
...@@ -5623,7 +5623,7 @@ Choose a small value to minimize rapid moves up and down.</property> ...@@ -5623,7 +5623,7 @@ Choose a small value to minimize rapid moves up and down.</property>
<child> <child>
<object class="GtkTable" id="TouchOffLocationTable"> <object class="GtkTable" id="TouchOffLocationTable">
<property name="visible">True</property> <property name="visible">True</property>
<property name="n_rows">6</property> <property name="n_rows">7</property>
<property name="n_columns">3</property> <property name="n_columns">3</property>
<property name="column_spacing">3</property> <property name="column_spacing">3</property>
<property name="row_spacing">3</property> <property name="row_spacing">3</property>
...@@ -5898,6 +5898,23 @@ be shifted accordingly.</property> ...@@ -5898,6 +5898,23 @@ be shifted accordingly.</property>
<property name="y_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="TouchOffPauseExecution">
<property name="label" translatable="yes">Pause GCode execution (M0) before and after tool change</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">This setting is supposed to be a workaround for machines with manual spindle control.
Everyone else should use the option for M3/M5 (see above).</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="right_attach">3</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
......
...@@ -73,7 +73,8 @@ class GCodeGenerator: ...@@ -73,7 +73,8 @@ class GCodeGenerator:
comment=None, minimum_steps=None, touch_off_on_startup=False, comment=None, minimum_steps=None, touch_off_on_startup=False,
touch_off_on_tool_change=False, touch_off_position=None, touch_off_on_tool_change=False, touch_off_position=None,
touch_off_rapid_move=0, touch_off_slow_move=1, touch_off_rapid_move=0, touch_off_slow_move=1,
touch_off_slow_feedrate=20, touch_off_height=0): touch_off_slow_feedrate=20, touch_off_height=0,
touch_off_pause_execution=False):
if isinstance(destination, basestring): if isinstance(destination, basestring):
# open the file # open the file
self.destination = file(destination,"w") self.destination = file(destination,"w")
...@@ -121,6 +122,7 @@ class GCodeGenerator: ...@@ -121,6 +122,7 @@ class GCodeGenerator:
self.touch_off_rapid_move = touch_off_rapid_move self.touch_off_rapid_move = touch_off_rapid_move
self.touch_off_slow_move = touch_off_slow_move self.touch_off_slow_move = touch_off_slow_move
self.touch_off_slow_feedrate = touch_off_slow_feedrate self.touch_off_slow_feedrate = touch_off_slow_feedrate
self.touch_off_pause_execution = touch_off_pause_execution
if touch_off_on_startup: if touch_off_on_startup:
self.run_touch_off(force_height=touch_off_height) self.run_touch_off(force_height=touch_off_height)
...@@ -134,6 +136,9 @@ class GCodeGenerator: ...@@ -134,6 +136,9 @@ class GCodeGenerator:
self.append("G28 (go to final touch off position)") self.append("G28 (go to final touch off position)")
self.append("G91 (enter incremental mode)") self.append("G91 (enter incremental mode)")
self.append("F%f (reduce feed rate during touch off)" % self.touch_off_slow_feedrate) self.append("F%f (reduce feed rate during touch off)" % self.touch_off_slow_feedrate)
if self.touch_off_pause_execution:
self.append("(msg,Pausing before tool change)")
self.append("M0 (pause before touch off)")
# measure the current tool length # measure the current tool length
if self.touch_off_rapid_move > 0: if self.touch_off_rapid_move > 0:
self.append("G0 Z-%f (go down rapidly)" % self.touch_off_rapid_move) self.append("G0 Z-%f (go down rapidly)" % self.touch_off_rapid_move)
...@@ -153,6 +158,9 @@ class GCodeGenerator: ...@@ -153,6 +158,9 @@ class GCodeGenerator:
self.append("G43.1 Z[#5063-#1000] (compensate the new tool length)") self.append("G43.1 Z[#5063-#1000] (compensate the new tool length)")
self.append("F%f (restore feed rate)" % self.last_feedrate) self.append("F%f (restore feed rate)" % self.last_feedrate)
self.append("G90 (disable incremental mode)") self.append("G90 (disable incremental mode)")
if self.touch_off_pause_execution:
self.append("(msg,Pausing after tool change)")
self.append("M0 (pause after touch off)")
self.append("(End of touch off operation)") self.append("(End of touch off operation)")
self.append("") self.append("")
......
...@@ -153,6 +153,7 @@ PREFERENCES_DEFAULTS = { ...@@ -153,6 +153,7 @@ PREFERENCES_DEFAULTS = {
"touch_off_slow_move": 1.0, "touch_off_slow_move": 1.0,
"touch_off_slow_feedrate": 20, "touch_off_slow_feedrate": 20,
"touch_off_height": 0.0, "touch_off_height": 0.0,
"touch_off_pause_execution": False,
} }
""" the listed items will be loaded/saved via the preferences file in the """ the listed items will be loaded/saved via the preferences file in the
user's home directory on startup/shutdown""" user's home directory on startup/shutdown"""
...@@ -969,6 +970,9 @@ class ProjectGui: ...@@ -969,6 +970,9 @@ class ProjectGui:
("TouchOffHeight", "touch_off_height")): ("TouchOffHeight", "touch_off_height")):
obj = self.gui.get_object(objname) obj = self.gui.get_object(objname)
self.settings.add_item(setting, obj.get_value, obj.set_value) self.settings.add_item(setting, obj.get_value, obj.set_value)
touch_off_pause = self.gui.get_object("TouchOffPauseExecution")
self.settings.add_item("touch_off_pause_execution",
touch_off_pause.get_active, touch_off_pause.set_active)
# redraw the toolpath if safety height changed # redraw the toolpath if safety height changed
gcode_safety_height.connect("value-changed", self.update_view) gcode_safety_height.connect("value-changed", self.update_view)
gcode_path_mode = self.gui.get_object("GCodeCornerStyleControl") gcode_path_mode = self.gui.get_object("GCodeCornerStyleControl")
...@@ -4067,13 +4071,10 @@ class ProjectGui: ...@@ -4067,13 +4071,10 @@ class ProjectGui:
minimum_steps = [self.settings.get("gcode_minimum_step_x"), minimum_steps = [self.settings.get("gcode_minimum_step_x"),
self.settings.get("gcode_minimum_step_y"), self.settings.get("gcode_minimum_step_y"),
self.settings.get("gcode_minimum_step_z")] self.settings.get("gcode_minimum_step_z")]
getobj = self.gui.get_object if self.settings.get("touch_off_position_type") == "absolute":
touch_off_pos_selector = getobj("TouchOffLocationSelector") pos_x = self.settings.get("touch_off_position_x")
touch_off_type = touch_off_pos_selector.get_model()[touch_off_pos_selector.get_active()][0] pos_y = self.settings.get("touch_off_position_y")
if touch_off_type == "absolute": pos_z = self.settings.get("touch_off_position_z")
pos_x = getobj("ToolChangePosX").get_value()
pos_y = getobj("ToolChangePosY").get_value()
pos_z = getobj("ToolChangePosZ").get_value()
touch_off_pos = Point(pos_x, pos_y, pos_z) touch_off_pos = Point(pos_x, pos_y, pos_z)
else: else:
touch_off_pos = None touch_off_pos = None
...@@ -4083,13 +4084,14 @@ class ProjectGui: ...@@ -4083,13 +4084,14 @@ class ProjectGui:
toggle_spindle_status=self.settings.get("gcode_start_stop_spindle"), toggle_spindle_status=self.settings.get("gcode_start_stop_spindle"),
spindle_delay=self.settings.get("gcode_spindle_delay"), spindle_delay=self.settings.get("gcode_spindle_delay"),
comment=all_info, minimum_steps=minimum_steps, comment=all_info, minimum_steps=minimum_steps,
touch_off_on_startup=getobj("GCodeTouchOffOnStartup").get_active(), touch_off_on_startup=self.settings.get("touch_off_on_startup"),
touch_off_on_tool_change=getobj("GCodeTouchOffOnToolChange").get_active(), touch_off_on_tool_change=self.settings.get("touch_off_on_tool_change"),
touch_off_position=touch_off_pos, touch_off_position=touch_off_pos,
touch_off_rapid_move=getobj("ToolChangeRapidMoveDown").get_value(), touch_off_rapid_move=self.settings.get("touch_off_rapid_move"),
touch_off_slow_move=getobj("ToolChangeSlowMoveDown").get_value(), touch_off_slow_move=self.settings.get("touch_off_slow_move"),
touch_off_slow_feedrate=getobj("ToolChangeSlowMoveSpeed").get_value(), touch_off_slow_feedrate=self.settings.get("touch_off_slow_feedrate"),
touch_off_height=getobj("TouchOffHeight").get_value()) touch_off_height=self.settings.get("touch_off_height"),
touch_off_pause_execution=self.settings.get("touch_off_pause_execution"))
path_mode = self.settings.get("gcode_path_mode") path_mode = self.settings.get("gcode_path_mode")
if path_mode == 0: if path_mode == 0:
generator.set_path_mode(PATH_MODES["exact_path"]) generator.set_path_mode(PATH_MODES["exact_path"])
......
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