Merge branch 'master' of github.com:Ultimaker/Cura

This commit is contained in:
Mark 2018-03-21 10:26:34 +01:00
commit f9e5f58240
7 changed files with 61 additions and 20 deletions

View File

@ -238,7 +238,16 @@ class BuildVolume(SceneNode):
# Group nodes should override the _outside_buildarea property of their children. # Group nodes should override the _outside_buildarea property of their children.
for group_node in group_nodes: for group_node in group_nodes:
for child_node in group_node.getAllChildren(): children = group_node.getAllChildren()
# Check if one or more children are non-printable and if so, set the parent as non-printable:
for child_node in children:
if child_node.isOutsideBuildArea():
group_node.setOutsideBuildArea(True)
break
# Apply results of the check to all children of the group:
for child_node in children:
child_node.setOutsideBuildArea(group_node.isOutsideBuildArea()) child_node.setOutsideBuildArea(group_node.isOutsideBuildArea())
## Update the outsideBuildArea of a single node, given bounds or current build volume ## Update the outsideBuildArea of a single node, given bounds or current build volume

View File

@ -358,8 +358,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
machine_name = self._getMachineNameFromSerializedStack(serialized) machine_name = self._getMachineNameFromSerializedStack(serialized)
stacks = self._container_registry.findContainerStacks(name = machine_name, type = "machine") stacks = self._container_registry.findContainerStacks(name = machine_name, type = "machine")
self._is_same_machine_type = True self._is_same_machine_type = True
existing_global_stack = None
if stacks: if stacks:
global_stack = stacks[0] global_stack = stacks[0]
existing_global_stack = global_stack
containers_found_dict["machine"] = True containers_found_dict["machine"] = True
# Check if there are any changes at all in any of the container stacks. # Check if there are any changes at all in any of the container stacks.
id_list = self._getContainerIdListFromSerialized(serialized) id_list = self._getContainerIdListFromSerialized(serialized)
@ -495,8 +497,16 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
if machine_conflict and not self._is_same_machine_type: if machine_conflict and not self._is_same_machine_type:
machine_conflict = False machine_conflict = False
is_printer_group = False
if machine_conflict:
group_name = existing_global_stack.getMetaDataEntry("connect_group_name")
if group_name is not None:
is_printer_group = True
machine_name = group_name
# Show the dialog, informing the user what is about to happen. # Show the dialog, informing the user what is about to happen.
self._dialog.setMachineConflict(machine_conflict) self._dialog.setMachineConflict(machine_conflict)
self._dialog.setIsPrinterGroup(is_printer_group)
self._dialog.setQualityChangesConflict(quality_changes_conflict) self._dialog.setQualityChangesConflict(quality_changes_conflict)
self._dialog.setMaterialConflict(material_conflict) self._dialog.setMaterialConflict(material_conflict)
self._dialog.setHasVisibleSettingsField(has_visible_settings_string) self._dialog.setHasVisibleSettingsField(has_visible_settings_string)

View File

@ -49,6 +49,7 @@ class WorkspaceDialog(QObject):
self._material_labels = [] self._material_labels = []
self._extruders = [] self._extruders = []
self._objects_on_plate = False self._objects_on_plate = False
self._is_printer_group = False
machineConflictChanged = pyqtSignal() machineConflictChanged = pyqtSignal()
qualityChangesConflictChanged = pyqtSignal() qualityChangesConflictChanged = pyqtSignal()
@ -66,6 +67,16 @@ class WorkspaceDialog(QObject):
machineTypeChanged = pyqtSignal() machineTypeChanged = pyqtSignal()
variantTypeChanged = pyqtSignal() variantTypeChanged = pyqtSignal()
extrudersChanged = pyqtSignal() extrudersChanged = pyqtSignal()
isPrinterGroupChanged = pyqtSignal()
@pyqtProperty(bool, notify = isPrinterGroupChanged)
def isPrinterGroup(self) -> bool:
return self._is_printer_group
def setIsPrinterGroup(self, value: bool):
if value != self._is_printer_group:
self._is_printer_group = value
self.isPrinterGroupChanged.emit()
@pyqtProperty(str, notify=variantTypeChanged) @pyqtProperty(str, notify=variantTypeChanged)
def variantType(self): def variantType(self):

View File

@ -108,7 +108,22 @@ UM.Dialog
text: catalog.i18nc("@info:tooltip", "How should the conflict in the machine be resolved?") text: catalog.i18nc("@info:tooltip", "How should the conflict in the machine be resolved?")
ComboBox ComboBox
{ {
model: resolveStrategiesModel model: ListModel
{
Component.onCompleted:
{
append({"key": "override", "label": catalog.i18nc("@action:ComboBox option", "Update") + " " + manager.machineName});
append({"key": "new", "label": catalog.i18nc("@action:ComboBox option", "Create new")});
}
}
Connections
{
target: manager
onMachineNameChanged:
{
machineResolveComboBox.model.get(0).label = catalog.i18nc("@action:ComboBox option", "Update") + " " + manager.machineName;
}
}
textRole: "label" textRole: "label"
id: machineResolveComboBox id: machineResolveComboBox
width: parent.width width: parent.width
@ -141,7 +156,7 @@ UM.Dialog
height: childrenRect.height height: childrenRect.height
Label Label
{ {
text: catalog.i18nc("@action:label", "Name") text: catalog.i18nc("@action:label", manager.isPrinterGroup ? "Printer Group" : "Printer Name")
width: (parent.width / 3) | 0 width: (parent.width / 3) | 0
} }
Label Label

View File

@ -197,10 +197,6 @@ class StartSliceJob(Job):
if getattr(node, "_outside_buildarea", False) and not is_non_printing_mesh: if getattr(node, "_outside_buildarea", False) and not is_non_printing_mesh:
continue continue
#node_position = node.callDecoration("getActiveExtruderPosition")
#if not stack.extruders[str(node_position)].isEnabled:
# continue
temp_list.append(node) temp_list.append(node)
if not is_non_printing_mesh: if not is_non_printing_mesh:
has_printing_mesh = True has_printing_mesh = True
@ -243,7 +239,7 @@ class StartSliceJob(Job):
for group in filtered_object_groups: for group in filtered_object_groups:
group_message = self._slice_message.addRepeatedMessage("object_lists") group_message = self._slice_message.addRepeatedMessage("object_lists")
if group[0].getParent().callDecoration("isGroup"): if group[0].getParent() is not None and group[0].getParent().callDecoration("isGroup"):
self._handlePerObjectSettings(group[0].getParent(), group_message) self._handlePerObjectSettings(group[0].getParent(), group_message)
for object in group: for object in group:
mesh_data = object.getMeshData() mesh_data = object.getMeshData()

View File

@ -12,6 +12,7 @@ import numpy as np
from UM.Logger import Logger from UM.Logger import Logger
from UM.Application import Application from UM.Application import Application
import re import re
from cura.Settings.ExtruderManager import ExtruderManager
def _getValue(line, key, default=None): def _getValue(line, key, default=None):
""" """
@ -90,9 +91,9 @@ class Stretcher():
""" """
Computes the new X and Y coordinates of all g-code steps Computes the new X and Y coordinates of all g-code steps
""" """
Logger.log("d", "Post stretch with line width = " + str(self.line_width) Logger.log("d", "Post stretch with line width " + str(self.line_width)
+ "mm wide circle stretch = " + str(self.wc_stretch)+ "mm" + "mm wide circle stretch " + str(self.wc_stretch)+ "mm"
+ "and push wall stretch = " + str(self.pw_stretch) + "mm") + " and push wall stretch " + str(self.pw_stretch) + "mm")
retdata = [] retdata = []
layer_steps = [] layer_steps = []
current = GCodeStep(0) current = GCodeStep(0)
@ -282,7 +283,7 @@ class Stretcher():
dmin_tri is the minimum distance between two consecutive points dmin_tri is the minimum distance between two consecutive points
of an acceptable triangle of an acceptable triangle
""" """
dmin_tri = self.line_width / 2.0 dmin_tri = 0.5
iextra_base = np.floor_divide(len(orig_seq), 3) # Nb of extra points iextra_base = np.floor_divide(len(orig_seq), 3) # Nb of extra points
ibeg = 0 # Index of first point of the triangle ibeg = 0 # Index of first point of the triangle
iend = 0 # Index of the third point of the triangle iend = 0 # Index of the third point of the triangle
@ -325,9 +326,10 @@ class Stretcher():
relpos = 0.5 # To avoid division by zero or precision loss relpos = 0.5 # To avoid division by zero or precision loss
projection = (pos_before[ibeg] + relpos * (pos_after[iend] - pos_before[ibeg])) projection = (pos_before[ibeg] + relpos * (pos_after[iend] - pos_before[ibeg]))
dist_from_proj = np.sqrt(((projection - step) ** 2).sum(0)) dist_from_proj = np.sqrt(((projection - step) ** 2).sum(0))
if dist_from_proj > 0.001: # Move central point only if points are not aligned if dist_from_proj > 0.0003: # Move central point only if points are not aligned
modif_seq[i] = (step - (self.wc_stretch / dist_from_proj) modif_seq[i] = (step - (self.wc_stretch / dist_from_proj)
* (projection - step)) * (projection - step))
return return
def wideTurn(self, orig_seq, modif_seq): def wideTurn(self, orig_seq, modif_seq):
@ -411,8 +413,6 @@ class Stretcher():
modif_seq[ibeg] = modif_seq[ibeg] + xperp * self.pw_stretch modif_seq[ibeg] = modif_seq[ibeg] + xperp * self.pw_stretch
elif not materialleft and materialright: elif not materialleft and materialright:
modif_seq[ibeg] = modif_seq[ibeg] - xperp * self.pw_stretch modif_seq[ibeg] = modif_seq[ibeg] - xperp * self.pw_stretch
if materialleft and materialright:
modif_seq[ibeg] = orig_seq[ibeg] # Surrounded by walls, don't move
# Setup part of the stretch plugin # Setup part of the stretch plugin
class Stretch(Script): class Stretch(Script):
@ -437,7 +437,7 @@ class Stretch(Script):
"description": "Distance by which the points are moved by the correction effect in corners. The higher this value, the higher the effect", "description": "Distance by which the points are moved by the correction effect in corners. The higher this value, the higher the effect",
"unit": "mm", "unit": "mm",
"type": "float", "type": "float",
"default_value": 0.08, "default_value": 0.1,
"minimum_value": 0, "minimum_value": 0,
"minimum_value_warning": 0, "minimum_value_warning": 0,
"maximum_value_warning": 0.2 "maximum_value_warning": 0.2
@ -448,7 +448,7 @@ class Stretch(Script):
"description": "Distance by which the points are moved by the correction effect when two lines are nearby. The higher this value, the higher the effect", "description": "Distance by which the points are moved by the correction effect when two lines are nearby. The higher this value, the higher the effect",
"unit": "mm", "unit": "mm",
"type": "float", "type": "float",
"default_value": 0.08, "default_value": 0.1,
"minimum_value": 0, "minimum_value": 0,
"minimum_value_warning": 0, "minimum_value_warning": 0,
"maximum_value_warning": 0.2 "maximum_value_warning": 0.2
@ -463,7 +463,7 @@ class Stretch(Script):
the returned string is the list of modified g-code instructions the returned string is the list of modified g-code instructions
""" """
stretcher = Stretcher( stretcher = Stretcher(
Application.getInstance().getGlobalContainerStack().getProperty("line_width", "value") ExtruderManager.getInstance().getActiveExtruderStack().getProperty("machine_nozzle_size", "value")
, self.getSettingValueByKey("wc_stretch"), self.getSettingValueByKey("pw_stretch")) , self.getSettingValueByKey("wc_stretch"), self.getSettingValueByKey("pw_stretch"))
return stretcher.execute(data) return stretcher.execute(data)

View File

@ -111,12 +111,12 @@ UM.Dialog
height: childrenRect.height height: childrenRect.height
Label Label
{ {
text: catalog.i18nc("@action:label", "Name") text: catalog.i18nc("@action:label", Cura.MachineManager.activeMachineNetworkGroupName != "" ? "Printer Group" : "Name")
width: (parent.width / 3) | 0 width: (parent.width / 3) | 0
} }
Label Label
{ {
text: Cura.MachineManager.activeMachineName text: Cura.MachineManager.activeMachineNetworkGroupName != "" ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName
width: (parent.width / 3) | 0 width: (parent.width / 3) | 0
} }
} }