diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 2a83fa0d51..2e44a60deb 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -773,9 +773,8 @@ class MachineManager(QObject): old_material = self._active_container_stack.material if old_variant: self.blurSettings.emit() - variant_index = self._active_container_stack.getContainerIndex(old_variant) - self._active_container_stack.replaceContainer(variant_index, containers[0]) - Logger.log("d", "Active variant changed") + self._active_container_stack.variant = containers[0] + Logger.log("d", "Active variant changed to {active_variant_id}".format(active_variant_id = containers[0].getId())) preferred_material = None if old_material: preferred_material_name = old_material.getName() diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index 56d0d5e17f..5a84642db5 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -380,10 +380,6 @@ Cura.MachineAction } } currentIndex: machineExtruderCountProvider.properties.value - 1 - Component.onCompleted: - { - //manager.setMachineExtruderCount(1); - } onActivated: { manager.setMachineExtruderCount(index + 1); diff --git a/plugins/UltimakerMachineActions/UM2UpgradeSelection.py b/plugins/UltimakerMachineActions/UM2UpgradeSelection.py new file mode 100644 index 0000000000..6c972efbf0 --- /dev/null +++ b/plugins/UltimakerMachineActions/UM2UpgradeSelection.py @@ -0,0 +1,65 @@ +# Copyright (c) 2017 Ultimaker B.V. +# Uranium is released under the terms of the AGPLv3 or higher. + +from UM.Settings.ContainerRegistry import ContainerRegistry +from UM.Settings.InstanceContainer import InstanceContainer +from cura.MachineAction import MachineAction +from PyQt5.QtCore import pyqtSlot, pyqtSignal, pyqtProperty + +from UM.i18n import i18nCatalog +from UM.Application import Application +from UM.Util import parseBool +catalog = i18nCatalog("cura") + +import UM.Settings.InstanceContainer + + +## The Ultimaker 2 can have a few revisions & upgrades. +class UM2UpgradeSelection(MachineAction): + def __init__(self): + super().__init__("UM2UpgradeSelection", catalog.i18nc("@action", "Select upgrades")) + self._qml_url = "UM2UpgradeSelectionMachineAction.qml" + + self._container_registry = ContainerRegistry.getInstance() + + def _reset(self): + self.hasVariantsChanged.emit() + + hasVariantsChanged = pyqtSignal() + + @pyqtProperty(bool, notify = hasVariantsChanged) + def hasVariants(self): + global_container_stack = Application.getInstance().getGlobalContainerStack() + if global_container_stack: + return parseBool(global_container_stack.getMetaDataEntry("has_variants", "false")) + + @pyqtSlot(bool) + def setHasVariants(self, has_variants = True): + global_container_stack = Application.getInstance().getGlobalContainerStack() + if global_container_stack: + variant_container = global_container_stack.variant + variant_index = global_container_stack.getContainerIndex(variant_container) + + if has_variants: + if "has_variants" in global_container_stack.getMetaData(): + global_container_stack.setMetaDataEntry("has_variants", True) + else: + global_container_stack.addMetaDataEntry("has_variants", True) + + # Set the variant container to a sane default + empty_container = ContainerRegistry.getInstance().getEmptyInstanceContainer() + if type(variant_container) == type(empty_container): + search_criteria = { "type": "variant", "definition": "ultimaker2", "id": "*0.4*" } + containers = self._container_registry.findInstanceContainers(**search_criteria) + if containers: + global_container_stack.variant = containers[0] + else: + # The metadata entry is stored in an ini, and ini files are parsed as strings only. + # Because any non-empty string evaluates to a boolean True, we have to remove the entry to make it False. + if "has_variants" in global_container_stack.getMetaData(): + global_container_stack.removeMetaDataEntry("has_variants") + + # Set the variant container to an empty variant + global_container_stack.variant = ContainerRegistry.getInstance().getEmptyInstanceContainer() + + Application.getInstance().globalContainerStackChanged.emit() diff --git a/plugins/UltimakerMachineActions/UM2UpgradeSelectionMachineAction.qml b/plugins/UltimakerMachineActions/UM2UpgradeSelectionMachineAction.qml new file mode 100644 index 0000000000..d59686e34e --- /dev/null +++ b/plugins/UltimakerMachineActions/UM2UpgradeSelectionMachineAction.qml @@ -0,0 +1,52 @@ +// Copyright (c) 2016 Ultimaker B.V. +// Cura is released under the terms of the AGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 + +import UM 1.2 as UM +import Cura 1.0 as Cura + + +Cura.MachineAction +{ + anchors.fill: parent; + Item + { + id: upgradeSelectionMachineAction + anchors.fill: parent + + Label + { + id: pageTitle + width: parent.width + text: catalog.i18nc("@title", "Select Printer Upgrades") + wrapMode: Text.WordWrap + font.pointSize: 18; + } + + Label + { + id: pageDescription + anchors.top: pageTitle.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height + width: parent.width + wrapMode: Text.WordWrap + text: catalog.i18nc("@label","Please select any upgrades made to this Ultimaker 2"); + } + + CheckBox + { + anchors.top: pageDescription.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height + + text: catalog.i18nc("@label", "Olsson Block") + checked: manager.hasVariants + onClicked: manager.setHasVariants(checked) + } + + UM.I18nCatalog { id: catalog; name: "cura"; } + } +} \ No newline at end of file diff --git a/plugins/UltimakerMachineActions/__init__.py b/plugins/UltimakerMachineActions/__init__.py index fb0b2b1f64..996026ace2 100644 --- a/plugins/UltimakerMachineActions/__init__.py +++ b/plugins/UltimakerMachineActions/__init__.py @@ -5,6 +5,7 @@ from . import BedLevelMachineAction from . import UpgradeFirmwareMachineAction from . import UMOCheckupMachineAction from . import UMOUpgradeSelection +from . import UM2UpgradeSelection from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") @@ -21,4 +22,10 @@ def getMetaData(): } def register(app): - return { "machine_action": [BedLevelMachineAction.BedLevelMachineAction(), UpgradeFirmwareMachineAction.UpgradeFirmwareMachineAction(), UMOCheckupMachineAction.UMOCheckupMachineAction(), UMOUpgradeSelection.UMOUpgradeSelection()]} + return { "machine_action": [ + BedLevelMachineAction.BedLevelMachineAction(), + UpgradeFirmwareMachineAction.UpgradeFirmwareMachineAction(), + UMOCheckupMachineAction.UMOCheckupMachineAction(), + UMOUpgradeSelection.UMOUpgradeSelection(), + UM2UpgradeSelection.UM2UpgradeSelection() + ]} diff --git a/resources/definitions/alya3dp.def.json b/resources/definitions/alya3dp.def.json new file mode 100644 index 0000000000..a0e9f03fbb --- /dev/null +++ b/resources/definitions/alya3dp.def.json @@ -0,0 +1,61 @@ +{ + "id": "alya3dp", + "name": "ALYA", + "version": 2, + "inherits": "fdmprinter", + "metadata": { + "visible": true, + "author": "ALYA", + "manufacturer": "ALYA", + "category": "Other", + "file_formats": "text/x-gcode" + }, + + "overrides": { + "machine_width": { + "default_value": 100 + }, + "machine_height": { + "default_value": 133 + }, + "machine_depth": { + "default_value": 100 + }, + "machine_center_is_zero": { + "default_value": false + }, + "machine_nozzle_size": { + "default_value": 0.4 + }, + "machine_head_shape_min_x": { + "default_value": 75 + }, + "machine_head_shape_min_y": { + "default_value": 18 + }, + "machine_head_shape_max_x": { + "default_value": 18 + }, + "machine_head_shape_max_y": { + "default_value": 35 + }, + "machine_nozzle_gantry_distance": { + "default_value": 55 + }, + "machine_nozzle_offset_x_1": { + "default_value": 18 + }, + "machine_nozzle_offset_y_1": { + "default_value": 0 + }, + "machine_gcode_flavor": { + "default_value": "RepRap" + }, + "machine_start_gcode": { + "default_value": ";Sliced at: {day} {date} {time}\n;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}\n;Print time: {print_time}\n;Filament used: {filament_amount}m {filament_weight}g\n;Filament cost: {filament_cost}\n;M190 S{print_bed_temperature} ;Uncomment to add your own bed temperature line\n;M109 S{print_temperature} ;Uncomment to add your own temperature line\nG21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to max endstops\nG1 Z115.0 F{travel_speed} ;move th e platform up 20mm\nG28 Z0 ;move Z to max endstop\nG1 Z15.0 F{travel_speed} ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E3 ;extrude 3mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F{travel_speed}\nM301 H1 P26.38 I2.57 D67.78\n;Put printing message on LCD screen\nM117 Printing..." + }, + "machine_end_gcode": { + "default_value": ";End GCode\nM104 S0 ;extruder heater off\nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nG28 Z0\nM84 ;steppers off\nG90 ;absolute positioning\n;{profile_string}" + } + } +} \ No newline at end of file diff --git a/resources/definitions/custom.def.json b/resources/definitions/custom.def.json index f8201b265c..8f15f00a0f 100644 --- a/resources/definitions/custom.def.json +++ b/resources/definitions/custom.def.json @@ -22,12 +22,5 @@ "7": "custom_extruder_8" }, "first_start_actions": ["MachineSettingsAction"] - }, - "overrides": - { - "machine_extruder_count": - { - "default_value": 1 - } } } diff --git a/resources/definitions/ultimaker2.def.json b/resources/definitions/ultimaker2.def.json index a52075fe5e..5b2f339589 100644 --- a/resources/definitions/ultimaker2.def.json +++ b/resources/definitions/ultimaker2.def.json @@ -15,7 +15,8 @@ "platform_texture": "Ultimaker2backplate.png", "platform_offset": [9, 0, 0], "has_materials": false, - "supported_actions":["UpgradeFirmware"] + "first_start_actions": ["UM2UpgradeSelection"], + "supported_actions":["UM2UpgradeSelection", "UpgradeFirmware"] }, "overrides": { "machine_name": { "default_value": "Ultimaker 2" }, diff --git a/resources/definitions/ultimaker2_plus.def.json b/resources/definitions/ultimaker2_plus.def.json index 5b1c7909ba..d8169b9abb 100644 --- a/resources/definitions/ultimaker2_plus.def.json +++ b/resources/definitions/ultimaker2_plus.def.json @@ -16,6 +16,7 @@ "has_materials": true, "has_machine_materials": true, "has_machine_quality": true, + "first_start_actions": [], "supported_actions":["UpgradeFirmware"] }, diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index dbb15028cb..ec187cef91 100755 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -468,7 +468,7 @@ Rectangle acceptedButtons: Qt.NoButton } - onClicked: + onCheckedChanged: { var index = 0; if (checked) diff --git a/resources/variants/ultimaker2_0.25.inst.cfg b/resources/variants/ultimaker2_0.25.inst.cfg new file mode 100644 index 0000000000..9d59e47b89 --- /dev/null +++ b/resources/variants/ultimaker2_0.25.inst.cfg @@ -0,0 +1,12 @@ +[general] +name = 0.25 mm +version = 2 +definition = ultimaker2 + +[metadata] +author = Ultimaker +type = variant + +[values] +machine_nozzle_size = 0.25 +machine_nozzle_tip_outer_diameter = 0.8 diff --git a/resources/variants/ultimaker2_0.4.inst.cfg b/resources/variants/ultimaker2_0.4.inst.cfg new file mode 100644 index 0000000000..7ebcbb69b7 --- /dev/null +++ b/resources/variants/ultimaker2_0.4.inst.cfg @@ -0,0 +1,12 @@ +[general] +name = 0.4 mm +version = 2 +definition = ultimaker2 + +[metadata] +author = Ultimaker +type = variant + +[values] +machine_nozzle_size = 0.4 +machine_nozzle_tip_outer_diameter = 1.05 diff --git a/resources/variants/ultimaker2_0.6.inst.cfg b/resources/variants/ultimaker2_0.6.inst.cfg new file mode 100644 index 0000000000..accf507750 --- /dev/null +++ b/resources/variants/ultimaker2_0.6.inst.cfg @@ -0,0 +1,12 @@ +[general] +name = 0.6 mm +version = 2 +definition = ultimaker2 + +[metadata] +author = Ultimaker +type = variant + +[values] +machine_nozzle_size = 0.6 +machine_nozzle_tip_outer_diameter = 1.25 diff --git a/resources/variants/ultimaker2_0.8.inst.cfg b/resources/variants/ultimaker2_0.8.inst.cfg new file mode 100644 index 0000000000..97452046cb --- /dev/null +++ b/resources/variants/ultimaker2_0.8.inst.cfg @@ -0,0 +1,12 @@ +[general] +name = 0.8 mm +version = 2 +definition = ultimaker2 + +[metadata] +author = Ultimaker +type = variant + +[values] +machine_nozzle_size = 0.8 +machine_nozzle_tip_outer_diameter = 1.35