From 2800f534480a1e284b0b6f078e21fdb712cac303 Mon Sep 17 00:00:00 2001 From: Teja Date: Sun, 1 Feb 2015 12:34:32 +0100 Subject: [PATCH] auto-sending machine specific headers / footers --- src/octoprint/plugins/svgtogcode/__init__.py | 4 +++- src/octoprint/server/api/files.py | 2 -- src/octoprint/util/comm.py | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/octoprint/plugins/svgtogcode/__init__.py b/src/octoprint/plugins/svgtogcode/__init__.py index a76f61ed..d78706a0 100644 --- a/src/octoprint/plugins/svgtogcode/__init__.py +++ b/src/octoprint/plugins/svgtogcode/__init__.py @@ -272,10 +272,12 @@ class SvgToGcodePlugin(octoprint.plugin.SlicerPlugin, dest_dir, dest_file = os.path.split(machinecode_path) working_dir, _ = os.path.split(executable) args = ['python "%s"' % executable, '-f "%s"' % dest_file, '-d "%s"' % dest_dir] + args += ['--no-header=True'] for k, v in engine_settings.items(): args += ['"%s=%s"' % (k, str(v))] fill_enabled = False # disabled as highly experimental - args += ['--fill-areas=%s' % fill_enabled, '--create-log=%s' % log_enabled, '"--log-filename=%s"' % log_path,'"%s"' % model_path] + args += ['--fill-areas=%s' % fill_enabled] + args += ['--create-log=%s' % log_enabled, '"--log-filename=%s"' % log_path,'"%s"' % model_path] #python ~/mrbeam-inkscape-ext/standalone.py -f output.gcode -d output/path --engraving-laser-speed=300 # --laser-intensity=1000 --create-log=false path/to/input.svg diff --git a/src/octoprint/server/api/files.py b/src/octoprint/server/api/files.py index 96a69aae..58a4ab3d 100644 --- a/src/octoprint/server/api/files.py +++ b/src/octoprint/server/api/files.py @@ -430,7 +430,6 @@ def gcodeConvertCommand(): with open(output_path,'ab') as wfd: for f in sources: path = fileManager.get_absolute_path(f['origin'], f['name']) - print("files.py appendCallback", path) wfd.write( "\n; "+ f['name'] + "\n") with open(path,'rb') as fd: @@ -438,7 +437,6 @@ def gcodeConvertCommand(): wfd.write( "\nM05\n") # ensure that the laser is off. - print("files.py join done", output_path) if command == "convert": diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index d4392f26..3b86b615 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -403,6 +403,13 @@ class MachineCom(object): self._pauseWaitTimeLost = 0.0 try: + # TODO fetch init sequence from machine profile + self.sendCommand("$H") + self.sendCommand("G92X0Y0Z0") + self.sendCommand("G90") + self.sendCommand("M08") + self.sendCommand("G21") + self._currentFile.start() wasPaused = self.isPaused() @@ -1135,7 +1142,7 @@ class MachineCom(object): "remote": remote, "time": self.getPrintTime() } - + self._currentFile = None self._changeState(self.STATE_OPERATIONAL) self._callback.mcFileTransferDone(remote) @@ -1151,6 +1158,12 @@ class MachineCom(object): self._callback.mcPrintjobDone() self._changeState(self.STATE_OPERATIONAL) eventManager().fire(Events.PRINT_DONE, payload) + + # TODO fetch finish sequence from machine profiles + self.sendCommand("M05"); + self.sendCommand("G0X0Y0"); + self.sendCommand("M09"); + self.sendCommand("M02"); return self._sendCommand(line, True)