mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-21 13:47:51 -06:00
Since I can't program a phyton, the script author doesn't have time for a revision and I haven't found any in the X40 community either, I deleted the X40Snapshot.py script.
This commit is contained in:
parent
3ed8e6ee3f
commit
9ea6dbf668
5 changed files with 0 additions and 140 deletions
|
@ -1,80 +0,0 @@
|
||||||
from UM.Logger import Logger
|
|
||||||
from cura.Snapshot import Snapshot
|
|
||||||
from PyQt5.QtCore import QBuffer
|
|
||||||
|
|
||||||
from ..Script import Script
|
|
||||||
|
|
||||||
|
|
||||||
class X40Snapshot(Script):
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__()
|
|
||||||
|
|
||||||
def _createSnapshot(self, width, height):
|
|
||||||
Logger.log("d", "Creating thumbnail image...")
|
|
||||||
try:
|
|
||||||
return Snapshot.snapshot(width, height)
|
|
||||||
except Exception:
|
|
||||||
Logger.logException("w", "Failed to create snapshot image")
|
|
||||||
|
|
||||||
def _convertSnapshotToGcode(self, snapshot):
|
|
||||||
Logger.log("d", "Encoding thumbnail image...")
|
|
||||||
try:
|
|
||||||
thumbnail_buffer = QBuffer()
|
|
||||||
thumbnail_buffer.open(QBuffer.ReadWrite)
|
|
||||||
thumbnail_image = snapshot
|
|
||||||
thumbnail_image.save(thumbnail_buffer, "JPG")
|
|
||||||
|
|
||||||
thumbnail_buffer.seek(0)
|
|
||||||
gcode = []
|
|
||||||
newline = "W221"
|
|
||||||
byte = thumbnail_buffer.read(1)
|
|
||||||
counter = 0
|
|
||||||
while byte != b"":
|
|
||||||
if counter == 0:
|
|
||||||
gcode.append(newline)
|
|
||||||
newline = "W220 "
|
|
||||||
counter = 40
|
|
||||||
newline += byte.hex()
|
|
||||||
counter -= 1
|
|
||||||
|
|
||||||
byte = thumbnail_buffer.read(1)
|
|
||||||
gcode.append(newline)
|
|
||||||
gcode.append("W222")
|
|
||||||
|
|
||||||
thumbnail_buffer.close()
|
|
||||||
return gcode
|
|
||||||
except Exception:
|
|
||||||
Logger.logException("w", "Failed to encode snapshot image")
|
|
||||||
|
|
||||||
def getSettingDataString(self):
|
|
||||||
return """{
|
|
||||||
"name": "Create Thumbnail for Weedo X40",
|
|
||||||
"key": "X40Snapshot",
|
|
||||||
"metadata": {},
|
|
||||||
"version": 2,
|
|
||||||
"settings":
|
|
||||||
{}
|
|
||||||
}"""
|
|
||||||
|
|
||||||
def execute(self, data):
|
|
||||||
width = 180
|
|
||||||
height = 180
|
|
||||||
|
|
||||||
snapshot = self._createSnapshot(width, height)
|
|
||||||
if snapshot:
|
|
||||||
snapshot_gcode = self._convertSnapshotToGcode(snapshot)
|
|
||||||
|
|
||||||
for layer in data:
|
|
||||||
layer_index = data.index(layer)
|
|
||||||
lines = data[layer_index].split("\n")
|
|
||||||
for line in lines:
|
|
||||||
if line.startswith(";Generated with Cura"):
|
|
||||||
line_index = lines.index(line)
|
|
||||||
insert_index = line_index + 1
|
|
||||||
lines[insert_index:insert_index] = snapshot_gcode
|
|
||||||
break
|
|
||||||
|
|
||||||
final_lines = "\n".join(lines)
|
|
||||||
data[layer_index] = final_lines
|
|
||||||
|
|
||||||
return data
|
|
|
@ -1,16 +0,0 @@
|
||||||
[general]
|
|
||||||
version = 4
|
|
||||||
name = Draft
|
|
||||||
definition = weedo_x40
|
|
||||||
|
|
||||||
[metadata]
|
|
||||||
setting_version = 17
|
|
||||||
type = quality
|
|
||||||
quality_type = draft
|
|
||||||
weight = -4
|
|
||||||
global_quality = True
|
|
||||||
|
|
||||||
[values]
|
|
||||||
layer_height = 0.24
|
|
||||||
raft_interface_thickness = 0.30
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
[general]
|
|
||||||
version = 4
|
|
||||||
name = Extra Fine
|
|
||||||
definition = weedo_x40
|
|
||||||
|
|
||||||
[metadata]
|
|
||||||
setting_version = 17
|
|
||||||
type = quality
|
|
||||||
quality_type = extra fine
|
|
||||||
weight = -1
|
|
||||||
global_quality = True
|
|
||||||
|
|
||||||
[values]
|
|
||||||
layer_height = 0.12
|
|
|
@ -1,15 +0,0 @@
|
||||||
[general]
|
|
||||||
version = 4
|
|
||||||
name = Fine
|
|
||||||
definition = weedo_x40
|
|
||||||
|
|
||||||
[metadata]
|
|
||||||
setting_version = 17
|
|
||||||
type = quality
|
|
||||||
quality_type = fine
|
|
||||||
weight = -2
|
|
||||||
global_quality = True
|
|
||||||
|
|
||||||
[values]
|
|
||||||
layer_height = 0.16
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
[general]
|
|
||||||
version = 4
|
|
||||||
name = Normal
|
|
||||||
definition = weedo_x40
|
|
||||||
|
|
||||||
[metadata]
|
|
||||||
setting_version = 17
|
|
||||||
type = quality
|
|
||||||
quality_type = normal
|
|
||||||
weight = -3
|
|
||||||
global_quality = True
|
|
||||||
|
|
||||||
[values]
|
|
||||||
layer_height = 0.2
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue