From dc3182c872aa615e4b946fcab5722c26fd4fb5f9 Mon Sep 17 00:00:00 2001 From: Marc Hannappel Date: Wed, 21 Dec 2016 09:44:24 +0100 Subject: [PATCH 1/9] Fix folders doesn't get listed when performing a filtering in file section, issue #1667 (cherry picked from commit 8a8b88a) --- src/octoprint/static/js/app/viewmodels/files.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js index 24695b2d..2563ebe8 100644 --- a/src/octoprint/static/js/app/viewmodels/files.js +++ b/src/octoprint/static/js/app/viewmodels/files.js @@ -708,11 +708,12 @@ $(function() { return false; } - if (entry["type"] == "folder" && entry["children"]) { + var success = entry["name"].toLocaleLowerCase().indexOf(query) > -1; + if (!success && entry["type"] == "folder" && entry["children"]) { return _.any(entry["children"], recursiveSearch); - } else { - return entry["name"].toLocaleLowerCase().indexOf(query) > -1; } + + return success; }; self.listHelper.changeSearchFunction(recursiveSearch); From f3f60674fc454942e45e5117be02a886ed4c6469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 9 Jan 2017 17:00:04 +0100 Subject: [PATCH 2/9] Allow a retraction z hop of 0 in timelapse configuration See comment by @markwal at https://github.com/foosel/OctoPrint/pull/1148#pullrequestreview-14802655 --- src/octoprint/server/api/timelapse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/server/api/timelapse.py b/src/octoprint/server/api/timelapse.py index 78cf69c2..e7272eb6 100644 --- a/src/octoprint/server/api/timelapse.py +++ b/src/octoprint/server/api/timelapse.py @@ -230,7 +230,7 @@ def setTimelapseConfig(): except ValueError: return make_response("Invalid value for retraction Z-Hop: %r" % data["retractionZHop"]) else: - if retractionZHop > 0: + if retractionZHop >= 0: config["options"]["retractionZHop"] = retractionZHop else: return make_response("Invalid value for retraction Z-Hop: %d" % retractionZHop) From 63c588fce9f3a710c69b27c2cc75bf237a799309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 9 Jan 2017 17:07:27 +0100 Subject: [PATCH 3/9] Update command line examples in README --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 47e9d7a2..f6d3be2a 100644 --- a/README.md +++ b/README.md @@ -86,27 +86,27 @@ following usage examples assume that said `octoprint` script is on your `PATH`. You can start the server via - octoprint + octoprint serve By default it binds to all interfaces on port 5000 (so pointing your browser to `http://127.0.0.1:5000` will do the trick). If you want to change that, use the additional command line parameters `host` and `port`, which accept the host ip to bind to and the numeric port number respectively. If for example you want the server to only listen on the local interface on port 8080, the command line would be - octoprint --host=127.0.0.1 --port=8080 + octoprint serve --host=127.0.0.1 --port=8080 Alternatively, the host and port on which to bind can be defined via the configuration. If you want to run OctoPrint as a daemon (only supported on Linux), use - octoprint --daemon {start|stop|restart} [--pid PIDFILE] + octoprint daemon {start|stop|restart} [--pid PIDFILE] If you do not supply a custom pidfile location via `--pid PIDFILE`, it will be created at `/tmp/octoprint.pid`. You can also specify the configfile or the base directory (for basing off the `uploads`, `timelapse` and `logs` folders), e.g.: - octoprint --config /path/to/another/config.yaml --basedir /path/to/my/basedir + octoprint serve --config /path/to/another/config.yaml --basedir /path/to/my/basedir See `octoprint --help` for further information. From 6e474d9096dd6e7cae79eb9ee917f548f430c5da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 10 Jan 2017 12:16:33 +0100 Subject: [PATCH 4/9] Fix model size calculation during GCODE analysis * Properly handle G0/G1 with no X, Y, Z coordinates in relative mode instead of duplicating coordinates - should fix #1675 * Only take move commands with X, Y, Z coordinates into account for model size calculation - this makes our internal GCODE analysis behave like the GCODE viewer's analysis and produce the same model size. The downside is that extrusions on the origin are no longer taken into account for checking if a model is within bounds of the print bed, but that should hopefully not produce any issues in the real world. --- src/octoprint/util/gcodeInterpreter.py | 28 +++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/octoprint/util/gcodeInterpreter.py b/src/octoprint/util/gcodeInterpreter.py index d06766b8..0cc0aab2 100644 --- a/src/octoprint/util/gcodeInterpreter.py +++ b/src/octoprint/util/gcodeInterpreter.py @@ -294,15 +294,28 @@ class gcode(object): e = getCodeFloat(line, 'E') f = getCodeFloat(line, 'F') + if x is not None or y is not None or z is not None: + # this is a move + move = True + else: + # print head stays on position + move = False + oldPos = pos - newPos = Vector3D(x if x is not None else pos.x, - y if y is not None else pos.y, - z if z is not None else pos.z) + + # Use new coordinates if provided. If not provided, use prior coordinates in absolute + # and 0.0 in relative mode. + newPos = Vector3D(x if x is not None else (pos.x if posAbs else 0.0), + y if y is not None else (pos.y if posAbs else 0.0), + z if z is not None else (pos.z if posAbs else 0.0)) if posAbs: + # Absolute mode: scale coordinates and apply offsets pos = newPos * scale + posOffset else: + # Relative mode: scale and add to current position pos += newPos * scale + if f is not None and f != 0: feedrate = f @@ -310,10 +323,12 @@ class gcode(object): if absoluteE: # make sure e is relative e -= currentE[currentExtruder] - # If move includes extrusion, calculate new min/max coordinates of model - if e > 0.0: - # extrusion -> relevant for print area & dimensions + + # If move with extrusion, calculate new min/max coordinates of model + if e > 0.0 and move: + # extrusion and move -> relevant for print area & dimensions self._minMax.record(pos) + totalExtrusion[currentExtruder] += e currentE[currentExtruder] += e maxExtrusion[currentExtruder] = max(maxExtrusion[currentExtruder], @@ -417,7 +432,6 @@ class gcode(object): if throttle is not None: throttle() - if self.progressCallback is not None: self.progressCallback(100.0) From 50965d69ce87eda94338769802860d69838d8898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 10 Jan 2017 19:00:58 +0100 Subject: [PATCH 5/9] Include info about setting up dev env in CONTRIBUTING.md --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e7c89f36..98ee68d0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,6 +12,7 @@ or **[creating pull requests](#pull-requests)**. * [Where can I find which version and branch I'm on?](#where-can-i-find-which-version-and-branch-im-on) * [Where can I find those log files you keep talking about?](#where-can-i-find-those-log-files-you-keep-talking-about) * [Where can I find my browser's error console?](#where-can-i-find-my-browsers-error-console) + * [Setting up a development environment](#setting-up-a-development-environment) * [Pull requests](#pull-requests) * [What do the branches mean?](#what-do-the-branches-mean) * [How OctoPrint is versioned](#how-octoprint-is-versioned) @@ -235,6 +236,10 @@ find information on how to do just that in the See [How to open the Javascript Console in different browsers](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers) +## Setting up a development environment + +See [the corresponding chapter in the documentation](http://docs.octoprint.org/en/master/development/index.html#setting-up-a-development-environment). + ## Pull requests 1. If you want to add a new feature to OctoPrint, **please always first From 06eae381e433cf16d0416066608e05e094948a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 10 Jan 2017 19:01:23 +0100 Subject: [PATCH 6/9] Fixed an error in the dev env setup docs --- docs/development/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/index.rst b/docs/development/index.rst index 3cdef357..585561c8 100644 --- a/docs/development/index.rst +++ b/docs/development/index.rst @@ -167,7 +167,7 @@ IDE Setup PyCharm ....... - - "File" > "Open ...", select OctoPrint checkout folder (e.g. ``~/devel/OctoPrint/venv`` or ``C:\Devel\OctoPrint``) + - "File" > "Open ...", select OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``) - "File" > "Settings ..." > "Project: OctoPrint" > "Project Interpreter" > "Add local ...", select OctoPrint venv folder (e.g. ``~/devel/OctoPrint/venv`` or ``C:\Devel\OctoPrint\venv``) - Right click "src" in project tree, mark as source folder From 58f934e2c1c891d2c579d116e1a19c56a1ac93b6 Mon Sep 17 00:00:00 2001 From: derpicknicker1 <10minutemail@web.de> Date: Tue, 10 Jan 2017 17:05:39 +0100 Subject: [PATCH 7/9] Fix issue in getting file metadata after slicing This fixes the issue that there were no informations about filament usage in metadata after slicing with cura plugin. Trying to call profile.get_float("filament_diameter") ended in en exception with message " 'module' object has no attribute 'get_float' ". So i defined profile before using profile and now it works. See issue #1685 Also inserted a check to determine if filament usage is > 0 to exclude tools with no filament usage in metadata. (cherry picked from commit c9b38bd) --- src/octoprint/plugins/cura/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/octoprint/plugins/cura/__init__.py b/src/octoprint/plugins/cura/__init__.py index cca716cc..e4a2f3d1 100644 --- a/src/octoprint/plugins/cura/__init__.py +++ b/src/octoprint/plugins/cura/__init__.py @@ -372,10 +372,12 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin, analysis = dict() if not "filament" in analysis: analysis["filament"] = dict() - if not tool_key in analysis["filament"]: + if not tool_key in analysis["filament"] and filament > 0: analysis["filament"][tool_key] = dict() - if profile.get_float("filament_diameter") != None: + profile = Profile(self._load_profile(profile_path), printer_profile, posX, posY) + + if profile.get_float("filament_diameter") != None and filament > 0: if profile.get("gcode_flavor") == GcodeFlavors.ULTIGCODE or profile.get("gcode_flavor") == GcodeFlavors.REPRAP_VOLUME: analysis["filament"][tool_key] = _get_usage_from_volume(filament, profile.get_float("filament_diameter")) else: From f20e985d0da3d197dabe350cda67ead4cff0117d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 11 Jan 2017 11:55:39 +0100 Subject: [PATCH 8/9] profile => slicing_profile & removed filament 0 check If the slicer returns values for a tool we want it in our analysis result, even if it's zero. That way the result will be the same as if we have our own built in gcode analyser take a look at the file. (cherry picked from commit 818ae92) --- src/octoprint/plugins/cura/__init__.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/octoprint/plugins/cura/__init__.py b/src/octoprint/plugins/cura/__init__.py index e4a2f3d1..3633cf5e 100644 --- a/src/octoprint/plugins/cura/__init__.py +++ b/src/octoprint/plugins/cura/__init__.py @@ -266,6 +266,7 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin, working_dir = os.path.dirname(executable) + slicing_profile = Profile(self._load_profile(profile_path), printer_profile, posX, posY) engine_settings = self._convert_to_engine(profile_path, printer_profile, posX, posY) # Start building the argument list for the CuraEngine command execution @@ -372,16 +373,14 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin, analysis = dict() if not "filament" in analysis: analysis["filament"] = dict() - if not tool_key in analysis["filament"] and filament > 0: + if not tool_key in analysis["filament"]: analysis["filament"][tool_key] = dict() - profile = Profile(self._load_profile(profile_path), printer_profile, posX, posY) - - if profile.get_float("filament_diameter") != None and filament > 0: - if profile.get("gcode_flavor") == GcodeFlavors.ULTIGCODE or profile.get("gcode_flavor") == GcodeFlavors.REPRAP_VOLUME: - analysis["filament"][tool_key] = _get_usage_from_volume(filament, profile.get_float("filament_diameter")) + if slicing_profile.get_float("filament_diameter") is not None: + if slicing_profile.get("gcode_flavor") == GcodeFlavors.ULTIGCODE or slicing_profile.get("gcode_flavor") == GcodeFlavors.REPRAP_VOLUME: + analysis["filament"][tool_key] = _get_usage_from_volume(filament, slicing_profile.get_float("filament_diameter")) else: - analysis["filament"][tool_key] = _get_usage_from_length(filament, profile.get_float("filament_diameter")) + analysis["filament"][tool_key] = _get_usage_from_length(filament, slicing_profile.get_float("filament_diameter")) except: pass From 2ab7fa4d3a4f2c31a59f3d40237d1cd920fbbecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 11 Jan 2017 12:11:16 +0100 Subject: [PATCH 9/9] Support volume calculate for S3D files --- src/octoprint/util/gcodeInterpreter.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/octoprint/util/gcodeInterpreter.py b/src/octoprint/util/gcodeInterpreter.py index 0cc0aab2..432eb0db 100644 --- a/src/octoprint/util/gcodeInterpreter.py +++ b/src/octoprint/util/gcodeInterpreter.py @@ -260,6 +260,7 @@ class gcode(object): if ';' in line: comment = line[line.find(';')+1:].strip() if comment.startswith("filament_diameter"): + # Slic3r filamentValue = comment.split("=", 1)[1].strip() try: self._filamentDiameter = float(filamentValue) @@ -269,6 +270,7 @@ class gcode(object): except ValueError: self._filamentDiameter = 0.0 elif comment.startswith("CURA_PROFILE_STRING") or comment.startswith("CURA_OCTO_PROFILE_STRING"): + # Cura 15.04.* & OctoPrint Cura plugin if comment.startswith("CURA_PROFILE_STRING"): prefix = "CURA_PROFILE_STRING:" else: @@ -280,6 +282,13 @@ class gcode(object): self._filamentDiameter = float(curaOptions["filament_diameter"]) except: self._filamentDiameter = 0.0 + elif comment.startswith("filamentDiameter,"): + # Simplify3D + filamentValue = comment.split(",", 1)[1].strip() + try: + self._filamentDiameter = float(filamentValue) + except ValueError: + self._filamentDiameter = 0.0 line = line[0:line.find(';')] G = getCodeInt(line, 'G')