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 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. 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 diff --git a/src/octoprint/plugins/cura/__init__.py b/src/octoprint/plugins/cura/__init__.py index cca716cc..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 @@ -375,11 +376,11 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin, if not tool_key in analysis["filament"]: analysis["filament"][tool_key] = dict() - if profile.get_float("filament_diameter") != None: - 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 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) diff --git a/src/octoprint/util/gcodeInterpreter.py b/src/octoprint/util/gcodeInterpreter.py index d06766b8..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') @@ -294,15 +303,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 +332,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 +441,6 @@ class gcode(object): if throttle is not None: throttle() - if self.progressCallback is not None: self.progressCallback(100.0)