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

This commit is contained in:
Jaime van Kessel 2017-06-30 13:51:17 +02:00
commit 782dea040a
6 changed files with 28 additions and 7 deletions

View file

@ -45,7 +45,6 @@ Please checkout [cura-build](https://github.com/Ultimaker/cura-build)
Third party plugins
-------------
* [Print Cost Calculator](https://github.com/nallath/PrintCostCalculator): Calculates weight and monetary cost of your print.
* [Post Processing Plugin](https://github.com/nallath/PostProcessingPlugin): Allows for post-processing scripts to run on g-code.
* [Barbarian Plugin](https://github.com/nallath/BarbarianPlugin): Simple scale tool for imperial to metric.
* [X3G Writer](https://github.com/Ghostkeeper/X3GWriter): Adds support for exporting X3G files.

View file

@ -218,20 +218,25 @@ class ContainerManager(QObject):
entries = entry_name.split("/")
entry_name = entries.pop()
sub_item_changed = False
if entries:
root_name = entries.pop(0)
root = container.getMetaDataEntry(root_name)
item = root
for entry in entries:
for _ in range(len(entries)):
item = item.get(entries.pop(0), { })
if item[entry_name] != entry_value:
sub_item_changed = True
item[entry_name] = entry_value
entry_name = root_name
entry_value = root
container.setMetaDataEntry(entry_name, entry_value)
if sub_item_changed: #If it was only a sub-item that has changed then the setMetaDataEntry won't correctly notice that something changed, and we must manually signal that the metadata changed.
container.metaDataChanged.emit(container)
return True

View file

@ -49,6 +49,8 @@ class MaterialManager(QObject):
if button == "Undo":
container_manager = ContainerManager.getInstance()
container_manager.setContainerMetaDataEntry(self._material_diameter_warning_message.material_id, "properties/diameter", self._material_diameter_warning_message.previous_diameter)
approximate_previous_diameter = str(round(float(self._material_diameter_warning_message.previous_diameter)))
container_manager.setContainerMetaDataEntry(self._material_diameter_warning_message.material_id, "approximate_diameter", approximate_previous_diameter)
message.hide()
else:
Logger.log("w", "Unknown button action for material diameter warning message: {action}".format(action = button))

View file

@ -44,6 +44,14 @@ class GcodeStartEndFormatter(Formatter):
## Job class that builds up the message of scene data to send to CuraEngine.
class StartSliceJob(Job):
## Meshes that are sent to the engine regardless of being outside of the
# build volume.
#
# If these settings are True for any mesh, the build volume is ignored.
# Note that Support Mesh is not in here because it actually generates
# g-code in the volume of the mesh.
_not_printed_mesh_settings = {"anti_overhang_mesh", "infill_mesh", "cutting_mesh"}
def __init__(self, slice_message):
super().__init__()
@ -132,7 +140,8 @@ class StartSliceJob(Job):
temp_list = []
for node in DepthFirstIterator(self._scene.getRoot()):
if type(node) is SceneNode and node.getMeshData() and node.getMeshData().getVertices() is not None:
if not getattr(node, "_outside_buildarea", False):
if not getattr(node, "_outside_buildarea", False)\
or (node.callDecoration("getStack") and any(node.callDecoration("getStack").getProperty(setting, "value") for setting in self._not_printed_mesh_settings)):
temp_list.append(node)
Job.yieldThread()

View file

@ -169,9 +169,11 @@ TabView
// This does not use a SettingPropertyProvider, because we need to make the change to all containers
// which derive from the same base_file
var old_diameter = Cura.ContainerManager.getContainerProperty(base.containerId, "material_diameter", "value").toString();
base.setMetaDataEntry("approximate_diameter", properties.approximate_diameter, Math.round(value).toString());
var old_approximate_diameter = Cura.ContainerManager.getContainerMetaDataEntry(base.containerId, "approximate_diameter");
base.setMetaDataEntry("approximate_diameter", old_approximate_diameter, Math.round(value).toString());
base.setMetaDataEntry("properties/diameter", properties.diameter, value);
if (Cura.MachineManager.filterMaterialsByMachine && properties.approximate_diameter != Cura.MachineManager.activeMachine.approximateMaterialDiameter)
var new_approximate_diameter = Cura.ContainerManager.getContainerMetaDataEntry(base.containerId, "approximate_diameter");
if (Cura.MachineManager.filterMaterialsByMachine && new_approximate_diameter != Cura.MachineManager.activeMachine.approximateMaterialDiameter)
{
Cura.MaterialManager.showMaterialWarningMessage(base.containerId, old_diameter);
}

View file

@ -12,6 +12,7 @@ from UM.Settings.InstanceContainer import InstanceContainer #To test against the
from UM.Settings.SettingInstance import InstanceState
import UM.Settings.ContainerRegistry
import UM.Settings.ContainerStack
import UM.Settings.SettingDefinition #To add settings to the definition.
## Fake container registry that always provides all containers you ask of.
@pytest.yield_fixture()
@ -96,11 +97,14 @@ def test_addExtruder(global_stack):
#Exceptional cases.
(0, 0),
(-10.1, -10),
(-1, -1)
(-1, -1),
(9000.1, 9000)
])
def test_approximateMaterialDiameter(diameter, approximate_diameter, global_stack):
global_stack.definition = DefinitionContainer(container_id = "TestDefinition")
global_stack.definition._metadata["material_diameter"] = str(diameter)
material_diameter = UM.Settings.SettingDefinition.SettingDefinition(key = "material_diameter", container = global_stack.definition)
material_diameter.addSupportedProperty("value", UM.Settings.SettingDefinition.DefinitionPropertyType.Any, default = diameter)
global_stack.definition.definitions.append(material_diameter)
assert float(global_stack.approximateMaterialDiameter) == approximate_diameter
## Tests getting the material diameter when there is no material diameter.