mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 01:07:52 -06:00
CURA-4525 Fix load and save projects. Not storing build plates or object names yet.
This commit is contained in:
parent
be6561b575
commit
864f417723
4 changed files with 14 additions and 8 deletions
|
@ -169,7 +169,6 @@ class PrintInformation(QObject):
|
||||||
return self._print_time_message_values[self._active_build_plate]
|
return self._print_time_message_values[self._active_build_plate]
|
||||||
|
|
||||||
def _onPrintDurationMessage(self, build_plate_number, print_time, material_amounts):
|
def _onPrintDurationMessage(self, build_plate_number, print_time, material_amounts):
|
||||||
Logger.log("d", " ### print duration message for build plate %s", build_plate_number)
|
|
||||||
self._updateTotalPrintTimePerFeature(build_plate_number, print_time)
|
self._updateTotalPrintTimePerFeature(build_plate_number, print_time)
|
||||||
self.currentPrintTimeChanged.emit()
|
self.currentPrintTimeChanged.emit()
|
||||||
|
|
||||||
|
@ -276,7 +275,6 @@ class PrintInformation(QObject):
|
||||||
def _onActiveBuildPlateChanged(self):
|
def _onActiveBuildPlateChanged(self):
|
||||||
new_active_build_plate = Application.getInstance().getBuildPlateModel().activeBuildPlate
|
new_active_build_plate = Application.getInstance().getBuildPlateModel().activeBuildPlate
|
||||||
if new_active_build_plate != self._active_build_plate:
|
if new_active_build_plate != self._active_build_plate:
|
||||||
Logger.log("d", " ## active build plate changed: %s", self._active_build_plate)
|
|
||||||
self._active_build_plate = new_active_build_plate
|
self._active_build_plate = new_active_build_plate
|
||||||
|
|
||||||
self._initVariablesWithBuildPlate(self._active_build_plate)
|
self._initVariablesWithBuildPlate(self._active_build_plate)
|
||||||
|
|
|
@ -15,8 +15,8 @@ from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
from cura.Settings.ExtruderManager import ExtruderManager
|
from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
from cura.QualityManager import QualityManager
|
from cura.QualityManager import QualityManager
|
||||||
#from UM.Scene.SceneNode import SceneNode
|
from cura.Scene.CuraSceneNode import CuraSceneNode
|
||||||
from cura.Scene.CuraSceneNode import CuraSceneNode as SceneNode
|
from cura.Scene.BuildPlateDecorator import BuildPlateDecorator
|
||||||
from cura.SliceableObjectDecorator import SliceableObjectDecorator
|
from cura.SliceableObjectDecorator import SliceableObjectDecorator
|
||||||
from cura.ZOffsetDecorator import ZOffsetDecorator
|
from cura.ZOffsetDecorator import ZOffsetDecorator
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ class ThreeMFReader(MeshReader):
|
||||||
}
|
}
|
||||||
self._base_name = ""
|
self._base_name = ""
|
||||||
self._unit = None
|
self._unit = None
|
||||||
|
self._object_count = 0 # Used to name objects as there is no node name yet.
|
||||||
|
|
||||||
def _createMatrixFromTransformationString(self, transformation):
|
def _createMatrixFromTransformationString(self, transformation):
|
||||||
if transformation == "":
|
if transformation == "":
|
||||||
|
@ -78,7 +79,12 @@ class ThreeMFReader(MeshReader):
|
||||||
## Convenience function that converts a SceneNode object (as obtained from libSavitar) to a Uranium scene node.
|
## Convenience function that converts a SceneNode object (as obtained from libSavitar) to a Uranium scene node.
|
||||||
# \returns Uranium scene node.
|
# \returns Uranium scene node.
|
||||||
def _convertSavitarNodeToUMNode(self, savitar_node):
|
def _convertSavitarNodeToUMNode(self, savitar_node):
|
||||||
um_node = SceneNode()
|
self._object_count += 1
|
||||||
|
node_name = "Object %s" % self._object_count
|
||||||
|
|
||||||
|
um_node = CuraSceneNode()
|
||||||
|
um_node.addDecorator(BuildPlateDecorator(0))
|
||||||
|
um_node.setName(node_name)
|
||||||
transformation = self._createMatrixFromTransformationString(savitar_node.getTransformation())
|
transformation = self._createMatrixFromTransformationString(savitar_node.getTransformation())
|
||||||
um_node.setTransformation(transformation)
|
um_node.setTransformation(transformation)
|
||||||
mesh_builder = MeshBuilder()
|
mesh_builder = MeshBuilder()
|
||||||
|
@ -155,6 +161,7 @@ class ThreeMFReader(MeshReader):
|
||||||
|
|
||||||
def read(self, file_name):
|
def read(self, file_name):
|
||||||
result = []
|
result = []
|
||||||
|
self._object_count = 0 # Used to name objects as there is no node name yet.
|
||||||
# The base object of 3mf is a zipped archive.
|
# The base object of 3mf is a zipped archive.
|
||||||
try:
|
try:
|
||||||
archive = zipfile.ZipFile(file_name, "r")
|
archive = zipfile.ZipFile(file_name, "r")
|
||||||
|
|
|
@ -7,6 +7,7 @@ from UM.Logger import Logger
|
||||||
from UM.Math.Matrix import Matrix
|
from UM.Math.Matrix import Matrix
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
import UM.Scene.SceneNode
|
import UM.Scene.SceneNode
|
||||||
|
from cura.Scene.CuraSceneNode import CuraSceneNode
|
||||||
|
|
||||||
import Savitar
|
import Savitar
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ class ThreeMFWriter(MeshWriter):
|
||||||
## Convenience function that converts an Uranium SceneNode object to a SavitarSceneNode
|
## Convenience function that converts an Uranium SceneNode object to a SavitarSceneNode
|
||||||
# \returns Uranium Scenen node.
|
# \returns Uranium Scenen node.
|
||||||
def _convertUMNodeToSavitarNode(self, um_node, transformation = Matrix()):
|
def _convertUMNodeToSavitarNode(self, um_node, transformation = Matrix()):
|
||||||
if type(um_node) is not UM.Scene.SceneNode.SceneNode:
|
if type(um_node) not in [UM.Scene.SceneNode.SceneNode, CuraSceneNode]:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
savitar_node = Savitar.SceneNode()
|
savitar_node = Savitar.SceneNode()
|
||||||
|
|
|
@ -304,8 +304,8 @@ Item
|
||||||
Action
|
Action
|
||||||
{
|
{
|
||||||
id: arrangeAllBuildPlatesAction;
|
id: arrangeAllBuildPlatesAction;
|
||||||
text: "";
|
text: catalog.i18nc("@action:inmenu menubar:edit","Arrange All Models To All Build Plates");
|
||||||
iconName: "document-open";
|
//iconName: "document-open";
|
||||||
onTriggered: CuraApplication.arrangeObjectsToAllBuildPlates();
|
onTriggered: CuraApplication.arrangeObjectsToAllBuildPlates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue