mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Change imported namespace pySavitar to Savitar
Because we had to rename our Python bindings module from Savitar to pySavitar we also changed our import downstream (Cura and Uranium). But in order to limit the changes on our existing code we decided during the review that we should just import pySavitar as Savitar. Contributes to CURA-7924
This commit is contained in:
parent
47588393e8
commit
ca430c80be
2 changed files with 12 additions and 12 deletions
|
@ -1,11 +1,11 @@
|
||||||
# Copyright (c) 2021 Ultimaker B.V.
|
# Copyright (c) 2021-2022 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import zipfile
|
import zipfile
|
||||||
from typing import List, Optional, Union, TYPE_CHECKING, cast
|
from typing import List, Optional, Union, TYPE_CHECKING, cast
|
||||||
|
|
||||||
import pySavitar
|
import pySavitar as Savitar
|
||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
|
@ -90,7 +90,7 @@ class ThreeMFReader(MeshReader):
|
||||||
|
|
||||||
return temp_mat
|
return temp_mat
|
||||||
|
|
||||||
def _convertSavitarNodeToUMNode(self, savitar_node: pySavitar.SceneNode, file_name: str = "") -> Optional[SceneNode]:
|
def _convertSavitarNodeToUMNode(self, savitar_node: Savitar.SceneNode, file_name: str = "") -> Optional[SceneNode]:
|
||||||
"""Convenience function that converts a SceneNode object (as obtained from libSavitar) to a scene node.
|
"""Convenience function that converts a SceneNode object (as obtained from libSavitar) to a scene node.
|
||||||
|
|
||||||
:returns: Scene node.
|
:returns: Scene node.
|
||||||
|
@ -206,7 +206,7 @@ class ThreeMFReader(MeshReader):
|
||||||
try:
|
try:
|
||||||
archive = zipfile.ZipFile(file_name, "r")
|
archive = zipfile.ZipFile(file_name, "r")
|
||||||
self._base_name = os.path.basename(file_name)
|
self._base_name = os.path.basename(file_name)
|
||||||
parser = pySavitar.ThreeMFParser()
|
parser = Savitar.ThreeMFParser()
|
||||||
scene_3mf = parser.parse(archive.open("3D/3dmodel.model").read())
|
scene_3mf = parser.parse(archive.open("3D/3dmodel.model").read())
|
||||||
self._unit = scene_3mf.getUnit()
|
self._unit = scene_3mf.getUnit()
|
||||||
|
|
||||||
|
@ -304,4 +304,4 @@ class ThreeMFReader(MeshReader):
|
||||||
unit = "millimeter"
|
unit = "millimeter"
|
||||||
|
|
||||||
scale = conversion_to_mm[unit]
|
scale = conversion_to_mm[unit]
|
||||||
return Vector(scale, scale, scale)
|
return Vector(scale, scale, scale)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Copyright (c) 2015 Ultimaker B.V.
|
# Copyright (c) 2015-2022 Ultimaker B.V.
|
||||||
# Uranium is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from UM.Mesh.MeshWriter import MeshWriter
|
from UM.Mesh.MeshWriter import MeshWriter
|
||||||
|
@ -15,7 +15,7 @@ from cura.Snapshot import Snapshot
|
||||||
|
|
||||||
from PyQt6.QtCore import QBuffer
|
from PyQt6.QtCore import QBuffer
|
||||||
|
|
||||||
import pySavitar
|
import pySavitar as Savitar
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
import datetime
|
import datetime
|
||||||
|
@ -85,7 +85,7 @@ class ThreeMFWriter(MeshWriter):
|
||||||
if um_node.callDecoration("getBuildPlateNumber") != active_build_plate_nr:
|
if um_node.callDecoration("getBuildPlateNumber") != active_build_plate_nr:
|
||||||
return
|
return
|
||||||
|
|
||||||
savitar_node = pySavitar.SceneNode()
|
savitar_node = Savitar.SceneNode()
|
||||||
savitar_node.setName(um_node.getName())
|
savitar_node.setName(um_node.getName())
|
||||||
|
|
||||||
node_matrix = um_node.getLocalTransformation()
|
node_matrix = um_node.getLocalTransformation()
|
||||||
|
@ -169,7 +169,7 @@ class ThreeMFWriter(MeshWriter):
|
||||||
# Add thumbnail relation to _rels/.rels file
|
# Add thumbnail relation to _rels/.rels file
|
||||||
thumbnail_relation_element = ET.SubElement(relations_element, "Relationship", Target = "/Metadata/thumbnail.png", Id = "rel1", Type = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail")
|
thumbnail_relation_element = ET.SubElement(relations_element, "Relationship", Target = "/Metadata/thumbnail.png", Id = "rel1", Type = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail")
|
||||||
|
|
||||||
savitar_scene = pySavitar.Scene()
|
savitar_scene = Savitar.Scene()
|
||||||
|
|
||||||
metadata_to_store = CuraApplication.getInstance().getController().getScene().getMetaData()
|
metadata_to_store = CuraApplication.getInstance().getController().getScene().getMetaData()
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ class ThreeMFWriter(MeshWriter):
|
||||||
if savitar_node:
|
if savitar_node:
|
||||||
savitar_scene.addSceneNode(savitar_node)
|
savitar_scene.addSceneNode(savitar_node)
|
||||||
|
|
||||||
parser = pySavitar.ThreeMFParser()
|
parser = Savitar.ThreeMFParser()
|
||||||
scene_string = parser.sceneToString(savitar_scene)
|
scene_string = parser.sceneToString(savitar_scene)
|
||||||
|
|
||||||
archive.writestr(model_file, scene_string)
|
archive.writestr(model_file, scene_string)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue