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

This commit is contained in:
Jaime van Kessel 2016-11-22 13:13:57 +01:00
commit f3bb45da50
2 changed files with 54 additions and 8 deletions

View file

@ -7,6 +7,7 @@ from UM.Scene.Camera import Camera
from UM.Math.Vector import Vector from UM.Math.Vector import Vector
from UM.Math.Quaternion import Quaternion from UM.Math.Quaternion import Quaternion
from UM.Math.AxisAlignedBox import AxisAlignedBox from UM.Math.AxisAlignedBox import AxisAlignedBox
from UM.Math.Matrix import Matrix
from UM.Resources import Resources from UM.Resources import Resources
from UM.Scene.ToolHandle import ToolHandle from UM.Scene.ToolHandle import ToolHandle
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
@ -877,8 +878,18 @@ class CuraApplication(QtApplication):
Logger.log("d", "mergeSelected: Exception:", e) Logger.log("d", "mergeSelected: Exception:", e)
return return
# Compute the center of the objects when their origins are aligned. meshes = [node.getMeshData() for node in group_node.getAllChildren() if node.getMeshData()]
object_centers = [node.getMeshData().getCenterPosition().scale(node.getScale()) for node in group_node.getAllChildren() if node.getMeshData()]
# Compute the center of the objects
object_centers = []
# Forget about the translation that the original objects have
zero_translation = Matrix(data=numpy.zeros(3))
for mesh, node in zip(meshes, group_node.getChildren()):
transformation = node.getLocalTransformation()
transformation.setTranslation(zero_translation)
transformed_mesh = mesh.getTransformed(transformation)
center = transformed_mesh.getCenterPosition()
object_centers.append(center)
if object_centers and len(object_centers) > 0: if object_centers and len(object_centers) > 0:
middle_x = sum([v.x for v in object_centers]) / len(object_centers) middle_x = sum([v.x for v in object_centers]) / len(object_centers)
middle_y = sum([v.y for v in object_centers]) / len(object_centers) middle_y = sum([v.y for v in object_centers]) / len(object_centers)
@ -886,10 +897,16 @@ class CuraApplication(QtApplication):
offset = Vector(middle_x, middle_y, middle_z) offset = Vector(middle_x, middle_y, middle_z)
else: else:
offset = Vector(0, 0, 0) offset = Vector(0, 0, 0)
# Move each node to the same position. # Move each node to the same position.
for center, node in zip(object_centers, group_node.getChildren()): for mesh, node in zip(meshes, group_node.getChildren()):
# Align the object and also apply the offset to center it inside the group. transformation = node.getLocalTransformation()
node.setPosition(center - offset) transformation.setTranslation(zero_translation)
transformed_mesh = mesh.getTransformed(transformation)
# Align the object around its zero position
# and also apply the offset to center it inside the group.
node.setPosition(-transformed_mesh.getZeroPosition() - offset)
# Use the previously found center of the group bounding box as the new location of the group # Use the previously found center of the group bounding box as the new location of the group
group_node.setPosition(group_node.getBoundingBox().center) group_node.setPosition(group_node.getBoundingBox().center)

View file

@ -1190,6 +1190,34 @@
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": true "settable_per_extruder": true
}, },
"material_initial_print_temperature":
{
"label": "Initial Printing Temperature",
"description": "The minimal temperature while heating up to the Printing Temperature at which printing can already start.",
"unit": "°C",
"type": "float",
"default_value": 190,
"minimum_value": "-273.15",
"minimum_value_warning": "material_standby_temperature",
"maximum_value_warning": "material_print_temperature",
"enabled": "machine_gcode_flavor != \"UltiGCode\"",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"material_final_print_temperature":
{
"label": "Final Printing Temperature",
"description": "The temperature to which to already start cooling down just before the end of printing.",
"unit": "°C",
"type": "float",
"default_value": 180,
"minimum_value": "-273.15",
"minimum_value_warning": "material_standby_temperature",
"maximum_value_warning": "material_print_temperature",
"enabled": "machine_gcode_flavor != \"UltiGCode\"",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"material_flow_temp_graph": "material_flow_temp_graph":
{ {
"label": "Flow Temperature Graph", "label": "Flow Temperature Graph",
@ -1211,6 +1239,7 @@
"default_value": 0.5, "default_value": 0.5,
"minimum_value": "0", "minimum_value": "0",
"maximum_value_warning": "10.0", "maximum_value_warning": "10.0",
"maximum_value": "machine_nozzle_heat_up_speed",
"enabled": "False", "enabled": "False",
"comments": "old enabled function: material_flow_dependent_temperature or machine_extruder_count > 1", "comments": "old enabled function: material_flow_dependent_temperature or machine_extruder_count > 1",
"settable_per_mesh": false, "settable_per_mesh": false,
@ -3734,7 +3763,7 @@
"meshfix_union_all": "meshfix_union_all":
{ {
"label": "Union Overlapping Volumes", "label": "Union Overlapping Volumes",
"description": "Ignore the internal geometry arising from overlapping volumes and print the volumes as one. This may cause internal cavities to disappear.", "description": "Ignore the internal geometry arising from overlapping volumes within a mesh and print the volumes as one. This may cause unintended internal cavities to disappear.",
"type": "bool", "type": "bool",
"default_value": true, "default_value": true,
"settable_per_mesh": true "settable_per_mesh": true
@ -3766,7 +3795,7 @@
"carve_multiple_volumes": "carve_multiple_volumes":
{ {
"label": "Remove Mesh Intersection", "label": "Remove Mesh Intersection",
"description": "Remove areas where multiple objects are overlapping with each other. This may be used if merged dual material objects overlap with each other.", "description": "Remove areas where multiple meshes are overlapping with each other. This may be used if merged dual material objects overlap with each other.",
"type": "bool", "type": "bool",
"default_value": true, "default_value": true,
"value": "machine_extruder_count > 1", "value": "machine_extruder_count > 1",
@ -3777,7 +3806,7 @@
"alternate_carve_order": "alternate_carve_order":
{ {
"label": "Alternate Mesh Removal", "label": "Alternate Mesh Removal",
"description": "With every layer switch from which model intersecting volumes are removed, so that the overlapping volumes become interwoven.", "description": "Switch to which mesh intersecting volumes will belong with every layer, so that the overlapping meshes become interwoven. Turning this setting off will cause one of the meshes to obtain all of the volume in the overlap, while it is removed from the other meshes.",
"type": "bool", "type": "bool",
"default_value": true, "default_value": true,
"enabled": "carve_multiple_volumes", "enabled": "carve_multiple_volumes",