diff --git a/cura/ConvexHullJob.py b/cura/ConvexHullJob.py index 9de4f13073..3832e53df6 100644 --- a/cura/ConvexHullJob.py +++ b/cura/ConvexHullJob.py @@ -25,20 +25,22 @@ class ConvexHullJob(Job): child_hull = child.callDecoration("getConvexHull") if child_hull: hull.setPoints(numpy.append(hull.getPoints(), child_hull.getPoints(), axis = 0)) - + if hull.getPoints().size < 3: self._node.callDecoration("setConvexHull", None) self._node.callDecoration("setConvexHullJob", None) return - + else: if not self._node.getMeshData(): return mesh = self._node.getMeshData() vertex_data = mesh.getTransformed(self._node.getWorldTransformation()).getVertices() + # Don't use data below 0. TODO; We need a better check for this as this gives poor results for meshes with long edges. + vertex_data = vertex_data[vertex_data[:,1]>0] hull = Polygon(numpy.rint(vertex_data[:, [0, 2]]).astype(int)) - + # First, calculate the normal convex hull around the points hull = hull.getConvexHull() diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 6e64acc4e6..e2908c9f97 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -125,7 +125,7 @@ class CuraApplication(QtApplication): t = controller.getTool("TranslateTool") if t: - t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.ZAxis]) + t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.YAxis,ToolHandle.ZAxis]) Selection.selectionChanged.connect(self.onSelectionChanged) diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py index 7f6c1df3b9..f1fc7fd0b1 100644 --- a/cura/PlatformPhysics.py +++ b/cura/PlatformPhysics.py @@ -19,6 +19,7 @@ from . import ConvexHullJob import time import threading +import copy class PlatformPhysics: def __init__(self, controller, volume): @@ -53,16 +54,21 @@ class PlatformPhysics: self._change_timer.start() continue + build_volume_bounding_box = copy.deepcopy(self._build_volume.getBoundingBox()) + build_volume_bounding_box.setBottom(-9001) # Ignore intersections with the bottom + # Mark the node as outside the build volume if the bounding box test fails. - if self._build_volume.getBoundingBox().intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection: + if build_volume_bounding_box.intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection: node._outside_buildarea = True else: node._outside_buildarea = False - # Move the node upwards if the bottom is below the build platform. + # Move it downwards if bottom is above platform move_vector = Vector() - if not Float.fuzzyCompare(bbox.bottom, 0.0): + if bbox.bottom > 0: move_vector.setY(-bbox.bottom) + #if not Float.fuzzyCompare(bbox.bottom, 0.0): + # pass#move_vector.setY(-bbox.bottom) # If there is no convex hull for the node, start calculating it and continue. if not node.getDecorator(ConvexHullDecorator): diff --git a/resources/qml/AddMachineWizard.qml b/resources/qml/AddMachineWizard.qml index 5d6608a7da..8a9070818a 100644 --- a/resources/qml/AddMachineWizard.qml +++ b/resources/qml/AddMachineWizard.qml @@ -9,8 +9,18 @@ import QtQuick.Window 2.1 import UM 1.0 as UM UM.Wizard{ - id: base + // This part checks whether there is a printer -> if not some of the functions (delete for example) are disabled + // This part is optional property bool printer: true - file: "ultimaker2.json" firstRun: printer ? false : true + + //: Add Printer dialog title + wizardTitle: qsTr("Add Printer") + + wizardPages: [ + { + title: "Add Printer", + page: "AddMachine.qml" + } + ] } diff --git a/resources/qml/WizardPages/AddMachine.qml b/resources/qml/WizardPages/AddMachine.qml index 7e69c06366..1c1b2ac6d3 100644 --- a/resources/qml/WizardPages/AddMachine.qml +++ b/resources/qml/WizardPages/AddMachine.qml @@ -5,6 +5,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 +import QtQuick.Controls.Styles 1.1 import UM 1.0 as UM import ".." @@ -12,94 +13,240 @@ import ".." ColumnLayout { id: wizardPage property string title - signal openFile(string fileName) + property int pageWidth + property int pageHeight + property var manufacturers: wizardPage.lineManufacturers() + property int manufacturerIndex: 0 + + SystemPalette{id: palette} + signal reloadModel(var newModel) signal closeWizard() + width: wizardPage.pageWidth + height: wizardPage.pageHeight + Connections { - target: rootElement + target: elementRoot onFinalClicked: {//You can add functions here that get triggered when the final button is clicked in the wizard-element saveMachine() } + onResize: { + wizardPage.width = pageWidth + wizardPage.height = pageHeight + } + } + + function lineManufacturers(manufacturer){ + var manufacturers = [] + for (var i = 0; i < UM.Models.availableMachinesModel.rowCount(); i++) { + if (UM.Models.availableMachinesModel.getItem(i).manufacturer != manufacturers[manufacturers.length - 1]){ + manufacturers.push(UM.Models.availableMachinesModel.getItem(i).manufacturer) + } + } + return manufacturers } Label { + id: title + anchors.left: parent.left + anchors.top: parent.top text: parent.title font.pointSize: 18; } Label { + id: subTitle + anchors.left: parent.left + anchors.top: title.bottom //: Add Printer wizard page description text: qsTr("Please select the type of printer:"); } ScrollView { - ListView { - id: machineList; - model: UM.Models.availableMachinesModel - delegate: RadioButton { - id:machine_button - exclusiveGroup: printerGroup; - checked: ListView.view.currentIndex == index ? true : false - text: model.name; - onClicked: { - ListView.view.currentIndex = index; + id: machinesHolder + anchors.left: parent.left + anchors.top: subTitle.bottom + implicitWidth: wizardPage.width- UM.Theme.sizes.default_margin.width + implicitHeight: wizardPage.height - subTitle.height - title.height - (machineNameHolder.height * 2) + Component { + id: machineDelegate + ColumnLayout { + id: machineLayout + spacing: 0 + anchors.left: parent.left + anchors.leftMargin: UM.Theme.sizes.standard_list_lineheight.width + function showManufacturer(){ + if (model.manufacturer == UM.Models.availableMachinesModel.getItem(index - 1).manufacturer){ + return false + } + else{ + return true + } + } + height: { + if (machineLayout.showManufacturer() & wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer) + return UM.Theme.sizes.standard_list_lineheight.height * 2 + if (wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer | machineLayout.showManufacturer()) + return UM.Theme.sizes.standard_list_lineheight.height * 1 + else + return 0 + } + Behavior on height{ + NumberAnimation { target: machineLayout; property: "height"; duration: 200} + } + Button { + id: manufacturer + property color backgroundColor: "transparent" + height: UM.Theme.sizes.standard_list_lineheight.height + visible: machineLayout.showManufacturer() + anchors.top: machineLayout.top + anchors.topMargin: 0 + text: { + if (wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer) + return model.manufacturer + " ▼" + else + return model.manufacturer + " ►" + } + style: ButtonStyle { + background: Rectangle { + id: manufacturerBackground + opacity: 0.3 + border.width: 0 + color: manufacturer.backgroundColor + height: UM.Theme.sizes.standard_list_lineheight.height + } + label: Text { + renderType: Text.NativeRendering + horizontalAlignment: Text.AlignLeft + text: control.text + color: palette.windowText + font.bold: true + } + } + MouseArea { + id: mousearea + hoverEnabled: true + anchors.fill: parent + onEntered: manufacturer.backgroundColor = palette.light + onExited: manufacturer.backgroundColor = "transparent" + onClicked: { + wizardPage.manufacturerIndex = wizardPage.manufacturers.indexOf(model.manufacturer) + machineList.currentIndex = index + } + } + } + + RadioButton { + id: machineButton + opacity: wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer ? 1 : 0 + height: wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer ? UM.Theme.sizes.standard_list_lineheight.height : 0 + anchors.top: parent.top + anchors.topMargin: machineLayout.showManufacturer() ? manufacturer.height - 5 : 0 + anchors.left: parent.left + anchors.leftMargin: UM.Theme.sizes.standard_list_lineheight.width + checked: machineList.currentIndex == index ? true : false + exclusiveGroup: printerGroup; + text: model.name + onClicked: machineList.currentIndex = index; + function getAnimationTime(time){ + if (machineButton.opacity == 0) + return time + else + return 0 + } + Label { + id: author + visible: model.author != "Ultimaker" ? true : false + height: wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer ? UM.Theme.sizes.standard_list_lineheight.height : 0 + //: Printer profile caption meaning: this profile is supported by the community + text: qsTr("community supported profile"); + opacity: wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer ? 1 : 0 + anchors.left: machineButton.right + anchors.leftMargin: UM.Theme.sizes.standard_list_lineheight.height/2 + anchors.verticalCenter: machineButton.verticalCenter + anchors.verticalCenterOffset: UM.Theme.sizes.standard_list_lineheight.height / 4 + font: UM.Theme.fonts.caption; + color: palette.mid + } + Behavior on opacity { + SequentialAnimation { + PauseAnimation { duration: machineButton.getAnimationTime(100) } + NumberAnimation { properties:"opacity"; duration: machineButton.getAnimationTime(200) } + } + } + } + + } + } + + ListView { + id: machineList + property int currentIndex: 0 + property int otherMachinesIndex: { + for (var i = 0; i < UM.Models.availableMachinesModel.rowCount(); i++) { + if (UM.Models.availableMachinesModel.getItem(i).manufacturer != "Ultimaker"){ + return i + } } } + anchors.fill: parent + model: UM.Models.availableMachinesModel + delegate: machineDelegate + focus: true } } - Label { - text: qsTr("Variation:"); + Item{ + id: machineNameHolder + height: childrenRect.height + anchors.top: machinesHolder.bottom + Label { + id: insertNameLabel + //: Add Printer wizard field label + text: qsTr("Printer Name:"); } - - ScrollView { - ListView { - id: variations_list - model: machineList.model.getItem(machineList.currentIndex).variations - delegate: RadioButton { - id: variation_radio_button - checked: ListView.view.currentIndex == index ? true : false - exclusiveGroup: variationGroup; - text: model.name; - onClicked: ListView.view.currentIndex = index; - } + TextField { + id: machineName; + anchors.top: insertNameLabel.bottom + text: machineList.model.getItem(machineList.currentIndex).name + implicitWidth: UM.Theme.sizes.standard_list_input.width } } - Label { - //: Add Printer wizard field label - text: qsTr("Printer Name:"); - } - - TextField { id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name } - Item { Layout.fillWidth: true; Layout.fillHeight: true; } ExclusiveGroup { id: printerGroup; } - ExclusiveGroup { id: variationGroup; } - function getSpecialMachineType(machineId){ - for (var i = 0; i < UM.Models.addMachinesModel.rowCount(); i++) { - if (UM.Models.addMachinesModel.getItem(i).name == machineId){ - return UM.Models.addMachinesModel.getItem(i).name - } - } - } function saveMachine(){ if(machineList.currentIndex != -1) { - UM.Models.availableMachinesModel.createMachine(machineList.currentIndex, variations_list.currentIndex, machineName.text) + UM.Models.availableMachinesModel.createMachine(machineList.currentIndex, machineName.text) + var chosenMachine = UM.Models.availableMachinesModel.getItem(machineList.currentIndex).name var originalString = "Ultimaker Original" var originalPlusString = "Ultimaker Original+" - var originalMachineType = getSpecialMachineType(originalString) - if (UM.Models.availableMachinesModel.getItem(machineList.currentIndex).name == originalMachineType){ - var variation = UM.Models.availableMachinesModel.getItem(machineList.currentIndex).variations.getItem(variations_list.currentIndex).name - if (variation == originalString || variation == originalPlusString){ - console.log(UM.Models.availableMachinesModel.getItem(machineList.currentIndex).variations.getItem(variations_list.currentIndex).type) - wizardPage.openFile(UM.Models.availableMachinesModel.getItem(machineList.currentIndex).variations.getItem(variations_list.currentIndex).type) - } + if (chosenMachine == originalString | chosenMachine == originalPlusString ){ + wizardPage.reloadModel([ + { + title: "Select Upgraded Parts", + page: "SelectUpgradedParts.qml" + }, + { + title: "Upgrade Ultimaker Firmware", + page: "UpgradeFirmware.qml" + }, + { + title: "Ultimaker Checkup", + page: "UltimakerCheckup.qml" + }, + { + title: "Bedleveling Wizard", + page: "Bedleveling.qml" + } + ] + ) } + else { wizardPage.closeWizard() } diff --git a/resources/qml/WizardPages/Bedleveling.qml b/resources/qml/WizardPages/Bedleveling.qml index eb8207b37d..218624263a 100644 --- a/resources/qml/WizardPages/Bedleveling.qml +++ b/resources/qml/WizardPages/Bedleveling.qml @@ -9,8 +9,25 @@ import QtQuick.Window 2.1 import UM 1.0 as UM ColumnLayout { + id: wizardPage property string title - anchors.fill: parent; + property int pageWidth + property int pageHeight + + SystemPalette{id: palette} + //signal openFile(string fileName) + //signal closeWizard() + + width: wizardPage.pageWidth + height: wizardPage.pageHeight + + Connections { + target: elementRoot + onResize: { + wizardPage.width = pageWidth + wizardPage.height = pageHeight + } + } Label { text: parent.title diff --git a/resources/qml/WizardPages/SelectUpgradedParts.qml b/resources/qml/WizardPages/SelectUpgradedParts.qml index eb8207b37d..48ee4d3457 100644 --- a/resources/qml/WizardPages/SelectUpgradedParts.qml +++ b/resources/qml/WizardPages/SelectUpgradedParts.qml @@ -9,8 +9,25 @@ import QtQuick.Window 2.1 import UM 1.0 as UM ColumnLayout { + id: wizardPage property string title - anchors.fill: parent; + property int pageWidth + property int pageHeight + + SystemPalette{id: palette} + //signal openFile(string fileName) + //signal closeWizard() + + width: wizardPage.pageWidth + height: wizardPage.pageHeight + + Connections { + target: elementRoot + onResize: { + wizardPage.width = pageWidth + wizardPage.height = pageHeight + } + } Label { text: parent.title @@ -18,23 +35,26 @@ ColumnLayout { } Label { - //: Add Printer wizard page description - text: qsTr("Please select the type of printer:"); + //: Add UM Original wizard page description + width: 300 + + wrapMode: Text.WordWrap + text: qsTr("To assist you in having better default settings for your Ultimaker. Cura would like to know which upgrades you have in your machine:"); } ScrollView { Layout.fillWidth: true; - - ListView { - id: machineList; - model: UM.Models.availableMachinesModel - delegate: RadioButton { - exclusiveGroup: printerGroup; - text: model.name; - onClicked: { - ListView.view.currentIndex = index; - - } + Column { + CheckBox { + text: qsTr("Breakfast") + checked: true + } + CheckBox { + text: qsTr("Lunch") + } + CheckBox { + text: qsTr("Dinner") + checked: true } } } @@ -44,7 +64,6 @@ ColumnLayout { text: qsTr("Printer Name:"); } - TextField { id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name } Item { Layout.fillWidth: true; Layout.fillHeight: true; } diff --git a/resources/qml/WizardPages/UltimakerCheckup.qml b/resources/qml/WizardPages/UltimakerCheckup.qml index eb8207b37d..abd407c825 100644 --- a/resources/qml/WizardPages/UltimakerCheckup.qml +++ b/resources/qml/WizardPages/UltimakerCheckup.qml @@ -9,7 +9,10 @@ import QtQuick.Window 2.1 import UM 1.0 as UM ColumnLayout { + id: wizardPage property string title + property int pageWidth + property int pageHeight anchors.fill: parent; Label { diff --git a/resources/qml/WizardPages/UpgradeFirmware.qml b/resources/qml/WizardPages/UpgradeFirmware.qml index 9369df6e42..ba9db19876 100644 --- a/resources/qml/WizardPages/UpgradeFirmware.qml +++ b/resources/qml/WizardPages/UpgradeFirmware.qml @@ -9,9 +9,11 @@ import QtQuick.Window 2.1 import UM 1.0 as UM ColumnLayout { + id: wizardPage property string title + property int pageWidth + property int pageHeight anchors.fill: parent; - signal openFile(string fileName) Label { text: parent.title diff --git a/resources/settings/grr_neo.json b/resources/settings/grr_neo.json index 66b1248017..67ca4754f6 100644 --- a/resources/settings/grr_neo.json +++ b/resources/settings/grr_neo.json @@ -2,7 +2,7 @@ "id": "grr_neo", "version": 1, "name": "German RepRap Neo", - "manufacturer": "German RepRap", + "manufacturer": "Other", "author": "other", "icon": "icon_ultimaker.png", "platform": "grr_neo_platform.stl", diff --git a/resources/settings/maker_starter.json b/resources/settings/maker_starter.json index 3a721684eb..be12937d28 100644 --- a/resources/settings/maker_starter.json +++ b/resources/settings/maker_starter.json @@ -6,7 +6,6 @@ "author": "Other", "icon": "icon_ultimaker2.png", "platform": "makerstarter_platform.stl", - "visible": true, "inherits": "fdmprinter.json", @@ -33,6 +32,7 @@ "machine_nozzle_head_distance": { "default": 3.0 }, "machine_nozzle_expansion_angle": { "default": 45 } }, + "categories": { "resolution": { "label": "Quality", diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index 5b247045b8..011b60983c 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -22,6 +22,11 @@ "size": 0.5, "family": "Roboto" }, + "caption": { + "size": 0.75, + "italic": true, + "family": "Roboto" + }, "sidebar_header": { "size": 0.75, "capitalize": true, @@ -120,7 +125,7 @@ "save_button_printtime_text": [12, 169, 227, 255], "save_button_background": [249, 249, 249, 255], - "message": [205, 202, 201, 255], + "message": [160, 163, 171, 255], "message_text": [35, 35, 35, 255], "tool_panel_background": [255, 255, 255, 255] @@ -144,6 +149,9 @@ "setting_unit_margin": [0.5, 0.5], "setting_text_maxwidth": [40.0, 0.0], + "standard_list_lineheight": [1.5, 1.5], + "standard_list_input": [20.0, 25.0], + "button": [4.25, 4.25], "button_icon": [2.9, 2.9], @@ -171,6 +179,9 @@ "save_button_label_margin": [0.5, 0.5], "save_button_save_to_button": [0.3, 2.7], + "modal_window_minimum": [30.0, 30.0], + "wizard_progress": [10.0, 0.0], + "message": [30.0, 5.0], "message_close": [1.25, 1.25] }