From 66aeb95e2879ec32c46785fbce5b671a95a1496f Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 14 Sep 2018 14:06:55 +0200 Subject: [PATCH 1/8] Fix opening port after baudrate detection --- plugins/USBPrinting/AutoDetectBaudJob.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/USBPrinting/AutoDetectBaudJob.py b/plugins/USBPrinting/AutoDetectBaudJob.py index f8af61c567..8b37c4b29d 100644 --- a/plugins/USBPrinting/AutoDetectBaudJob.py +++ b/plugins/USBPrinting/AutoDetectBaudJob.py @@ -77,6 +77,7 @@ class AutoDetectBaudJob(Job): self.setResult(baud_rate) Logger.log("d", "Detected baud rate {baud_rate} on serial {serial} on retry {retry} with after {time_elapsed:0.2f} seconds.".format( serial = self._serial_port, baud_rate = baud_rate, retry = retry, time_elapsed = time() - start_timeout_time)) + serial.close() # close serial port so it can be opened by the USBPrinterOutputDevice return serial.write(b"M105\n") From 816c3cbd117541b23b8f3d322a8995d10176434e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 17 Sep 2018 14:43:17 +0200 Subject: [PATCH 2/8] Fix forgotten separation between header and body I copied these over from a piece where they had a different layout. Contributes to issue CURA-5710. --- plugins/ChangeLogPlugin/ChangeLog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/ChangeLogPlugin/ChangeLog.txt b/plugins/ChangeLogPlugin/ChangeLog.txt index 9075d9be7d..0590dcde62 100755 --- a/plugins/ChangeLogPlugin/ChangeLog.txt +++ b/plugins/ChangeLogPlugin/ChangeLog.txt @@ -47,7 +47,8 @@ The support infill lines can now be rotated to increase the supporting capabilit *Minimum polygon circumference Polygons in sliced layers that have a circumference smaller than the setting value will be filtered out. Lower values lead to higher resolution meshes at the cost of increased slicing time. This setting is ideal for very tiny prints with a lot of detail, or for SLA printers. Contributed by cubiq. -*Initial layer support line distance. This setting enables the user to reduce or increase the density of the support initial layer in order to increase or reduce adhesion to the build plate and the overall strength. +*Initial layer support line distance +This setting enables the user to reduce or increase the density of the support initial layer in order to increase or reduce adhesion to the build plate and the overall strength. *Extra infill wall line count Adds extra walls around infill. Contributed by BagelOrb. From 725ea847a78415133cb07306a1c59e33606db209 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 14 Sep 2018 09:43:24 +0200 Subject: [PATCH 3/8] Add material_diameter into fdmprinter When saving a material to a file, it will save all the settings in that container, which needs to create SettingInstances for all the cached ones, and for those instances, their definitions will be retrieved from the machine definition. material_diameter is one of the settings, but it only exists in the extruder definitions, so when it tries to save a material profile, a lot of warnings/errors will occur due to the missing "material_diameter" in fdmprinter. Adding it back fixes this problem. --- resources/definitions/fdmprinter.def.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 4c87a3bcf0..6833e921da 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -77,6 +77,20 @@ "type": "str", "enabled": false }, + "material_diameter": + { + "label": "Diameter", + "description": "Adjusts the diameter of the filament used. Match this value with the diameter of the used filament.", + "unit": "mm", + "type": "float", + "default_value": 2.85, + "minimum_value": "0.0001", + "minimum_value_warning": "0.4", + "maximum_value_warning": "3.5", + "enabled": "machine_gcode_flavor != \"UltiGCode\"", + "settable_per_mesh": false, + "settable_per_extruder": true + }, "material_bed_temp_wait": { "label": "Wait for Build Plate Heatup", From e5778be8873f77da2ec50cf574440372b11d7cfb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Sep 2018 12:41:44 +0200 Subject: [PATCH 4/8] Corrections to change log One was missing. One was confusing. One was incomplete. Contributes to issue CURA-5710. --- plugins/ChangeLogPlugin/ChangeLog.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/ChangeLogPlugin/ChangeLog.txt b/plugins/ChangeLogPlugin/ChangeLog.txt index 0590dcde62..908e8d973c 100755 --- a/plugins/ChangeLogPlugin/ChangeLog.txt +++ b/plugins/ChangeLogPlugin/ChangeLog.txt @@ -35,6 +35,9 @@ Improved and updated Chinese translations. Contributed by MarmaladeForMeat. *Save project Saving the project no longer triggers the project to reslice. +*File menu +The Save option in the file menu now saves project files. The export option now saves other types of files, such as STL. + *Improved processing of overhang walls Overhang walls are detected and printed with different speeds. It will not start a perimeter on an overhanging wall. The quality of overhanging walls may be improved by printing those at a different speed. Contributed by smartavionics. @@ -65,8 +68,8 @@ New setting to modify the fan speed of bridged areas. This setting can be found *Minimum wall flow New setting to define a minimum flow for thin printed walls. Contributed by smartavionics. -*Custom support -A tool similar to the support blocker that adds cubes of support to the model manually by clicking parts of it. Contributed by Lokster. +*Custom support plugin +A tool downloadable from the toolbox, similar to the support blocker, that adds cubes of support to the model manually by clicking parts of it. Contributed by Lokster. *Quickly toggle autoslicing Adds a pause/play button to the progress bar to quickly toggle autoslicing. Contributed by fieldOfview. From ddc5d983a1625c38950d1732185fdec83bf93bad Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 18 Sep 2018 13:34:54 +0200 Subject: [PATCH 5/8] Fix single extrusion machines without an ExtruderStack CURA-5736 --- cura/Settings/CuraStackBuilder.py | 46 ++++++++++++++++++++++++++++++- cura/Settings/ExtruderManager.py | 11 ++++++-- cura/Settings/MachineManager.py | 3 +- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/cura/Settings/CuraStackBuilder.py b/cura/Settings/CuraStackBuilder.py index 12fe732e3e..802f607f20 100644 --- a/cura/Settings/CuraStackBuilder.py +++ b/cura/Settings/CuraStackBuilder.py @@ -136,6 +136,50 @@ class CuraStackBuilder: return new_global_stack + @classmethod + def createExtruderStackWithDefaultSetup(cls, global_stack: "GlobalStack", extruder_position: int) -> None: + from cura.CuraApplication import CuraApplication + application = CuraApplication.getInstance() + variant_manager = application.getVariantManager() + material_manager = application.getMaterialManager() + registry = application.getContainerRegistry() + + # get variant container for extruders + extruder_variant_container = application.empty_variant_container + extruder_variant_node = variant_manager.getDefaultVariantNode(global_stack.definition, VariantType.NOZZLE) + extruder_variant_name = None + if extruder_variant_node: + extruder_variant_container = extruder_variant_node.getContainer() + if not extruder_variant_container: + extruder_variant_container = application.empty_variant_container + extruder_variant_name = extruder_variant_container.getName() + + extruder_definition_dict = global_stack.getMetaDataEntry("machine_extruder_trains") + extruder_definition_id = extruder_definition_dict[str(extruder_position)] + extruder_definition = registry.findDefinitionContainers(id = extruder_definition_id)[0] + + # get material container for extruders + material_container = application.empty_material_container + material_node = material_manager.getDefaultMaterial(global_stack, extruder_position, extruder_variant_name, + extruder_definition = extruder_definition) + if material_node and material_node.getContainer(): + material_container = material_node.getContainer() + + new_extruder_id = registry.uniqueName(extruder_definition_id) + new_extruder = cls.createExtruderStack( + new_extruder_id, + extruder_definition = extruder_definition, + machine_definition_id = global_stack.definition.getId(), + position = extruder_position, + variant_container = extruder_variant_container, + material_container = material_container, + quality_container = application.empty_quality_container + ) + new_extruder.setNextStack(global_stack) + global_stack.addExtruder(new_extruder) + + registry.addContainer(new_extruder) + ## Create a new Extruder stack # # \param new_stack_id The ID of the new stack. @@ -157,7 +201,7 @@ class CuraStackBuilder: stack.setName(extruder_definition.getName()) stack.setDefinition(extruder_definition) - stack.setMetaDataEntry("position", position) + stack.setMetaDataEntry("position", str(position)) user_container = cls.createUserChangesContainer(new_stack_id + "_user", machine_definition_id, new_stack_id, is_global_stack = False) diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index ed7f6dd4f8..18744cd13f 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -358,8 +358,15 @@ class ExtruderManager(QObject): # "fdmextruder". We need to check a machine here so its extruder definition is correct according to this. def _fixSingleExtrusionMachineExtruderDefinition(self, global_stack: "GlobalStack") -> None: expected_extruder_definition_0_id = global_stack.getMetaDataEntry("machine_extruder_trains")["0"] - extruder_stack_0 = global_stack.extruders["0"] - if extruder_stack_0.definition.getId() != expected_extruder_definition_0_id: + extruder_stack_0 = global_stack.extruders.get("0") + + if extruder_stack_0 is None: + Logger.log("i", "No extruder stack for global stack [%s], create one", global_stack.getId()) + # Single extrusion machine without an ExtruderStack, create it + from cura.Settings.CuraStackBuilder import CuraStackBuilder + CuraStackBuilder.createExtruderStackWithDefaultSetup(global_stack, 0) + + elif extruder_stack_0.definition.getId() != expected_extruder_definition_0_id: Logger.log("e", "Single extruder printer [{printer}] expected extruder [{expected}], but got [{got}]. I'm making it [{expected}].".format( printer = global_stack.getId(), expected = expected_extruder_definition_0_id, got = extruder_stack_0.definition.getId())) container_registry = ContainerRegistry.getInstance() diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index ed543fcee1..3f918e21ba 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -367,6 +367,7 @@ class MachineManager(QObject): return global_stack = containers[0] + ExtruderManager.getInstance()._fixSingleExtrusionMachineExtruderDefinition(global_stack) if not global_stack.isValid(): # Mark global stack as invalid ConfigurationErrorMessage.getInstance().addFaultyContainers(global_stack.getId()) @@ -375,7 +376,7 @@ class MachineManager(QObject): self._global_container_stack = global_stack self._application.setGlobalContainerStack(global_stack) ExtruderManager.getInstance()._globalContainerStackChanged() - self._initMachineState(containers[0]) + self._initMachineState(global_stack) self._onGlobalContainerChanged() self.__emitChangedSignals() From 9924e3e26cc4400c9019addedfcaae523cb1e774 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 18 Sep 2018 15:08:52 +0200 Subject: [PATCH 6/8] Remove duplicated code CURA-5735 --- cura/Settings/CuraStackBuilder.py | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/cura/Settings/CuraStackBuilder.py b/cura/Settings/CuraStackBuilder.py index 802f607f20..9df95ddcdb 100644 --- a/cura/Settings/CuraStackBuilder.py +++ b/cura/Settings/CuraStackBuilder.py @@ -74,34 +74,8 @@ class CuraStackBuilder: # Create ExtruderStacks extruder_dict = machine_definition.getMetaDataEntry("machine_extruder_trains") - - for position, extruder_definition_id in extruder_dict.items(): - # Sanity check: make sure that the positions in the extruder definitions are same as in the machine - # definition - extruder_definition = registry.findDefinitionContainers(id = extruder_definition_id)[0] - position_in_extruder_def = extruder_definition.getMetaDataEntry("position") - if position_in_extruder_def != position: - ConfigurationErrorMessage.getInstance().addFaultyContainers(extruder_definition_id) - return None #Don't return any container stack then, not the rest of the extruders either. - - # get material container for extruders - material_container = application.empty_material_container - material_node = material_manager.getDefaultMaterial(new_global_stack, position, extruder_variant_name, extruder_definition = extruder_definition) - if material_node and material_node.getContainer(): - material_container = material_node.getContainer() - - new_extruder_id = registry.uniqueName(extruder_definition_id) - new_extruder = cls.createExtruderStack( - new_extruder_id, - extruder_definition = extruder_definition, - machine_definition_id = definition_id, - position = position, - variant_container = extruder_variant_container, - material_container = material_container, - quality_container = application.empty_quality_container - ) - new_extruder.setNextStack(new_global_stack) - new_global_stack.addExtruder(new_extruder) + for position in extruder_dict: + cls.createExtruderStackWithDefaultSetup(new_global_stack, position) for new_extruder in new_global_stack.extruders.values(): #Only register the extruders if we're sure that all of them are correct. registry.addContainer(new_extruder) From a33ce8178a7bb21674c984ef68f2bc9be71f4408 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 18 Sep 2018 15:53:55 +0200 Subject: [PATCH 7/8] Support mulitple bundled_packages JSON files CURA-5718 --- plugins/Toolbox/src/Toolbox.py | 4 ++-- .../{bundled_packages.json => bundled_packages/cura.json} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename resources/{bundled_packages.json => bundled_packages/cura.json} (100%) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 91984aa148..be9fe65004 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -306,8 +306,8 @@ class Toolbox(QObject, Extension): all_packages = self._package_manager.getAllInstalledPackagesInfo() if "plugin" in all_packages: # For old plugins, we only want to include the old custom plugin that were installed via the old toolbox. - # The bundled plugins will be included in the "bundled_packages.json", so the bundled plugins should be - # excluded from the old plugins list/dict. + # The bundled plugins will be included in JSON files in the "bundled_packages" folder, so the bundled + # plugins should be excluded from the old plugins list/dict. all_plugin_package_ids = set(package["package_id"] for package in all_packages["plugin"]) self._old_plugin_ids = set(plugin_id for plugin_id in self._old_plugin_ids if plugin_id not in all_plugin_package_ids) diff --git a/resources/bundled_packages.json b/resources/bundled_packages/cura.json similarity index 100% rename from resources/bundled_packages.json rename to resources/bundled_packages/cura.json From e28b662649d83194c19e32eb1e35237ee1f85d50 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 18 Sep 2018 16:04:31 +0200 Subject: [PATCH 8/8] Clean up the code a bit and update comments. Contributes to CURA-5736. --- cura/Settings/CuraStackBuilder.py | 51 +++++++++++++++++++------------ 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/cura/Settings/CuraStackBuilder.py b/cura/Settings/CuraStackBuilder.py index 9df95ddcdb..6374e6056c 100644 --- a/cura/Settings/CuraStackBuilder.py +++ b/cura/Settings/CuraStackBuilder.py @@ -15,6 +15,7 @@ from .ExtruderStack import ExtruderStack ## Contains helper functions to create new machines. class CuraStackBuilder: + ## Create a new instance of a machine. # # \param name The name of the new machine. @@ -26,7 +27,6 @@ class CuraStackBuilder: from cura.CuraApplication import CuraApplication application = CuraApplication.getInstance() variant_manager = application.getVariantManager() - material_manager = application.getMaterialManager() quality_manager = application.getQualityManager() registry = application.getContainerRegistry() @@ -46,16 +46,6 @@ class CuraStackBuilder: if not global_variant_container: global_variant_container = application.empty_variant_container - # get variant container for extruders - extruder_variant_container = application.empty_variant_container - extruder_variant_node = variant_manager.getDefaultVariantNode(machine_definition, VariantType.NOZZLE) - extruder_variant_name = None - if extruder_variant_node: - extruder_variant_container = extruder_variant_node.getContainer() - if not extruder_variant_container: - extruder_variant_container = application.empty_variant_container - extruder_variant_name = extruder_variant_container.getName() - generated_name = registry.createUniqueName("machine", "", name, machine_definition.getName()) # Make sure the new name does not collide with any definition or (quality) profile # createUniqueName() only looks at other stacks, but not at definitions or quality profiles @@ -110,6 +100,10 @@ class CuraStackBuilder: return new_global_stack + ## Create a default Extruder Stack + # + # \param global_stack The global stack this extruder refers to. + # \param extruder_position The position of the current extruder. @classmethod def createExtruderStackWithDefaultSetup(cls, global_stack: "GlobalStack", extruder_position: int) -> None: from cura.CuraApplication import CuraApplication @@ -157,16 +151,22 @@ class CuraStackBuilder: ## Create a new Extruder stack # # \param new_stack_id The ID of the new stack. - # \param definition The definition to base the new stack on. - # \param machine_definition_id The ID of the machine definition to use for - # the user container. - # \param kwargs You can add keyword arguments to specify IDs of containers to use for a specific type, for example "variant": "0.4mm" + # \param extruder_definition The definition to base the new stack on. + # \param machine_definition_id The ID of the machine definition to use for the user container. + # \param position The position the extruder occupies in the machine. + # \param variant_container The variant selected for the current extruder. + # \param material_container The material selected for the current extruder. + # \param quality_container The quality selected for the current extruder. # - # \return A new Global stack instance with the specified parameters. + # \return A new Extruder stack instance with the specified parameters. @classmethod - def createExtruderStack(cls, new_stack_id: str, extruder_definition: DefinitionContainerInterface, machine_definition_id: str, + def createExtruderStack(cls, new_stack_id: str, extruder_definition: DefinitionContainerInterface, + machine_definition_id: str, position: int, - variant_container, material_container, quality_container) -> ExtruderStack: + variant_container: "InstanceContainer", + material_container: "InstanceContainer", + quality_container: "InstanceContainer") -> ExtruderStack: + from cura.CuraApplication import CuraApplication application = CuraApplication.getInstance() registry = application.getContainerRegistry() @@ -201,9 +201,22 @@ class CuraStackBuilder: # \param kwargs You can add keyword arguments to specify IDs of containers to use for a specific type, for example "variant": "0.4mm" # # \return A new Global stack instance with the specified parameters. + + ## Create a new Global stack + # + # \param new_stack_id The ID of the new stack. + # \param definition The definition to base the new stack on. + # \param variant_container The variant selected for the current stack. + # \param material_container The material selected for the current stack. + # \param quality_container The quality selected for the current stack. + # + # \return A new Global stack instance with the specified parameters. @classmethod def createGlobalStack(cls, new_stack_id: str, definition: DefinitionContainerInterface, - variant_container, material_container, quality_container) -> GlobalStack: + variant_container: "InstanceContainer", + material_container: "InstanceContainer", + quality_container: "InstanceContainer") -> GlobalStack: + from cura.CuraApplication import CuraApplication application = CuraApplication.getInstance() registry = application.getContainerRegistry()