Move 'lay flat by face' operation to Uranium.

This commit is contained in:
Remco Burema 2019-09-09 23:25:16 +02:00
parent ddcd8e40cc
commit c7bae1e8fc

View File

@ -75,39 +75,6 @@ class CuraActions(QObject):
operation.addOperation(center_operation)
operation.push()
# Rotate the selection, so that the face that the mouse-pointer is on, faces the build-plate.
@pyqtSlot()
def bottomFaceSelection(self) -> None:
selected_face = Selection.getSelectedFace()
if not selected_face:
Logger.log("e", "Bottom face operation shouldn't have been called without a selected face.")
return
original_node, face_id = selected_face
meshdata = original_node.getMeshDataTransformed()
if not meshdata or face_id < 0 or face_id > Selection.getMaxFaceSelectionId():
return
rotation_point, face_normal = meshdata.getFacePlane(face_id)
rotation_point_vector = Vector(rotation_point[0], rotation_point[1], rotation_point[2])
face_normal_vector = Vector(face_normal[0], face_normal[1], face_normal[2])
rotation_quaternion = Quaternion.rotationTo(face_normal_vector.normalized(), Vector(0.0, -1.0, 0.0))
operation = GroupedOperation()
current_node = None # type: Optional[SceneNode]
for node in Selection.getAllSelectedObjects():
current_node = node
parent_node = current_node.getParent()
while parent_node and parent_node.callDecoration("isGroup"):
current_node = parent_node
parent_node = current_node.getParent()
if current_node is None:
return
rotate_operation = RotateOperation(current_node, rotation_quaternion, rotation_point_vector)
operation.addOperation(rotate_operation)
operation.push()
## Multiply all objects in the selection
#
# \param count The number of times to multiply the selection.