Jump to content

Cura Plugin - Display Filename and Layer on LCD


RadioDoc

Recommended Posts

Posted (edited) · Cura Plugin - Display Filename and Layer on LCD

I've been poking around at the Display Filename And Layer On LCD plugin because it wasn't functioning properly with my FLSUN FL-K Base Delta (it would display the text string and layer, but not the number).  For whatever reason, Marlin bugfix-1.1.x didn't like showing any text after the colon, and after a bit of trial and error, I figured out where to remove the colon that was preventing the layer number from popping up on the LCD.  That got me to thinking about how to get the plugin to display the current layer and the total number of layers.  Unfortunately, my knowledge of python is non-existent, and while I know enough from other languages (namely VBA), what I can't figure out is how to get the total number of layers from the application.  Can anyone point me to the documentation or toss me a text string of what I need to use?

Specifically, I'm looking at line 42 of DisplayFilenameAndLayerOnLCD.py, and want to edit it to "display_text = lcd_text + str(i) + total_layers", where total_layers is a string containing either "/" or " of " and the total layer count for the print.  I just need to figure out how to get the total layer count.  I can see that it's generated when I look at the gcode, but what is the variable that defines that?

Edited by RadioDoc
clarity
  • Link to post
    Share on other sites

    • 4 months later...
    Posted · Cura Plugin - Display Filename and Layer on LCD
        def execute(self, data):
            if self.getSettingValueByKey("name") != "":
                name = self.getSettingValueByKey("name")
            else:
                name = Application.getInstance().getPrintInformation().jobName
            lcd_text = "M117 " + " layer %d/%d"
            i = 1
            layers = 0
            for layer in data:
                display_text = lcd_text % (i, layers)
                layer_index = data.index(layer)
                lines = layer.split("\n")
                for line in lines:
                    if line.startswith(";LAYER:"):
                        line_index = lines.index(line)
                        lines.insert(line_index + 1, display_text)
                        i += 1
                    elif line.startswith(";LAYER_COUNT:"):
                        layers = int(line[13:])
    
    
                final_lines = "\n".join(lines)
                data[layer_index] = final_lines
                
            return data

    Starts at layer 1 isntead of 0
    Extracts the layercount from the gcode.

  • Link to post
    Share on other sites

    • 5 months later...
    Posted · Cura Plugin - Display Filename and Layer on LCD

    Hi RadioDoc. Unless I'm mistaken (which is very possible) you are looking for the variable  max_layer.  I have other issues with this plug-in, which I'll raise in a separate post. hope thius helps. I note this is an old post, so you've probably sorted it by now.

  • Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • UltiMaker Cura 5.7 stable released
        Cura 5.7 is here and it brings a handy new workflow improvement when using Thingiverse and Cura together, as well as additional capabilities for Method series printers, and a powerful way of sharing print settings using new printer-agnostic project files! Read on to find out about all of these improvements and more. 
         
          • Like
        • 13 replies
      • S-Line Firmware 8.3.0 was released Nov. 20th on the "Latest" firmware branch.
        (Sorry, was out of office when this released)

        This update is for...
        All UltiMaker S series  
        New features
         
        Temperature status. During print preparation, the temperatures of the print cores and build plate will be shown on the display. This gives a better indication of the progress and remaining wait time. Save log files in paused state. It is now possible to save the printer's log files to USB if the currently active print job is paused. Previously, the Dump logs to USB option was only enabled if the printer was in idle state. Confirm print removal via Digital Factory. If the printer is connected to the Digital Factory, it is now possible to confirm the removal of a previous print job via the Digital Factory interface. This is useful in situations where the build plate is clear, but the operator forgot to select Confirm removal on the printer’s display. Visit this page for more information about this feature.
          • Like
        • 0 replies
    ×
    ×
    • Create New...