Commit b65b6498 authored by sumpfralle's avatar sumpfralle

added a "minimum_step" parameter for GCode generation to the user interface

this allows to change the hard-coded accuracy stepping implemented by paulusmax in r925


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@927 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 4caabd20
......@@ -375,7 +375,8 @@ def execute(parser, opts, args, pycam):
generator = pycam.Exporters.GCodeExporter.GCodeGenerator(
handler, metric_units = (opts.unit_size == "mm"),
safety_height=opts.safety_height,
toggle_spindle_status=opts.gcode_no_start_stop_spindle)
toggle_spindle_status=opts.gcode_no_start_stop_spindle,
minimum_step=opts.gcode_minimum_step)
generator.set_speed(opts.tool_feedrate, opts.tool_spindle_speed)
path_mode = opts.gcode_path_mode
PATH_MODES = pycam.Exporters.GCodeExporter.PATH_MODES
......@@ -612,12 +613,19 @@ if __name__ == "__main__":
dest="gcode_no_start_stop_spindle", default=True,
action="store_false", help="do not start the spindle before " \
+ "and stop it after each operation (M3/M5)")
group_gcode.add_option("", "--gcode-minimum-step",
dest="gcode_minimum_step", default=0.0,
type="float", action="store", help="mimimum axial distance " \
+ "between two machine positions. Any shorter move is not " \
+ "written to GCode (default: 0.0).")
group_gcode.add_option("", "--gcode-path-mode", dest="gcode_path_mode",
default="exact_path", action="store", type="choice",
choices=["exact_path", "exact_stop", "continuous"],
help="choose the GCode path mode from 'exact_path', 'exact_stop'" \
+ "and 'continuous'. See " \
+ "http://linuxcnc.org/docs/html/gcode_main.html for details")
help="choose the GCode path mode from 'exact_path', 'exact_stop' " \
+ "and 'continuous'. Use '--gcode-motion-tolerance' and " \
+ "and '--gcode-naive-tolerance' if you want to limit the " \
+ "deviation. See http://linuxcnc.org/docs/html/gcode_main.html " \
+ "(G61) for details.")
group_gcode.add_option("", "--gcode-motion-tolerance",
dest="gcode_motion_tolerance", default=None,
action="store", help="the optional motion tolerance for " \
......
This diff is collapsed.
......@@ -37,7 +37,8 @@ PATH_MODES = {"exact_path": 0, "exact_stop": 1, "continuous": 2}
class GCodeGenerator:
def __init__(self, destination, metric_units=True, safety_height=0.0,
toggle_spindle_status=False, header=None, comment=None):
toggle_spindle_status=False, header=None, comment=None,
minimum_step=0.0):
if isinstance(destination, basestring):
# open the file
self.destination = file(destination,"w")
......@@ -52,6 +53,7 @@ class GCodeGenerator:
self.gcode = gcode(safetyheight=self.safety_height)
self.toggle_spindle_status = toggle_spindle_status
self.comment = comment
self._minimum_step = minimum_step
self._finished = False
if comment:
self.add_comment(comment)
......@@ -66,9 +68,9 @@ class GCodeGenerator:
def set_speed(self, feedrate=None, spindle_speed=None):
if not feedrate is None:
self.append("F%.4f" % feedrate)
self.append("F%.5f" % feedrate)
if not spindle_speed is None:
self.append("S%.4f" % spindle_speed)
self.append("S%.5f" % spindle_speed)
def set_path_mode(self, mode, motion_tolerance=None,
naive_cam_tolerance=None):
......@@ -103,9 +105,9 @@ class GCodeGenerator:
self.append(self.gcode.delay(2))
# At minimum this will stop the duplicate gcode
# And this is a place holder for when the GUI is linked
ResLimitX = 0.0001
ResLimitY = 0.0001
ResLimitZ = 0.0001
ResLimitX = self._minimum_step
ResLimitY = self._minimum_step
ResLimitZ = self._minimum_step
OldPosition = None
for pos, rapid in moves:
if OldPosition == None:
......
......@@ -126,6 +126,7 @@ PREFERENCES_DEFAULTS = {
"simulation_details_level": 3,
"drill_progress_max_fps": 2,
"gcode_safety_height": 25.0,
"gcode_minimum_step": 0.0,
"gcode_path_mode": 0,
"gcode_motion_tolerance": 0,
"gcode_naive_tolerance": 0,
......@@ -881,6 +882,9 @@ class ProjectGui:
self._task_property_signals.append((obj,
obj.connect("changed", self._handle_task_setting_change)))
# gcode settings
gcode_minimum_step = self.gui.get_object("GCodeMinimumStep")
self.settings.add_item("gcode_minimum_step",
gcode_minimum_step.get_value, gcode_minimum_step.set_value)
gcode_safety_height = self.gui.get_object("SafetyHeightControl")
self.settings.add_item("gcode_safety_height",
gcode_safety_height.get_value, gcode_safety_height.set_value)
......@@ -3729,7 +3733,8 @@ class ProjectGui:
metric_units=(self.settings.get("unit") == "mm"),
safety_height=safety_height,
toggle_spindle_status=self.settings.get("gcode_start_stop_spindle"),
comment=all_info)
comment=all_info,
minimum_step=self.settings.get("gcode_minimum_step"))
path_mode = self.settings.get("gcode_path_mode")
PATH_MODES = pycam.Exporters.GCodeExporter.PATH_MODES
if path_mode == 0:
......
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