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

Feature request. Exclude Region via single frame gcode viewer for larger prints #10

Open TheZeroBeast opened 6 years ago

TheZeroBeast commented 6 years ago

I have found that I can't load the code viewer when this plugin is actually needed as my print file is 80MB or above.

Can I propose either to view the first layer or 10 instead of the either file, it wouldn't be hard to add exclude regions on this view even on a mobile browser.

bradcfisher commented 5 years ago

Thanks for the feedback. I'm not sure that feature would fall within the responsibility of the exclude region plugin, though it may be possible to implement as you describe via modification to the viewer itself.

Modifying the gcode viewer to do that would require a reasonably large amount of effort. I believe that the way it currently works is to first download the entire file and then parse/analyze it in the browser. It probably would be possible to only retain the first few layers from the file (or possibly a few layers around the current print height), though that would probably still require processing the entire file. It may reduce memory usage, and allow less capable devices to add exclude regions using those layers, though it would still take about the same amount of time to analyze the file. Since only a few layers would be retained in memory, it would also require the gcode viewer to reload the file in order to display any other layers that were not retained in memory.

As a workaround for devices with a reasonably large amount of RAM available to the browser, have you tried experimenting with Octoprint's "GCode Visualizer file size threshold" settings? You could theoretically increase the file size permitted for the GCode viewer, though if the file is too large the viewer may run out of memory.

image