bradcfisher / OctoPrint-ExcludeRegionPlugin

OctoPrint plugin that adds the ability to prevent printing within rectangular or circular regions of the currently active gcode file.
GNU Affero General Public License v3.0
55 stars 5 forks source link

Fatal error when parsing G92 commands - 'NoneType' in AxisPosition.py #60

Open AndrewFRC135 opened 3 years ago

AndrewFRC135 commented 3 years ago

I am using this plugin in conjunction with the GPX plugin to run my Makerbot Replicator 2. I suspect maybe there is a conflict between the two, since the GPX plugin manages the gcode offset commands. Below is a snippet of my log file showing the error.

2021-04-09 19:17:29,408 - octoprint.plugins.excluderegion - INFO - Printing started 2021-04-09 19:17:29,438 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0 2021-04-09 19:17:29,468 - octoprint.util.comm - ERROR - Error while processing hook excluderegion for phase queuing and command G92 X0 Y0 Z0 A0 B0: Traceback (most recent call last): File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 4490, in _process_command_phase tags=tags, File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/init.py", line 1890, in wrapper return f(*args, *kwargs) File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_excluderegion/init.py", line 714, in handleGcodeQueuing return self.gcodeHandlers.handleGcode(cmd, gcode, subcode) File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_excluderegion/GcodeHandlers.py", line 223, in handleGcode return method(cmd, gcode, subcode) File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_excluderegion/GcodeHandlers.py", line 432, in _handle_G92 position.X_AXIS.setLogicalOffsetPosition(value) File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_excluderegion/AxisPosition.py", line 98, in setLogicalOffsetPosition self.offset += self.logicalToNative(offset) - self.current TypeError: unsupported operand type(s) for -: 'float' and 'NoneType' 2021-04-09 19:17:29,479 - octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing" 2021-04-09 19:17:29,572 - octoprint.util.comm - INFO - Externally triggered heatup detected 2021-04-09 19:17:31,629 - octoprint.util.comm - INFO - Externally triggered heatup detected 2021-04-09 19:17:33,651 - octoprint.util.comm - ERROR - Error while processing hook excluderegion for phase queuing and command G92 Z-5: Traceback (most recent call last): File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 4490, in _process_command_phase tags=tags, File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/init.py", line 1890, in wrapper return f(args, **kwargs) File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_excluderegion/init.py", line 714, in handleGcodeQueuing return self.gcodeHandlers.handleGcode(cmd, gcode, subcode) File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_excluderegion/GcodeHandlers.py", line 223, in handleGcode return method(cmd, gcode, subcode) File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_excluderegion/GcodeHandlers.py", line 436, in _handle_G92 position.Z_AXIS.setLogicalOffsetPosition(value) File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_excluderegion/AxisPosition.py", line 98, in setLogicalOffsetPosition self.offset += self.logicalToNative(offset) - self.current TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'

ExcludeRegion seems to fail whenever a G92 command is issued, as one of the variables appears to be a 'NoneType'. This failure causes the GPX plugin to ignore the G92 commands, leading to incorrect printer behavior. Below are my relevant version numbers. I am using Simplify3D as my slicer, if that matters.

Octoprint Version: 1.5.3 Exclude Region Version: 0.3.0 GPX Plugin Version: 2.6.8

RobinTail commented 1 year ago

Same thing. Python 3.9, OctoPrint 1.9.2 Latest version of the plugin.

2023-09-20 21:42:28,162 - octoprint.util.comm - ERROR - Error while processing hook excluderegion for phase queuing:
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.9/site-packages/octoprint/util/comm.py", line 4747, in _process_command_phase
    hook_results = hook(
  File "/home/pi/oprint/lib/python3.9/site-packages/octoprint/util/__init__.py", line 1686, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.9/site-packages/octoprint_excluderegion/__init__.py", line 714, in handleGcodeQueuing
    return self.gcodeHandlers.handleGcode(cmd, gcode, subcode)
  File "/home/pi/oprint/lib/python3.9/site-packages/octoprint_excluderegion/GcodeHandlers.py", line 223, in handleGcode
    return method(cmd, gcode, subcode)
  File "/home/pi/oprint/lib/python3.9/site-packages/octoprint_excluderegion/GcodeHandlers.py", line 252, in _handle_G0
    return self.state.processLinearMoves(cmd, extruderPosition, feedRate, z, x, y)
  File "/home/pi/oprint/lib/python3.9/site-packages/octoprint_excluderegion/ExcludeRegionState.py", line 667, in processLinearMoves
    self.position.Z_AXIS.setLogicalPosition(finalZ)
  File "/home/pi/oprint/lib/python3.9/site-packages/octoprint_excluderegion/AxisPosition.py", line 156, in setLogicalPosition
    self.current = self.logicalToNative(position)
  File "/home/pi/oprint/lib/python3.9/site-packages/octoprint_excluderegion/AxisPosition.py", line 192, in logicalToNative
    value += self.current
TypeError: unsupported operand type(s) for +=: 'float' and 'NoneType'