LinuxCNC / linuxcnc

LinuxCNC controls CNC machines. It can drive milling machines, lathes, 3d printers, laser cutters, plasma cutters, robot arms, hexapods, and more.
http://linuxcnc.org/
GNU General Public License v2.0
1.73k stars 1.13k forks source link

Add Part Bounding box on Gcode Graphics #2896

Closed satiowadahc closed 4 months ago

satiowadahc commented 4 months ago

Replacing #2887, now rebased on master.

satiowadahc commented 4 months ago

@c-morley

        if self.state.magic_comments["disable_preview"]:
            LOG.info("Preview Disabled by comments")
            self.ui.gcodegraphics.show_program = False
            return
        elif os.stat(file_name).st_size < self.max_graphics_file_size:
            self.ui.gcodegraphics.show_program = True
        else:
            self.ui.gcodegraphics.show_program = False
            LOG.warning(f"File To Large ({os.stat(file_name).st_size/1000000} mb), Preview disabled")

This is how I use it on my GUI, opinion if this should be moved into gcode graphics or leave it to each GUI's preferences?

c-morley commented 4 months ago

As long as the max file size can be arbitrarily set relatively easily, I like consistency between the GUIs.

satiowadahc commented 4 months ago

Set a default max file size, check with INI for updated value, then add getter/setters?

c-morley commented 4 months ago

I'd think just a function to set it would be fine. A GUI then could set it if it's required, I suspect it won't happen often. What do you think?

andypugh commented 4 months ago

I have assigned this to @c-morley to decide whether to merge or not. I don't know enough to decide.

c-morley commented 4 months ago

Thank you.