Просмотр исходного кода

Merge branch 'master' into top_most_skin_feature

Tim Kuipers 7 лет назад
Родитель
Сommit
2a758c85e7

+ 10 - 16
cura/BuildVolume.py

@@ -904,6 +904,7 @@ class BuildVolume(SceneNode):
         if not self._global_container_stack:
             return 0
         container_stack = self._global_container_stack
+        used_extruders = ExtruderManager.getInstance().getUsedExtruderStacks()
 
         # If we are printing one at a time, we need to add the bed adhesion size to the disallowed areas of the objects
         if container_stack.getProperty("print_sequence", "value") == "one_at_a_time":
@@ -914,24 +915,18 @@ class BuildVolume(SceneNode):
             skirt_distance = self._getSettingFromAdhesionExtruder("skirt_gap")
             skirt_line_count = self._getSettingFromAdhesionExtruder("skirt_line_count")
             bed_adhesion_size = skirt_distance + (skirt_line_count * self._getSettingFromAdhesionExtruder("skirt_brim_line_width")) * self._getSettingFromAdhesionExtruder("initial_layer_line_width_factor") / 100.0
-            if len(ExtruderManager.getInstance().getUsedExtruderStacks()) > 1:
-                adhesion_extruder_nr = int(self._global_container_stack.getProperty("adhesion_extruder_nr", "value"))
-                extruder_values = ExtruderManager.getInstance().getAllExtruderValues("skirt_brim_line_width")
-                line_width_factors = ExtruderManager.getInstance().getAllExtruderValues("initial_layer_line_width_factor")
-                del extruder_values[adhesion_extruder_nr]  # Remove the value of the adhesion extruder nr.
-                del line_width_factors[adhesion_extruder_nr]
-                for i in range(min(len(extruder_values), len(line_width_factors))):
-                    bed_adhesion_size += extruder_values[i] * line_width_factors[i] / 100.0
+            if len(used_extruders) > 1:
+                for extruder_stack in used_extruders:
+                    bed_adhesion_size += extruder_stack.getProperty("skirt_brim_line_width", "value") * extruder_stack.getProperty("initial_layer_line_width_factor", "value") / 100.0
+                #We don't create an additional line for the extruder we're printing the skirt with.
+                bed_adhesion_size -= self._getSettingFromAdhesionExtruder("skirt_brim_line_width", "value") * self._getSettingFromAdhesionExtruder("initial_layer_line_width_factor", "value") / 100.0
         elif adhesion_type == "brim":
             bed_adhesion_size = self._getSettingFromAdhesionExtruder("brim_line_count") * self._getSettingFromAdhesionExtruder("skirt_brim_line_width") * self._getSettingFromAdhesionExtruder("initial_layer_line_width_factor") / 100.0
             if self._global_container_stack.getProperty("machine_extruder_count", "value") > 1:
-                adhesion_extruder_nr = int(self._global_container_stack.getProperty("adhesion_extruder_nr", "value"))
-                extruder_values = ExtruderManager.getInstance().getAllExtruderValues("skirt_brim_line_width")
-                line_width_factors = ExtruderManager.getInstance().getAllExtruderValues("initial_layer_line_width_factor")
-                del extruder_values[adhesion_extruder_nr]  # Remove the value of the adhesion extruder nr.
-                del line_width_factors[adhesion_extruder_nr]
-                for i in range(min(len(extruder_values), len(line_width_factors))):
-                    bed_adhesion_size += extruder_values[i] * line_width_factors[i] / 100.0
+                for extruder_stack in used_extruders:
+                    bed_adhesion_size += extruder_stack.getProperty("skirt_brim_line_width", "value") * extruder_stack.getProperty("initial_layer_line_width_factor", "value") / 100.0
+                #We don't create an additional line for the extruder we're printing the brim with.
+                bed_adhesion_size -= self._getSettingFromAdhesionExtruder("skirt_brim_line_width", "value") * self._getSettingFromAdhesionExtruder("initial_layer_line_width_factor", "value") / 100.0
         elif adhesion_type == "raft":
             bed_adhesion_size = self._getSettingFromAdhesionExtruder("raft_margin")
         elif adhesion_type == "none":
@@ -951,7 +946,6 @@ class BuildVolume(SceneNode):
 
         move_from_wall_radius = 0  # Moves that start from outer wall.
         move_from_wall_radius = max(move_from_wall_radius, max(self._getSettingFromAllExtruders("infill_wipe_dist")))
-        used_extruders = ExtruderManager.getInstance().getUsedExtruderStacks()
         avoid_enabled_per_extruder = [stack.getProperty("travel_avoid_other_parts","value") for stack in used_extruders]
         travel_avoid_distance_per_extruder = [stack.getProperty("travel_avoid_distance", "value") for stack in used_extruders]
         for avoid_other_parts_enabled, avoid_distance in zip(avoid_enabled_per_extruder, travel_avoid_distance_per_extruder): #For each extruder (or just global).

+ 28 - 0
cura/PrinterOutputDevice.py

@@ -65,6 +65,11 @@ class PrinterOutputDevice(QObject, OutputDevice):
         self._monitor_view_qml_path = ""
         self._monitor_component = None
         self._monitor_item = None
+
+        self._control_view_qml_path = ""
+        self._control_component = None
+        self._control_item = None
+
         self._qml_context = None
 
     def requestWrite(self, nodes, file_name = None, filter_by_machine = False, file_handler = None):
@@ -131,6 +136,29 @@ class PrinterOutputDevice(QObject, OutputDevice):
 
         return self._monitor_item
 
+    @pyqtProperty(QObject, constant=True)
+    def controlItem(self):
+        if not self._control_component:
+            self._createControlViewFromQML()
+
+        return self._control_item
+
+    def _createControlViewFromQML(self):
+        path = QUrl.fromLocalFile(self._control_view_qml_path)
+
+        # Because of garbage collection we need to keep this referenced by python.
+        self._control_component = QQmlComponent(Application.getInstance()._engine, path)
+
+        # Check if the context was already requested before (Printer output device might have multiple items in the future)
+        if self._qml_context is None:
+            self._qml_context = QQmlContext(Application.getInstance()._engine.rootContext())
+            self._qml_context.setContextProperty("OutputDevice", self)
+
+        self._control_item = self._control_component.create(self._qml_context)
+        if self._control_item is None:
+            Logger.log("e", "QQmlComponent status %s", self._control_component.status())
+            Logger.log("e", "QQmlComponent error string %s", self._control_component.errorString())
+
     def _createMonitorViewFromQML(self):
         path = QUrl.fromLocalFile(self._monitor_view_qml_path)
 

+ 33 - 13
cura/Settings/ExtruderManager.py

@@ -434,19 +434,39 @@ class ExtruderManager(QObject):
                 extruder_stack_id = self.extruderIds["0"]
             used_extruder_stack_ids.add(extruder_stack_id)
 
-            #Get whether any of them use support.
-            per_mesh_stack = mesh.callDecoration("getStack")
-            if per_mesh_stack:
-                support_enabled |= per_mesh_stack.getProperty("support_enable", "value")
-                support_bottom_enabled |= per_mesh_stack.getProperty("support_bottom_enable", "value")
-                support_roof_enabled |= per_mesh_stack.getProperty("support_roof_enable", "value")
-            else: #Take the setting from the build extruder stack.
-                extruder_stack = container_registry.findContainerStacks(id = extruder_stack_id)[0]
-                support_enabled |= extruder_stack.getProperty("support_enable", "value")
-                support_bottom_enabled |= extruder_stack.getProperty("support_bottom_enable", "value")
-                support_roof_enabled |= extruder_stack.getProperty("support_roof_enable", "value")
-
-        #The support extruders.
+            # Get whether any of them use support.
+            stack_to_use = mesh.callDecoration("getStack")  # if there is a per-mesh stack, we use it
+            if not stack_to_use:
+                # if there is no per-mesh stack, we use the build extruder for this mesh
+                stack_to_use = container_registry.findContainerStacks(id = extruder_stack_id)[0]
+
+            support_enabled |= stack_to_use.getProperty("support_enable", "value")
+            support_bottom_enabled |= stack_to_use.getProperty("support_bottom_enable", "value")
+            support_roof_enabled |= stack_to_use.getProperty("support_roof_enable", "value")
+
+            # Check limit to extruders
+            limit_to_extruder_feature_list = ["wall_extruder_nr",
+                                              "wall_0_extruder_nr",
+                                              "wall_x_extruder_nr",
+                                              "top_bottom_extruder_nr",
+                                              "infill_extruder_nr",
+                                              ]
+            wall_extruder_nr = None
+            for extruder_nr_feature_name in limit_to_extruder_feature_list:
+                extruder_nr = int(global_stack.getProperty(extruder_nr_feature_name, "value"))
+                if extruder_nr == -1:
+                    # outer and inner wall extruder numbers should first inherit from the wall extruder number
+                    if extruder_nr_feature_name in ["wall_0_extruder_nr", "wall_x_extruder_nr"]:
+                        extruder_nr = wall_extruder_nr
+                    else:
+                        extruder_nr = 0
+
+                used_extruder_stack_ids.add(self.extruderIds[str(extruder_nr)])
+
+                if extruder_nr_feature_name == "wall_extruder_nr":
+                    wall_extruder_nr = extruder_nr
+
+        # Check support extruders
         if support_enabled:
             used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_infill_extruder_nr", "value"))])
             used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_extruder_nr_layer_0", "value"))])

+ 6 - 14
plugins/3MFReader/ThreeMFWorkspaceReader.py

@@ -254,12 +254,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
             for index, container_id in enumerate(id_list):
                 # take into account the old empty container IDs
                 container_id = self._old_empty_profile_id_dict.get(container_id, container_id)
-                # HACK: there used to be 5, now we have one more 5 - definition changes
-                if len(id_list) == 6 and index == 5:
-                    if global_stack.getContainer(5).getId() != "empty":
-                        machine_conflict = True
-                        break
-                    index = 6
                 if global_stack.getContainer(index).getId() != container_id:
                     machine_conflict = True
                     break
@@ -295,12 +289,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
                 for index, container_id in enumerate(id_list):
                     # take into account the old empty container IDs
                     container_id = self._old_empty_profile_id_dict.get(container_id, container_id)
-                    # HACK: there used to be 5, now we have one more 5 - definition changes
-                    if len(id_list) == 6 and index == 5:
-                        if existing_extruder_stack.getContainer(5).getId() != "empty":
-                            machine_conflict = True
-                            break
-                        index = 6
                     if existing_extruder_stack.getContainer(index).getId() != container_id:
                         machine_conflict = True
                         break
@@ -875,6 +863,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
             container_list = container_string.split(",")
             container_ids = [container_id for container_id in container_list if container_id != ""]
 
+        # HACK: there used to be 6 containers numbering from 0 to 5 in a stack,
+        #       now we have 7: index 5 becomes "definition_changes"
+        if len(container_ids) == 6:
+            # Hack; We used to not save the definition changes. Fix this.
+            container_ids.insert(5, "empty")
+
         return container_ids
 
     def _getMachineNameFromSerializedStack(self, serialized):
@@ -887,5 +881,3 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
         metadata = data.iterfind("./um:metadata/um:name/um:label", {"um": "http://www.ultimaker.com/material"})
         for entry in metadata:
             return entry.text
-        pass
-

+ 4 - 5
plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py

@@ -179,7 +179,6 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
 
         self._compressing_print = False
         self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "MonitorItem.qml")
-
         printer_type = self._properties.get(b"machine", b"").decode("utf-8")
         if printer_type.startswith("9511"):
             self._updatePrinterType("ultimaker3_extended")
@@ -645,7 +644,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
 
         # Only check for mistakes if there is material length information.
         if print_information.materialLengths:
-            # Check if print cores / materials are loaded at all. Any failure in these results in an Error.
+            # Check if PrintCores / materials are loaded at all. Any failure in these results in an Error.
             for index in range(0, self._num_extruders):
                 if index < len(print_information.materialLengths) and print_information.materialLengths[index] != 0:
                     if self._json_printer_state["heads"][0]["extruders"][index]["hotend"]["id"] == "":
@@ -677,7 +676,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
                     if variant:
                         if variant.getName() != core_name:
                             Logger.log("w", "Extruder %s has a different Cartridge (%s) as Cura (%s)", index + 1, core_name, variant.getName())
-                            warnings.append(i18n_catalog.i18nc("@label", "Different print core (Cura: {0}, Printer: {1}) selected for extruder {2}".format(variant.getName(), core_name, index + 1)))
+                            warnings.append(i18n_catalog.i18nc("@label", "Different PrintCore (Cura: {0}, Printer: {1}) selected for extruder {2}".format(variant.getName(), core_name, index + 1)))
 
                     material = extruder_manager.getExtruderStack(index).findContainer({"type": "material"})
                     if material:
@@ -699,7 +698,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
                         is_offset_calibrated = True
 
                     if not is_offset_calibrated:
-                        warnings.append(i18n_catalog.i18nc("@label", "Print core {0} is not properly calibrated. XY calibration needs to be performed on the printer.").format(index + 1))
+                        warnings.append(i18n_catalog.i18nc("@label", "PrintCore {0} is not properly calibrated. XY calibration needs to be performed on the printer.").format(index + 1))
         else:
             Logger.log("w", "There was no material usage found. No check to match used material with machine is done.")
 
@@ -1176,7 +1175,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
             i18n_catalog.i18nc("@label",
                 "Would you like to use your current printer configuration in Cura?"),
             i18n_catalog.i18nc("@label",
-                "The print cores and/or materials on your printer differ from those within your current project. For the best result, always slice for the print cores and materials that are inserted in your printer."),
+                "The PrintCores and/or materials on your printer differ from those within your current project. For the best result, always slice for the PrintCores and materials that are inserted in your printer."),
             buttons=QMessageBox.Yes + QMessageBox.No,
             icon=QMessageBox.Question,
             callback=callback

+ 1 - 1
plugins/VersionUpgrade/VersionUpgrade26to27/__init__.py

@@ -53,7 +53,7 @@ def getMetaData():
             },
             "definition_changes": {
                 "get_version": upgrade.getCfgVersion,
-                "location": {"./machine_instances"}
+                "location": {"./definition_changes"}
             }
         }
     }

+ 2 - 2
resources/definitions/cartesio.def.json

@@ -48,8 +48,8 @@
         "material_bed_temp_wait": { "default_value": false },
         "prime_tower_enable": { "default_value": true },
         "prime_tower_wall_thickness": { "resolve": 0.7 },
-        "prime_tower_position_x": { "default_value": 50 },
-        "prime_tower_position_y": { "default_value": 150 },
+        "prime_tower_position_x": { "value": "50" },
+        "prime_tower_position_y": { "value": "150" },
         "prime_blob_enable": { "default_value": false },
         "machine_max_feedrate_z": { "default_value": 20 },
         "machine_disallowed_areas": { "default_value": [

+ 3 - 1
resources/definitions/fdmprinter.def.json

@@ -4021,7 +4021,7 @@
                             "default_value": 20,
                             "minimum_value": "0",
                             "maximum_value_warning": "50 / skirt_brim_line_width",
-                            "value": "math.ceil(brim_width / skirt_brim_line_width)",
+                            "value": "math.ceil(brim_width / (skirt_brim_line_width * initial_layer_line_width_factor / 100.0))",
                             "enabled": "resolveOrValue('adhesion_type') == 'brim'",
                             "settable_per_mesh": false,
                             "settable_per_extruder": true,
@@ -4572,6 +4572,7 @@
                     "unit": "mm",
                     "enabled": "resolveOrValue('prime_tower_enable')",
                     "default_value": 200,
+                    "value": "machine_width - max(extruderValue(adhesion_extruder_nr, 'brim_width') * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 if adhesion_type == 'brim' else (extruderValue(adhesion_extruder_nr, 'raft_margin') if adhesion_type == 'raft' else (extruderValue(adhesion_extruder_nr, 'skirt_gap') if adhesion_type == 'skirt' else 0)), max(extruderValues('travel_avoid_distance'))) - max(extruderValues('support_offset')) - sum(extruderValues('skirt_brim_line_width')) * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 - 1",
                     "maximum_value": "machine_width / 2 if machine_center_is_zero else machine_width",
                     "minimum_value": "resolveOrValue('prime_tower_size') - machine_width / 2 if machine_center_is_zero else resolveOrValue('prime_tower_size')",
                     "settable_per_mesh": false,
@@ -4585,6 +4586,7 @@
                     "unit": "mm",
                     "enabled": "resolveOrValue('prime_tower_enable')",
                     "default_value": 200,
+                    "value": "machine_depth - prime_tower_size - max(extruderValue(adhesion_extruder_nr, 'brim_width') * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 if adhesion_type == 'brim' else (extruderValue(adhesion_extruder_nr, 'raft_margin') if adhesion_type == 'raft' else (extruderValue(adhesion_extruder_nr, 'skirt_gap') if adhesion_type == 'skirt' else 0)), max(extruderValues('travel_avoid_distance'))) - max(extruderValues('support_offset')) - sum(extruderValues('skirt_brim_line_width')) * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 - 1",
                     "maximum_value": "machine_depth / 2 - resolveOrValue('prime_tower_size') if machine_center_is_zero else machine_depth - resolveOrValue('prime_tower_size')",
                     "minimum_value": "machine_depth / -2 if machine_center_is_zero else 0",
                     "settable_per_mesh": false,

+ 2 - 2
resources/definitions/makeit_pro_l.def.json

@@ -72,10 +72,10 @@
             "enabled": true
         },
         "prime_tower_position_x": {
-            "default_value": 185
+            "value": "185"
         },
         "prime_tower_position_y": {
-            "default_value": 160
+            "value": "160"
         },
         "material_diameter": {
           "default_value": 1.75

+ 2 - 2
resources/definitions/makeit_pro_m.def.json

@@ -72,10 +72,10 @@
             "enabled": false
         },
         "prime_tower_position_x": {
-            "default_value": 185
+            "value": "185"
         },
         "prime_tower_position_y": {
-            "default_value": 160
+            "value": "160"
         },
         "material_diameter": {
           "default_value": 1.75

Некоторые файлы не были показаны из-за большого количества измененных файлов