Jump to content

PartySausage

Member
  • Posts

    30
  • Joined

  • Last visited

Community Answers

  1. PartySausage's post in Using GCode Documentation Post Processing Script with Ender Thumbnail Generator was marked as the answer   
    I hadn't realised that the version from CalibrationShapes was newer than the HTMLCuraSettings version so I copied the newer version over & modified that version in line with your suggestions. You're not wrong when you mentioned the script files are very picky about the layout formatting🤬
     
    Your 2nd suggestion works with that version, appending the info to the end of the file with the added benefit 
     
    With that version I was also able to get your original suggestion of using layer = data[1] to work, which positioned the documented settings after the section with the ;FLAVOR: Marlin, however in this location it was causing some problems with display of the layer info in the Mintion App when printing via my BeagleCam. As I really wanted to have the documented settings near the top of the GCode file I thought I'd dig a bit deeper into the cause.
     
    I worked out that offending line was :
     
     #   layer_height
      replace_string = replace_string + self.GetDataExtruder(extruder_id,"layer_height")
     
    which documented to the following in the GCode file:
    ; Layer Height                                           : 0.20 mm
     
    I tested by removing this line & the layer info was displayed correctly. I presumed the BeagleCam must have been looking for a line with ; layer with the first occurrence in the GCode file usually being ;LAYER_COUNT:xx and this being declared further down the GCode file so with the documented setting line not containing the total layers the BeagleCam wasn't identifying the total layers correctly.
     
    I think I've found a way to over come this with a couple of script tweaks....
     
    The first was to append each documented setting with a '>', which needed to be done in two places to give for example  ;> Layer Height                                           : 0.20 mm
     
        def SetSpace(self,key,dec=0):
            dec_line = " " * int(dec)
            string_val = dec_line + str(key)
            new_line = "\n;> " + '{:55}'.format(string_val) + ": "
            return new_line
        def SetSect(self,key):
            new_line = "\n;>  + '{:-^78}'.format(str(key))
            return new_line
    # Get de value and Label and format the text
     
    However just doing this the total layers displayed in the BeagleCam app was the actual total layers + 1 so I made another tweak, which extracted the  ;LAYER_COUNT:xx line from the GCode file & appended it to the GCode before the documented settings, which seems to work a treat.
     
            layer_count_string = ""
     
            for layer in data:
                layer_index = data.index(layer)
                lines = layer.split("\n")
                for line in lines:
                    if line.startswith(";LAYER_COUNT:"):
                        layer_count_string = line
     
            replace_string = "\n;"
            replace_string = replace_string + "\n" + layer_count_string
            replace_string = replace_string + "\n;"
     
    I've attached my modified file & a sample GCode file if you want to have a look, cheers for the pointers
     
    GCodeDocumentation.zip layer = data[1] TEST.gcode
×
×
  • Create New...