diff --git a/plugins/GCodeProfileReader/GCodeProfileReader.py b/plugins/GCodeProfileReader/GCodeProfileReader.py index 5dcea88aed..1e649b7dd4 100644 --- a/plugins/GCodeProfileReader/GCodeProfileReader.py +++ b/plugins/GCodeProfileReader/GCodeProfileReader.py @@ -22,7 +22,7 @@ class GCodeProfileReader(ProfileReader): # It can only read settings with the same version as the version it was # written with. If the file format is changed in a way that breaks reverse # compatibility, increment this version number! - version = 1 + version = 2 ## Dictionary that defines how characters are escaped when embedded in # g-code. @@ -73,18 +73,14 @@ class GCodeProfileReader(ProfileReader): serialized = pattern.sub(lambda m: GCodeProfileReader.escape_characters[re.escape(m.group(0))], serialized) Logger.log("i", "Serialized the following from %s: %s" %(file_name, repr(serialized))) - # Create an empty profile - the id will be changed later + # Create an empty profile - the id and name will be changed by the ContainerRegistry profile = InstanceContainer("") - profile.addMetaDataEntry("type", "quality") try: profile.deserialize(serialized) except Exception as e: # Not a valid g-code file. Logger.log("e", "Unable to serialise the profile: %s", str(e)) return None - #Creating a unique name using the filename of the GCode - new_name = catalog.i18nc("@label", "Custom profile (%s)") %(os.path.splitext(os.path.basename(file_name))[0]) - profile.setName(new_name) - profile._id = new_name + profile.addMetaDataEntry("type", "quality") return profile diff --git a/plugins/GCodeWriter/GCodeWriter.py b/plugins/GCodeWriter/GCodeWriter.py index d304f0d046..4eb1f89134 100644 --- a/plugins/GCodeWriter/GCodeWriter.py +++ b/plugins/GCodeWriter/GCodeWriter.py @@ -23,7 +23,7 @@ class GCodeWriter(MeshWriter): # It can only read settings with the same version as the version it was # written with. If the file format is changed in a way that breaks reverse # compatibility, increment this version number! - version = 1 + version = 2 ## Dictionary that defines how characters are escaped when embedded in # g-code. @@ -68,23 +68,21 @@ class GCodeWriter(MeshWriter): prefix = ";SETTING_" + str(GCodeWriter.version) + " " # The prefix to put before each line. prefix_length = len(prefix) - all_settings = InstanceContainer("G-code-imported-profile") #Create a new 'profile' with ALL settings so that the slice can be precisely reproduced. - all_settings.setDefinition(settings.getBottom()) - for key in settings.getAllKeys(): - all_settings.setProperty(key, "value", settings.getProperty(key, "value")) #Just copy everything over to the setting instance. - serialised = all_settings.serialize() + global_stack = Application.getInstance().getGlobalContainerStack() + container_with_profile = global_stack.findContainer({"type": "quality"}) + serialized = container_with_profile.serialize() # Escape characters that have a special meaning in g-code comments. pattern = re.compile("|".join(GCodeWriter.escape_characters.keys())) # Perform the replacement with a regular expression. - serialised = pattern.sub(lambda m: GCodeWriter.escape_characters[re.escape(m.group(0))], serialised) + serialized = pattern.sub(lambda m: GCodeWriter.escape_characters[re.escape(m.group(0))], serialized) # Introduce line breaks so that each comment is no longer than 80 characters. Prepend each line with the prefix. result = "" # Lines have 80 characters, so the payload of each line is 80 - prefix. - for pos in range(0, len(serialised), 80 - prefix_length): - result += prefix + serialised[pos : pos + 80 - prefix_length] + "\n" - serialised = result + for pos in range(0, len(serialized), 80 - prefix_length): + result += prefix + serialized[pos : pos + 80 - prefix_length] + "\n" + serialized = result - return serialised \ No newline at end of file + return serialized \ No newline at end of file diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index f19a20c2b0..2751173a1c 100644 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -55,7 +55,7 @@ class SliceInfo(Extension): print_information = Application.getInstance().getPrintInformation() material_radius = 0.5 * global_container_stack.getProperty("material_diameter", "value") - # TODO; Send material per extruder instead of mashing it on a pile + # TODO: Send material per extruder instead of mashing it on a pile material_used = math.pi * material_radius * material_radius * sum(print_information.materialAmounts) #Volume of all materials used # Get model information (bounding boxes, hashes and transformation matrix) diff --git a/resources/definitions/bq_hephestos_2.def.json b/resources/definitions/bq_hephestos_2.def.json index 374e41f93c..51777ff83e 100644 --- a/resources/definitions/bq_hephestos_2.def.json +++ b/resources/definitions/bq_hephestos_2.def.json @@ -14,7 +14,7 @@ }, "overrides": { - "machine_start_gcode": { "default_value": "; -- START GCODE --\nM800 ; Custom GCODE to fire start print procedure\nM109 S{material_print_temperature} ;Makes sure the temperature is correct before printing\n; -- end of START GCODE --" }, + "machine_start_gcode": { "default_value": "; -- START GCODE --\nM104 S{material_print_temperature} ; Heat up extruder while leveling\nM800 ; Custom GCODE to fire start print procedure\nM109 S{material_print_temperature} ; Makes sure the temperature is correct before printing\n; -- end of START GCODE --" }, "machine_end_gcode": { "default_value": "; -- END GCODE --\nM801 ; Custom GCODE to fire end print procedure\n; -- end of END GCODE --" }, "machine_width": { "default_value": 210 }, "machine_depth": { "default_value": 297 },