{"action":"closed","issue":{"url":"https://api.github.com/repos/foosel/OctoPrint/issues/1906","repository_url":"https://api.github.com/repos/foosel/OctoPrint","labels_url":"https://api.github.com/repos/foosel/OctoPrint/issues/1906/labels{/name}","comments_url":"https://api.github.com/repos/foosel/OctoPrint/issues/1906/comments","events_url":"https://api.github.com/repos/foosel/OctoPrint/issues/1906/events","html_url":"https://github.com/foosel/OctoPrint/issues/1906","id":227149452,"number":1906,"title":"Erronious model size when G92 misinterpreted by gcodeInterpreter","user":{"login":"CapnBry","id":677183,"avatar_url":"https://avatars2.githubusercontent.com/u/677183?v=3","gravatar_id":"","url":"https://api.github.com/users/CapnBry","html_url":"https://github.com/CapnBry","followers_url":"https://api.github.com/users/CapnBry/followers","following_url":"https://api.github.com/users/CapnBry/following{/other_user}","gists_url":"https://api.github.com/users/CapnBry/gists{/gist_id}","starred_url":"https://api.github.com/users/CapnBry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CapnBry/subscriptions","organizations_url":"https://api.github.com/users/CapnBry/orgs","repos_url":"https://api.github.com/users/CapnBry/repos","events_url":"https://api.github.com/users/CapnBry/events{/privacy}","received_events_url":"https://api.github.com/users/CapnBry/received_events","type":"User","site_admin":false},"labels":[{"id":289364687,"url":"https://api.github.com/repos/foosel/OctoPrint/labels/status:needs%20testing","name":"status:needs testing","color":"fef2c0","default":false},{"id":326275585,"url":"https://api.github.com/repos/foosel/OctoPrint/labels/status:solved","name":"status:solved","color":"009800","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/foosel/OctoPrint/milestones/15","html_url":"https://github.com/foosel/OctoPrint/milestone/15","labels_url":"https://api.github.com/repos/foosel/OctoPrint/milestones/15/labels","id":2385523,"number":15,"title":"1.3.3","description":"","creator":{"login":"foosel","id":83657,"avatar_url":"https://avatars3.githubusercontent.com/u/83657?v=3","gravatar_id":"","url":"https://api.github.com/users/foosel","html_url":"https://github.com/foosel","followers_url":"https://api.github.com/users/foosel/followers","following_url":"https://api.github.com/users/foosel/following{/other_user}","gists_url":"https://api.github.com/users/foosel/gists{/gist_id}","starred_url":"https://api.github.com/users/foosel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foosel/subscriptions","organizations_url":"https://api.github.com/users/foosel/orgs","repos_url":"https://api.github.com/users/foosel/repos","events_url":"https://api.github.com/users/foosel/events{/privacy}","received_events_url":"https://api.github.com/users/foosel/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":26,"state":"open","created_at":"2017-03-14T16:27:01Z","updated_at":"2017-05-31T15:21:54Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2017-05-08T19:31:23Z","updated_at":"2017-05-31T15:21:54Z","closed_at":"2017-05-31T15:21:54Z","body":"#### What were you doing?\r\n\r\nUploading a file and letting OctoPrint analyze the file\r\n\r\n#### What did you expect to happen and what happened instead?\r\n\r\nWhen printing, I was warned that my model **could not be printed because it exceeded the print area of my printer**. The model was determined to be 238.44mm × 190.00mm × **3687.78mm** when it actually is 238.44mm x 190.00mm x 18.72mm. This is size listed in the file list details. The metadata.yaml shows that my printingArea.minZ is -3500.\r\n\r\nI tracked this down to a G92 I have in my start GCode: `G92 E0 Z1.52`. The gcodeInterpreter code for G92 seems to take X Y and Z values as offsets when [G92](http://reprap.org/wiki/G-code#G92:_Set_Position) is actually 'Set Absolute Position'. For example, if I was at X0 Y0 Z0 (homed) and said `G92 X100 Y100` and then `G1 X100 Y100`, the toolhead would not move because it is already at X100 Y100. \r\n\r\nThe source code appears to be doing some sort of G92.1 or G92.2 which has to do with setting offsets (but only zeroing them?). I've never seen a G92.1 or .2 in practice (Slic3r, Cura, Simplify3D) so I can't say if this is used for anything. The code does the right thing for `G92 Exxx`. Here is how I believe it should be:\r\n```\r\ndiff --git a/src/octoprint/util/gcodeInterpreter.py b/src/octoprint/util/gcodeInterpreter.py\r\nindex ac10954..db75ac8 100644\r\n--- a/src/octoprint/util/gcodeInterpreter.py\r\n+++ b/src/octoprint/util/gcodeInterpreter.py\r\n@@ -400,11 +400,11 @@ class gcode(object):\r\n                                        if e is not None:\r\n                                                currentE[currentExtruder] = e\r\n                                        if x is not None:\r\n-                                               posOffset.x = pos.x - x\r\n+                                               pos.x = x\r\n                                        if y is not None:\r\n-                                               posOffset.y = pos.y - y\r\n+                                               pos.y = y\r\n                                        if z is not None:\r\n-                                               posOffset.z = pos.z - z\r\n+                                               pos.z = z\r\n\r\n                        elif M is not None:\r\n                                if M == 82:   #Absolute E\r\n```\r\n\r\nWhy does this cause a problem? On every absolute \"move\" the position is incremented by posOffset. There is no Z parameter in the X/Y G1 moves, so `pos` accumulates 1x posOffset.z per move. In my case that means -every X/Y move- thought it was also offsetting the Z axis by -1.52mm. On each layer change, OctoPrint also thinks it has to travel back from Z=-3000 all the way to the actual Z value (although the travel time is fairly quick because most slicers do not include a Z feedrate). This spills over into overestimating the print time.\r\n\r\nThe values could be way off in the X / Y direction as well, but this is mitigated by the fact that almost all moves include X and Y coordinates so the accumulated position does not grow over time as it does with the thousands of GCode G1 lines without a Z parameter. The only way a G92 with an X or Y would cause a notable increase in estimated print time is if the toolhead just moved back and forth along a single axis, in which case the other axis would show a ever-growing position. The \"Model Size\" would roughly report the model size plus (or minus) the G92 X or Y offset then.\r\n\r\n#### Branch & Commit or Version of OctoPrint\r\n\r\nMaster 1.3.2 release\r\n\r\n#### Operating System running OctoPrint\r\n\r\nRaspbian Jessie on Pi 2 B\r\n\r\n#### Printer model & used firmware incl. version\r\n\r\nC-Bot Core XY with Smoothieware\r\n\r\n#### Browser and Version of Browser, Operating System running Browser\r\n\r\nN/A\r\n\r\n#### Link to octoprint.log\r\n\r\nLogs indicate model is queued for analysis and then completed in N seconds\r\n\r\n#### Link to contents of terminal tab or serial.log\r\n\r\nN/A\r\n\r\n#### Link to contents of Javascript console in the browser\r\n\r\nN/A\r\n\r\n#### Screenshot(s) or video(s) showing the problem:\r\n\r\nI have read the FAQ. And I still love cookies even if I am not required to.\r\n"}}
{"actor":{"display_login":"foosel"}}