mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 23:15:52 +08:00
Merge branch 'master' of https://github.com/Ultimaker/Cura
This commit is contained in:
commit
4f8ac05851
@ -41,6 +41,7 @@ Third party plugins
|
|||||||
-------------
|
-------------
|
||||||
* [Print time calculator](https://github.com/nallath/PrintCostCalculator)
|
* [Print time calculator](https://github.com/nallath/PrintCostCalculator)
|
||||||
* [Post processing plugin](https://github.com/nallath/PostProcessingPlugin)
|
* [Post processing plugin](https://github.com/nallath/PostProcessingPlugin)
|
||||||
|
* [Barbarian Plugin](https://github.com/nallath/BarbarianPlugin) Simple scale tool for imperial to metric.
|
||||||
|
|
||||||
Making profiles for other printers
|
Making profiles for other printers
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
@ -83,38 +83,38 @@ class BuildVolume(SceneNode):
|
|||||||
if self._width == 0 or self._height == 0 or self._depth == 0:
|
if self._width == 0 or self._height == 0 or self._depth == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
minW = -self._width / 2
|
min_w = -self._width / 2
|
||||||
maxW = self._width / 2
|
max_w = self._width / 2
|
||||||
minH = 0.0
|
min_h = 0.0
|
||||||
maxH = self._height
|
max_h = self._height
|
||||||
minD = -self._depth / 2
|
min_d = -self._depth / 2
|
||||||
maxD = self._depth / 2
|
max_d = self._depth / 2
|
||||||
|
|
||||||
mb = MeshBuilder()
|
mb = MeshBuilder()
|
||||||
|
|
||||||
mb.addLine(Vector(minW, minH, minD), Vector(maxW, minH, minD), color = self.VolumeOutlineColor)
|
mb.addLine(Vector(min_w, min_h, min_d), Vector(max_w, min_h, min_d), color = self.VolumeOutlineColor)
|
||||||
mb.addLine(Vector(minW, minH, minD), Vector(minW, maxH, minD), color = self.VolumeOutlineColor)
|
mb.addLine(Vector(min_w, min_h, min_d), Vector(min_w, max_h, min_d), color = self.VolumeOutlineColor)
|
||||||
mb.addLine(Vector(minW, maxH, minD), Vector(maxW, maxH, minD), color = self.VolumeOutlineColor)
|
mb.addLine(Vector(min_w, max_h, min_d), Vector(max_w, max_h, min_d), color = self.VolumeOutlineColor)
|
||||||
mb.addLine(Vector(maxW, minH, minD), Vector(maxW, maxH, minD), color = self.VolumeOutlineColor)
|
mb.addLine(Vector(max_w, min_h, min_d), Vector(max_w, max_h, min_d), color = self.VolumeOutlineColor)
|
||||||
|
|
||||||
mb.addLine(Vector(minW, minH, maxD), Vector(maxW, minH, maxD), color = self.VolumeOutlineColor)
|
mb.addLine(Vector(min_w, min_h, max_d), Vector(max_w, min_h, max_d), color = self.VolumeOutlineColor)
|
||||||
mb.addLine(Vector(minW, minH, maxD), Vector(minW, maxH, maxD), color = self.VolumeOutlineColor)
|
mb.addLine(Vector(min_w, min_h, max_d), Vector(min_w, max_h, max_d), color = self.VolumeOutlineColor)
|
||||||
mb.addLine(Vector(minW, maxH, maxD), Vector(maxW, maxH, maxD), color = self.VolumeOutlineColor)
|
mb.addLine(Vector(min_w, max_h, max_d), Vector(max_w, max_h, max_d), color = self.VolumeOutlineColor)
|
||||||
mb.addLine(Vector(maxW, minH, maxD), Vector(maxW, maxH, maxD), color = self.VolumeOutlineColor)
|
mb.addLine(Vector(max_w, min_h, max_d), Vector(max_w, max_h, max_d), color = self.VolumeOutlineColor)
|
||||||
|
|
||||||
mb.addLine(Vector(minW, minH, minD), Vector(minW, minH, maxD), color = self.VolumeOutlineColor)
|
mb.addLine(Vector(min_w, min_h, min_d), Vector(min_w, min_h, max_d), color = self.VolumeOutlineColor)
|
||||||
mb.addLine(Vector(maxW, minH, minD), Vector(maxW, minH, maxD), color = self.VolumeOutlineColor)
|
mb.addLine(Vector(max_w, min_h, min_d), Vector(max_w, min_h, max_d), color = self.VolumeOutlineColor)
|
||||||
mb.addLine(Vector(minW, maxH, minD), Vector(minW, maxH, maxD), color = self.VolumeOutlineColor)
|
mb.addLine(Vector(min_w, max_h, min_d), Vector(min_w, max_h, max_d), color = self.VolumeOutlineColor)
|
||||||
mb.addLine(Vector(maxW, maxH, minD), Vector(maxW, maxH, maxD), color = self.VolumeOutlineColor)
|
mb.addLine(Vector(max_w, max_h, min_d), Vector(max_w, max_h, max_d), color = self.VolumeOutlineColor)
|
||||||
|
|
||||||
self.setMeshData(mb.getData())
|
self.setMeshData(mb.getData())
|
||||||
|
|
||||||
mb = MeshBuilder()
|
mb = MeshBuilder()
|
||||||
mb.addQuad(
|
mb.addQuad(
|
||||||
Vector(minW, minH, minD),
|
Vector(min_w, min_h, min_d),
|
||||||
Vector(maxW, minH, minD),
|
Vector(max_w, min_h, min_d),
|
||||||
Vector(maxW, minH, maxD),
|
Vector(max_w, min_h, max_d),
|
||||||
Vector(minW, minH, maxD)
|
Vector(min_w, min_h, max_d)
|
||||||
)
|
)
|
||||||
self._grid_mesh = mb.getData()
|
self._grid_mesh = mb.getData()
|
||||||
for n in range(0, 6):
|
for n in range(0, 6):
|
||||||
@ -128,10 +128,10 @@ class BuildVolume(SceneNode):
|
|||||||
color = Color(0.0, 0.0, 0.0, 0.15)
|
color = Color(0.0, 0.0, 0.0, 0.15)
|
||||||
for polygon in self._disallowed_areas:
|
for polygon in self._disallowed_areas:
|
||||||
points = polygon.getPoints()
|
points = polygon.getPoints()
|
||||||
first = Vector(self._clamp(points[0][0], minW, maxW), disallowed_area_height, self._clamp(points[0][1], minD, maxD))
|
first = Vector(self._clamp(points[0][0], min_w, max_w), disallowed_area_height, self._clamp(points[0][1], min_d, max_d))
|
||||||
previous_point = Vector(self._clamp(points[0][0], minW, maxW), disallowed_area_height, self._clamp(points[0][1], minD, maxD))
|
previous_point = Vector(self._clamp(points[0][0], min_w, max_w), disallowed_area_height, self._clamp(points[0][1], min_d, max_d))
|
||||||
for point in points:
|
for point in points:
|
||||||
new_point = Vector(self._clamp(point[0], minW, maxW), disallowed_area_height, self._clamp(point[1], minD, maxD))
|
new_point = Vector(self._clamp(point[0], min_w, max_w), disallowed_area_height, self._clamp(point[1], min_d, max_d))
|
||||||
mb.addFace(first, previous_point, new_point, color = color)
|
mb.addFace(first, previous_point, new_point, color = color)
|
||||||
previous_point = new_point
|
previous_point = new_point
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ class BuildVolume(SceneNode):
|
|||||||
else:
|
else:
|
||||||
self._disallowed_area_mesh = None
|
self._disallowed_area_mesh = None
|
||||||
|
|
||||||
self._aabb = AxisAlignedBox(minimum = Vector(minW, minH - 1.0, minD), maximum = Vector(maxW, maxH, maxD))
|
self._aabb = AxisAlignedBox(minimum = Vector(min_w, min_h - 1.0, min_d), maximum = Vector(max_w, max_h, max_d))
|
||||||
|
|
||||||
skirt_size = 0.0
|
skirt_size = 0.0
|
||||||
|
|
||||||
@ -152,8 +152,8 @@ class BuildVolume(SceneNode):
|
|||||||
skirt_size = self._getSkirtSize(profile)
|
skirt_size = self._getSkirtSize(profile)
|
||||||
|
|
||||||
scale_to_max_bounds = AxisAlignedBox(
|
scale_to_max_bounds = AxisAlignedBox(
|
||||||
minimum = Vector(minW + skirt_size, minH, minD + skirt_size + disallowed_area_size),
|
minimum = Vector(min_w + skirt_size, min_h, min_d + skirt_size + disallowed_area_size),
|
||||||
maximum = Vector(maxW - skirt_size, maxH, maxD - skirt_size - disallowed_area_size)
|
maximum = Vector(max_w - skirt_size, max_h, max_d - skirt_size - disallowed_area_size)
|
||||||
)
|
)
|
||||||
|
|
||||||
Application.getInstance().getController().getScene()._maximum_bounds = scale_to_max_bounds
|
Application.getInstance().getController().getScene()._maximum_bounds = scale_to_max_bounds
|
||||||
|
@ -29,7 +29,7 @@ class ConvexHullNode(SceneNode):
|
|||||||
self._node.parentChanged.connect(self._onNodeParentChanged)
|
self._node.parentChanged.connect(self._onNodeParentChanged)
|
||||||
self._node.decoratorsChanged.connect(self._onNodeDecoratorsChanged)
|
self._node.decoratorsChanged.connect(self._onNodeDecoratorsChanged)
|
||||||
self._onNodeDecoratorsChanged(self._node)
|
self._onNodeDecoratorsChanged(self._node)
|
||||||
self.convexHullHeadMesh = None
|
self._convex_hull_head_mesh = None
|
||||||
self._hull = hull
|
self._hull = hull
|
||||||
|
|
||||||
hull_points = self._hull.getPoints()
|
hull_points = self._hull.getPoints()
|
||||||
@ -38,7 +38,7 @@ class ConvexHullNode(SceneNode):
|
|||||||
self.setMeshData(hull_mesh)
|
self.setMeshData(hull_mesh)
|
||||||
convex_hull_head = self._node.callDecoration("getConvexHullHead")
|
convex_hull_head = self._node.callDecoration("getConvexHullHead")
|
||||||
if convex_hull_head:
|
if convex_hull_head:
|
||||||
self.convexHullHeadMesh = self.createHullMesh(convex_hull_head.getPoints())
|
self._convex_hull_head_mesh = self.createHullMesh(convex_hull_head.getPoints())
|
||||||
|
|
||||||
def createHullMesh(self, hull_points):
|
def createHullMesh(self, hull_points):
|
||||||
mesh = MeshData()
|
mesh = MeshData()
|
||||||
@ -68,8 +68,8 @@ class ConvexHullNode(SceneNode):
|
|||||||
if self.getParent():
|
if self.getParent():
|
||||||
self._material.setUniformValue("u_color", self._color)
|
self._material.setUniformValue("u_color", self._color)
|
||||||
renderer.queueNode(self, material = self._material, transparent = True)
|
renderer.queueNode(self, material = self._material, transparent = True)
|
||||||
if self.convexHullHeadMesh:
|
if self._convex_hull_head_mesh:
|
||||||
renderer.queueNode(self, material = self._material,transparent = True, mesh = self.convexHullHeadMesh)
|
renderer.queueNode(self, material = self._material,transparent = True, mesh = self._convex_hull_head_mesh)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -3,11 +3,6 @@
|
|||||||
|
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
if platform.system() == "Linux": # Needed for platform.linux_distribution, which is not available on Windows and OSX
|
|
||||||
# For Ubuntu: https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/941826
|
|
||||||
if platform.linux_distribution()[0] in ("Ubuntu", ): # Just in case it also happens on Debian, so it can be added
|
|
||||||
from OpenGL import GL
|
|
||||||
|
|
||||||
from UM.Qt.QtApplication import QtApplication
|
from UM.Qt.QtApplication import QtApplication
|
||||||
from UM.Scene.SceneNode import SceneNode
|
from UM.Scene.SceneNode import SceneNode
|
||||||
from UM.Scene.Camera import Camera
|
from UM.Scene.Camera import Camera
|
||||||
@ -59,10 +54,15 @@ import numpy
|
|||||||
import copy
|
import copy
|
||||||
numpy.seterr(all="ignore")
|
numpy.seterr(all="ignore")
|
||||||
|
|
||||||
|
if platform.system() == "Linux": # Needed for platform.linux_distribution, which is not available on Windows and OSX
|
||||||
|
# For Ubuntu: https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/941826
|
||||||
|
if platform.linux_distribution()[0] in ("Ubuntu", ): # Just in case it also happens on Debian, so it can be added
|
||||||
|
from OpenGL import GL
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from cura.CuraVersion import CuraVersion
|
from cura.CuraVersion import CuraVersion
|
||||||
except ImportError:
|
except ImportError:
|
||||||
CuraVersion = "master"
|
CuraVersion = "master" # [CodeStyle: Reflecting imported value]
|
||||||
|
|
||||||
class CuraApplication(QtApplication):
|
class CuraApplication(QtApplication):
|
||||||
class ResourceTypes:
|
class ResourceTypes:
|
||||||
@ -142,7 +142,7 @@ class CuraApplication(QtApplication):
|
|||||||
parser.add_argument("--debug", dest="debug-mode", action="store_true", default=False, help="Enable detailed crash reports.")
|
parser.add_argument("--debug", dest="debug-mode", action="store_true", default=False, help="Enable detailed crash reports.")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION" in os.environ or os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] != "cpp":
|
if "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION" not in os.environ or os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] != "cpp":
|
||||||
Logger.log("w", "Using Python implementation of Protobuf, expect bad performance!")
|
Logger.log("w", "Using Python implementation of Protobuf, expect bad performance!")
|
||||||
|
|
||||||
self._i18n_catalog = i18nCatalog("cura");
|
self._i18n_catalog = i18nCatalog("cura");
|
||||||
@ -263,6 +263,7 @@ class CuraApplication(QtApplication):
|
|||||||
self.jobNameChanged.emit()
|
self.jobNameChanged.emit()
|
||||||
|
|
||||||
jobNameChanged = pyqtSignal()
|
jobNameChanged = pyqtSignal()
|
||||||
|
|
||||||
@pyqtProperty(str, notify = jobNameChanged)
|
@pyqtProperty(str, notify = jobNameChanged)
|
||||||
def jobName(self):
|
def jobName(self):
|
||||||
return self._job_name
|
return self._job_name
|
||||||
@ -427,6 +428,7 @@ class CuraApplication(QtApplication):
|
|||||||
return log
|
return log
|
||||||
|
|
||||||
recentFilesChanged = pyqtSignal()
|
recentFilesChanged = pyqtSignal()
|
||||||
|
|
||||||
@pyqtProperty("QVariantList", notify = recentFilesChanged)
|
@pyqtProperty("QVariantList", notify = recentFilesChanged)
|
||||||
def recentFiles(self):
|
def recentFiles(self):
|
||||||
return self._recent_files
|
return self._recent_files
|
||||||
@ -441,6 +443,7 @@ class CuraApplication(QtApplication):
|
|||||||
self.expandedCategoriesChanged.emit()
|
self.expandedCategoriesChanged.emit()
|
||||||
|
|
||||||
expandedCategoriesChanged = pyqtSignal()
|
expandedCategoriesChanged = pyqtSignal()
|
||||||
|
|
||||||
@pyqtProperty("QStringList", notify = expandedCategoriesChanged)
|
@pyqtProperty("QStringList", notify = expandedCategoriesChanged)
|
||||||
def expandedCategories(self):
|
def expandedCategories(self):
|
||||||
return Preferences.getInstance().getValue("cura/categories_expanded").split(";")
|
return Preferences.getInstance().getValue("cura/categories_expanded").split(";")
|
||||||
|
@ -45,7 +45,7 @@ class OneAtATimeIterator(Iterator.Iterator):
|
|||||||
# This does not decrease the worst case running time, but should improve it in most cases.
|
# This does not decrease the worst case running time, but should improve it in most cases.
|
||||||
sorted(node_list, key = cmp_to_key(self._calculateScore))
|
sorted(node_list, key = cmp_to_key(self._calculateScore))
|
||||||
|
|
||||||
todo_node_list = [_objectOrder([], node_list)]
|
todo_node_list = [_ObjectOrder([], node_list)]
|
||||||
while len(todo_node_list) > 0:
|
while len(todo_node_list) > 0:
|
||||||
current = todo_node_list.pop()
|
current = todo_node_list.pop()
|
||||||
for node in current.todo:
|
for node in current.todo:
|
||||||
@ -61,7 +61,7 @@ class OneAtATimeIterator(Iterator.Iterator):
|
|||||||
self._node_stack = new_order
|
self._node_stack = new_order
|
||||||
|
|
||||||
return
|
return
|
||||||
todo_node_list.append(_objectOrder(new_order, new_todo_list))
|
todo_node_list.append(_ObjectOrder(new_order, new_todo_list))
|
||||||
self._node_stack = [] #No result found!
|
self._node_stack = [] #No result found!
|
||||||
|
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ class OneAtATimeIterator(Iterator.Iterator):
|
|||||||
|
|
||||||
|
|
||||||
## Internal object used to keep track of a possible order in which to print objects.
|
## Internal object used to keep track of a possible order in which to print objects.
|
||||||
class _objectOrder():
|
class _ObjectOrder():
|
||||||
def __init__(self, order, todo):
|
def __init__(self, order, todo):
|
||||||
"""
|
"""
|
||||||
:param order: List of indexes in which to print objects, ordered by printing order.
|
:param order: List of indexes in which to print objects, ordered by printing order.
|
||||||
|
@ -19,7 +19,8 @@ except ImportError:
|
|||||||
else:
|
else:
|
||||||
os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = "cpp"
|
os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = "cpp"
|
||||||
|
|
||||||
import cura.CuraApplication
|
if True: # To make the code style checker stop complaining
|
||||||
|
import cura.CuraApplication
|
||||||
|
|
||||||
if sys.platform == "win32" and hasattr(sys, "frozen"):
|
if sys.platform == "win32" and hasattr(sys, "frozen"):
|
||||||
import os
|
import os
|
||||||
|
@ -37,7 +37,7 @@ class ThreeMFReader(MeshReader):
|
|||||||
if extension.lower() == self._supported_extension:
|
if extension.lower() == self._supported_extension:
|
||||||
result = SceneNode()
|
result = SceneNode()
|
||||||
# The base object of 3mf is a zipped archive.
|
# The base object of 3mf is a zipped archive.
|
||||||
archive = zipfile.ZipFile(file_name, 'r')
|
archive = zipfile.ZipFile(file_name, "r")
|
||||||
try:
|
try:
|
||||||
root = ET.parse(archive.open("3D/3dmodel.model"))
|
root = ET.parse(archive.open("3D/3dmodel.model"))
|
||||||
|
|
||||||
@ -109,10 +109,10 @@ class ThreeMFReader(MeshReader):
|
|||||||
node.setOrientation(temp_quaternion)
|
node.setOrientation(temp_quaternion)
|
||||||
|
|
||||||
# Magical scale extraction
|
# Magical scale extraction
|
||||||
S2 = temp_mat.getTransposed().multiply(temp_mat)
|
scale = temp_mat.getTransposed().multiply(temp_mat)
|
||||||
scale_x = math.sqrt(S2.at(0,0))
|
scale_x = math.sqrt(scale.at(0,0))
|
||||||
scale_y = math.sqrt(S2.at(1,1))
|
scale_y = math.sqrt(scale.at(1,1))
|
||||||
scale_z = math.sqrt(S2.at(2,2))
|
scale_z = math.sqrt(scale.at(2,2))
|
||||||
node.setScale(Vector(scale_x,scale_y,scale_z))
|
node.setScale(Vector(scale_x,scale_y,scale_z))
|
||||||
|
|
||||||
# We use a different coordinate frame, so rotate.
|
# We use a different coordinate frame, so rotate.
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# Copyright (c) 2015 Ultimaker B.V.
|
# Copyright (c) 2015 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the AGPLv3 or higher.
|
# Cura is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
|
from . import ThreeMFReader
|
||||||
|
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
from . import ThreeMFReader
|
|
||||||
|
|
||||||
def getMetaData():
|
def getMetaData():
|
||||||
return {
|
return {
|
||||||
"plugin": {
|
"plugin": {
|
||||||
|
@ -58,7 +58,7 @@ class ChangeLog(Extension, QObject,):
|
|||||||
|
|
||||||
def loadChangeLogs(self):
|
def loadChangeLogs(self):
|
||||||
self._change_logs = collections.OrderedDict()
|
self._change_logs = collections.OrderedDict()
|
||||||
with open(os.path.join(PluginRegistry.getInstance().getPluginPath("ChangeLogPlugin"), "ChangeLog.txt"), 'r',-1, "utf-8") as f:
|
with open(os.path.join(PluginRegistry.getInstance().getPluginPath("ChangeLogPlugin"), "ChangeLog.txt"), "r",-1, "utf-8") as f:
|
||||||
open_version = None
|
open_version = None
|
||||||
open_header = None
|
open_header = None
|
||||||
for line in f:
|
for line in f:
|
||||||
|
@ -125,7 +125,7 @@ class CuraEngineBackend(Backend):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if self._profile.hasErrorValue():
|
if self._profile.hasErrorValue():
|
||||||
Logger.log('w', "Profile has error values. Aborting slicing")
|
Logger.log("w", "Profile has error values. Aborting slicing")
|
||||||
if self._message:
|
if self._message:
|
||||||
self._message.hide()
|
self._message.hide()
|
||||||
self._message = None
|
self._message = None
|
||||||
|
@ -32,7 +32,7 @@ class ProcessSlicedObjectListJob(Job):
|
|||||||
|
|
||||||
Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged)
|
Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged)
|
||||||
|
|
||||||
objectIdMap = {}
|
object_id_map = {}
|
||||||
new_node = SceneNode()
|
new_node = SceneNode()
|
||||||
## Put all nodes in a dict identified by ID
|
## Put all nodes in a dict identified by ID
|
||||||
for node in DepthFirstIterator(self._scene.getRoot()):
|
for node in DepthFirstIterator(self._scene.getRoot()):
|
||||||
@ -40,11 +40,10 @@ class ProcessSlicedObjectListJob(Job):
|
|||||||
if node.callDecoration("getLayerData"):
|
if node.callDecoration("getLayerData"):
|
||||||
self._scene.getRoot().removeChild(node)
|
self._scene.getRoot().removeChild(node)
|
||||||
else:
|
else:
|
||||||
objectIdMap[id(node)] = node
|
object_id_map[id(node)] = node
|
||||||
Job.yieldThread()
|
Job.yieldThread()
|
||||||
|
|
||||||
settings = Application.getInstance().getMachineManager().getActiveProfile()
|
settings = Application.getInstance().getMachineManager().getActiveProfile()
|
||||||
layerHeight = settings.getSettingValue("layer_height")
|
|
||||||
|
|
||||||
center = None
|
center = None
|
||||||
if not settings.getSettingValue("machine_center_is_zero"):
|
if not settings.getSettingValue("machine_center_is_zero"):
|
||||||
@ -62,7 +61,7 @@ class ProcessSlicedObjectListJob(Job):
|
|||||||
current_layer = 0
|
current_layer = 0
|
||||||
for object in self._message.objects:
|
for object in self._message.objects:
|
||||||
try:
|
try:
|
||||||
node = objectIdMap[object.id]
|
node = object_id_map[object.id]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ from . import Cura_pb2
|
|||||||
|
|
||||||
## Formatter class that handles token expansion in start/end gcod
|
## Formatter class that handles token expansion in start/end gcod
|
||||||
class GcodeStartEndFormatter(Formatter):
|
class GcodeStartEndFormatter(Formatter):
|
||||||
def get_value(self, key, args, kwargs):
|
def get_value(self, key, args, kwargs): # [CodeStyle: get_value is an overridden function from the Formatter class]
|
||||||
if isinstance(key, str):
|
if isinstance(key, str):
|
||||||
try:
|
try:
|
||||||
return kwargs[key]
|
return kwargs[key]
|
||||||
@ -118,8 +118,8 @@ class StartSliceJob(Job):
|
|||||||
msg = Cura_pb2.SettingList()
|
msg = Cura_pb2.SettingList()
|
||||||
settings = profile.getAllSettingValues(include_machine = True)
|
settings = profile.getAllSettingValues(include_machine = True)
|
||||||
start_gcode = settings["machine_start_gcode"]
|
start_gcode = settings["machine_start_gcode"]
|
||||||
settings["material_bed_temp_prepend"] = not "{material_bed_temperature}" in start_gcode
|
settings["material_bed_temp_prepend"] = "{material_bed_temperature}" not in start_gcode
|
||||||
settings["material_print_temp_prepend"] = not "{material_print_temperature}" in start_gcode
|
settings["material_print_temp_prepend"] = "{material_print_temperature}" not in start_gcode
|
||||||
for key, value in settings.items():
|
for key, value in settings.items():
|
||||||
s = msg.settings.add()
|
s = msg.settings.add()
|
||||||
s.name = key
|
s.name = key
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# Copyright (c) 2015 Ultimaker B.V.
|
# Copyright (c) 2015 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the AGPLv3 or higher.
|
# Cura is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
|
from . import GCodeReader
|
||||||
|
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
from . import GCodeReader
|
|
||||||
|
|
||||||
def getMetaData():
|
def getMetaData():
|
||||||
return {
|
return {
|
||||||
"plugin": {
|
"plugin": {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty
|
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
|
||||||
import LayerView
|
import LayerView
|
||||||
|
|
||||||
class LayerViewProxy(QObject):
|
class LayerViewProxy(QObject):
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
@ -52,4 +54,4 @@ class LayerViewProxy(QObject):
|
|||||||
active_view = self._controller.getActiveView()
|
active_view = self._controller.getActiveView()
|
||||||
if type(active_view) == LayerView.LayerView.LayerView:
|
if type(active_view) == LayerView.LayerView.LayerView:
|
||||||
active_view.currentLayerNumChanged.connect(self._onLayerChanged)
|
active_view.currentLayerNumChanged.connect(self._onLayerChanged)
|
||||||
active_view.maxLayersChanged.connect(self._onMaxLayersChanged)
|
active_view.maxLayersChanged.connect(self._onMaxLayersChanged)
|
||||||
|
@ -20,17 +20,17 @@ catalog = i18nCatalog("cura")
|
|||||||
|
|
||||||
# WinAPI Constants that we need
|
# WinAPI Constants that we need
|
||||||
# Hardcoded here due to stupid WinDLL stuff that does not give us access to these values.
|
# Hardcoded here due to stupid WinDLL stuff that does not give us access to these values.
|
||||||
DRIVE_REMOVABLE = 2
|
DRIVE_REMOVABLE = 2 # [CodeStyle: Windows Enum value]
|
||||||
|
|
||||||
GENERIC_READ = 2147483648
|
GENERIC_READ = 2147483648 # [CodeStyle: Windows Enum value]
|
||||||
GENERIC_WRITE = 1073741824
|
GENERIC_WRITE = 1073741824 # [CodeStyle: Windows Enum value]
|
||||||
|
|
||||||
FILE_SHARE_READ = 1
|
FILE_SHARE_READ = 1 # [CodeStyle: Windows Enum value]
|
||||||
FILE_SHARE_WRITE = 2
|
FILE_SHARE_WRITE = 2 # [CodeStyle: Windows Enum value]
|
||||||
|
|
||||||
IOCTL_STORAGE_EJECT_MEDIA = 2967560
|
IOCTL_STORAGE_EJECT_MEDIA = 2967560 # [CodeStyle: Windows Enum value]
|
||||||
|
|
||||||
OPEN_EXISTING = 3
|
OPEN_EXISTING = 3 # [CodeStyle: Windows Enum value]
|
||||||
|
|
||||||
## Removable drive support for windows
|
## Removable drive support for windows
|
||||||
class WindowsRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
|
class WindowsRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
|
||||||
|
@ -110,7 +110,7 @@ class SliceInfo(Extension):
|
|||||||
|
|
||||||
# Convert data to bytes
|
# Convert data to bytes
|
||||||
submitted_data = urllib.parse.urlencode(submitted_data)
|
submitted_data = urllib.parse.urlencode(submitted_data)
|
||||||
binary_data = submitted_data.encode('utf-8')
|
binary_data = submitted_data.encode("utf-8")
|
||||||
|
|
||||||
# Submit data
|
# Submit data
|
||||||
try:
|
try:
|
||||||
|
@ -471,17 +471,17 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
|
|||||||
self.showControlInterface()
|
self.showControlInterface()
|
||||||
|
|
||||||
def _setEndstopState(self, endstop_key, value):
|
def _setEndstopState(self, endstop_key, value):
|
||||||
if endstop_key == b'x_min':
|
if endstop_key == b"x_min":
|
||||||
if self._x_min_endstop_pressed != value:
|
if self._x_min_endstop_pressed != value:
|
||||||
self.endstopStateChanged.emit('x_min', value)
|
self.endstopStateChanged.emit("x_min", value)
|
||||||
self._x_min_endstop_pressed = value
|
self._x_min_endstop_pressed = value
|
||||||
elif endstop_key == b'y_min':
|
elif endstop_key == b"y_min":
|
||||||
if self._y_min_endstop_pressed != value:
|
if self._y_min_endstop_pressed != value:
|
||||||
self.endstopStateChanged.emit('y_min', value)
|
self.endstopStateChanged.emit("y_min", value)
|
||||||
self._y_min_endstop_pressed = value
|
self._y_min_endstop_pressed = value
|
||||||
elif endstop_key == b'z_min':
|
elif endstop_key == b"z_min":
|
||||||
if self._z_min_endstop_pressed != value:
|
if self._z_min_endstop_pressed != value:
|
||||||
self.endstopStateChanged.emit('z_min', value)
|
self.endstopStateChanged.emit("z_min", value)
|
||||||
self._z_min_endstop_pressed = value
|
self._z_min_endstop_pressed = value
|
||||||
|
|
||||||
## Listen thread function.
|
## Listen thread function.
|
||||||
@ -528,8 +528,8 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
|
|||||||
pass
|
pass
|
||||||
#TODO: temperature changed callback
|
#TODO: temperature changed callback
|
||||||
elif b"_min" in line or b"_max" in line:
|
elif b"_min" in line or b"_max" in line:
|
||||||
tag, value = line.split(b':', 1)
|
tag, value = line.split(b":", 1)
|
||||||
self._setEndstopState(tag,(b'H' in value or b'TRIGGERED' in value))
|
self._setEndstopState(tag,(b"H" in value or b"TRIGGERED" in value))
|
||||||
|
|
||||||
if self._is_printing:
|
if self._is_printing:
|
||||||
if line == b"" and time.time() > ok_timeout:
|
if line == b"" and time.time() > ok_timeout:
|
||||||
|
@ -56,6 +56,7 @@ class USBPrinterManager(QObject, SignalEmitter, OutputDevicePlugin, Extension):
|
|||||||
printerConnectionStateChanged = pyqtSignal()
|
printerConnectionStateChanged = pyqtSignal()
|
||||||
|
|
||||||
progressChanged = pyqtSignal()
|
progressChanged = pyqtSignal()
|
||||||
|
|
||||||
@pyqtProperty(float, notify = progressChanged)
|
@pyqtProperty(float, notify = progressChanged)
|
||||||
def progress(self):
|
def progress(self):
|
||||||
progress = 0
|
progress = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user