UltiMaker uses functional, analytical and tracking cookies. Tracking cookies enhance your experience on our website and may also collect your personal data outside of Ultimaker websites. If you agree with the use of tracking cookies, click “I agree, continue browsing”. You can withdraw your consent at any time. If you do not consent with the use of tracking cookies, click “Refuse”. You can find more information about cookies on our Privacy and Cookie Policy page.
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.
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